Merge branch 'ls/no-double-utf8-author-name' of ../git-gui into ls/git-gui-no-double-utf8-author-name

* 'ls/no-double-utf8-author-name' of ../git-gui:
  git-gui: prevent double UTF-8 conversion
This commit is contained in:
Junio C Hamano 2017-12-05 09:20:12 -08:00
Родитель 1a4e40aa5d 331450f18a
Коммит 77e4224390
1 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -25,6 +25,8 @@ You are currently in the middle of a merge that has not been fully completed. Y
set msg {}
set parents [list]
if {[catch {
set name ""
set email ""
set fd [git_read cat-file commit $curHEAD]
fconfigure $fd -encoding binary -translation lf
# By default commits are assumed to be in utf-8
@ -34,9 +36,7 @@ You are currently in the middle of a merge that has not been fully completed. Y
lappend parents [string range $line 7 end]
} elseif {[string match {encoding *} $line]} {
set enc [string tolower [string range $line 9 end]]
} elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} {
set commit_author [list name $name email $email date $time]
}
} elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} { }
}
set msg [read $fd]
close $fd
@ -44,7 +44,13 @@ You are currently in the middle of a merge that has not been fully completed. Y
set enc [tcl_encoding $enc]
if {$enc ne {}} {
set msg [encoding convertfrom $enc $msg]
set name [encoding convertfrom $enc $name]
set email [encoding convertfrom $enc $email]
}
if {$name ne {} && $email ne {}} {
set commit_author [list name $name email $email date $time]
}
set msg [string trim $msg]
} err]} {
error_popup [strcat [mc "Error loading commit data for amend:"] "\n\n$err"]