Re: [PATCH v4] git-gui: Prevent double UTF-8 conversion

2017-12-14 Thread Eric Sunshine
On Thu, Dec 14, 2017 at 5:43 AM, Łukasz Stelmach  wrote:
> It was <2017-12-14 czw 10:42>, when Eric Sunshine wrote:
>> No need to re-send. If you consult Junio's latest "What's cooking"[1],
>> you'll find that your patch has already graduated from his 'pu' branch
>> to 'next' and is slated to graduate to 'master' (at some point).
>>
>> [1]: 
>> https://public-inbox.org/git/xmqqzi6mutcc@gitster.mtv.corp.google.com/
>
> I am sorry. I didn't get any notifiaction by mail and I haven't studied
> Documentation/SubmittingPatches throughly enough.

No need for an apology. My response was just a simple informational
message to help you (and perhaps other newcomers reading this thread)
get up to speed.


Re: [PATCH v4] git-gui: Prevent double UTF-8 conversion

2017-12-14 Thread Łukasz Stelmach
It was <2017-12-14 czw 10:42>, when Eric Sunshine wrote:
> On Thu, Dec 14, 2017 at 4:32 AM, Łukasz Stelmach  
> wrote:
>> Convert author's name and e-mail address from the UTF-8 (or any other)
>> encoding in load_last_commit function the same way commit message is
>> converted.
>>
>> Amending commits in git-gui without such conversion breaks UTF-8
>> strings. For example, "\305\201ukasz" (as written by git cat-file) becomes
>> "\303\205\302\201ukasz" in an amended commit.
>>
>> Signed-off-by: Łukasz Stelmach 
>> Reviewed-by: Johannes Schindelin 
>> ---
>> Changes since v3:
>>
>> - Added Reviewed-by footer. Thank you Johannes Schindelin, for review.
>
> No need to re-send. If you consult Junio's latest "What's cooking"[1],
> you'll find that your patch has already graduated from his 'pu' branch
> to 'next' and is slated to graduate to 'master' (at some point).
>
> [1]: 
> https://public-inbox.org/git/xmqqzi6mutcc@gitster.mtv.corp.google.com/

I am sorry. I didn't get any notifiaction by mail and I haven't studied
Documentation/SubmittingPatches throughly enough.

-- 
Łukasz Stelmach
Samsung R Institute Poland
Samsung Electronics


signature.asc
Description: PGP signature


Re: [PATCH v4] git-gui: Prevent double UTF-8 conversion

2017-12-14 Thread Eric Sunshine
On Thu, Dec 14, 2017 at 4:32 AM, Łukasz Stelmach  wrote:
> Convert author's name and e-mail address from the UTF-8 (or any other)
> encoding in load_last_commit function the same way commit message is
> converted.
>
> Amending commits in git-gui without such conversion breaks UTF-8
> strings. For example, "\305\201ukasz" (as written by git cat-file) becomes
> "\303\205\302\201ukasz" in an amended commit.
>
> Signed-off-by: Łukasz Stelmach 
> Reviewed-by: Johannes Schindelin 
> ---
> Changes since v3:
>
> - Added Reviewed-by footer. Thank you Johannes Schindelin, for review.

No need to re-send. If you consult Junio's latest "What's cooking"[1],
you'll find that your patch has already graduated from his 'pu' branch
to 'next' and is slated to graduate to 'master' (at some point).

[1]: https://public-inbox.org/git/xmqqzi6mutcc@gitster.mtv.corp.google.com/


[PATCH v4] git-gui: Prevent double UTF-8 conversion

2017-12-14 Thread Łukasz Stelmach
Convert author's name and e-mail address from the UTF-8 (or any other)
encoding in load_last_commit function the same way commit message is
converted.

Amending commits in git-gui without such conversion breaks UTF-8
strings. For example, "\305\201ukasz" (as written by git cat-file) becomes
"\303\205\302\201ukasz" in an amended commit.

Signed-off-by: Łukasz Stelmach 
Reviewed-by: Johannes Schindelin 
---
Changes since v3:

- Added Reviewed-by footer. Thank you Johannes Schindelin, for review.

 git-gui/lib/commit.tcl | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl
index 83620b7cb..75ea965da 100644
--- a/git-gui/lib/commit.tcl
+++ b/git-gui/lib/commit.tcl
@@ -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"]
-- 
2.11.0