Skip to content

Commit e7d1b52

Browse files
committed
Merge branch 'ls/git-gui-no-double-utf8-author-name'
Amending commits in git-gui broke the author name that is non-ascii due to incorrect enconding conversion. * ls/git-gui-no-double-utf8-author-name: git-gui: prevent double UTF-8 conversion
2 parents f4f233e + 77e4224 commit e7d1b52

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

git-gui/lib/commit.tcl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ You are currently in the middle of a merge that has not been fully completed. Y
2525
set msg {}
2626
set parents [list]
2727
if {[catch {
28+
set name ""
29+
set email ""
2830
set fd [git_read cat-file commit $curHEAD]
2931
fconfigure $fd -encoding binary -translation lf
3032
# By default commits are assumed to be in utf-8
@@ -34,17 +36,21 @@ You are currently in the middle of a merge that has not been fully completed. Y
3436
lappend parents [string range $line 7 end]
3537
} elseif {[string match {encoding *} $line]} {
3638
set enc [string tolower [string range $line 9 end]]
37-
} elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} {
38-
set commit_author [list name $name email $email date $time]
39-
}
39+
} elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} { }
4040
}
4141
set msg [read $fd]
4242
close $fd
4343

4444
set enc [tcl_encoding $enc]
4545
if {$enc ne {}} {
4646
set msg [encoding convertfrom $enc $msg]
47+
set name [encoding convertfrom $enc $name]
48+
set email [encoding convertfrom $enc $email]
4749
}
50+
if {$name ne {} && $email ne {}} {
51+
set commit_author [list name $name email $email date $time]
52+
}
53+
4854
set msg [string trim $msg]
4955
} err]} {
5056
error_popup [strcat [mc "Error loading commit data for amend:"] "\n\n$err"]

0 commit comments

Comments
 (0)