threads / patch / 42226

patchgit-gui: Do not reset author details on amend

Subject: [PATCH] git-gui: Do not reset author details on amend

## tl;dr

10 messages between May 5, 2016 and Sep 27, 2016. Diffs are folded; open one to read it.

replies: 9people: 3as markdown or json

Orgad Shaneh· May 5, 2016, 14:23 UTC · lore

git commit --amend preserves the author details unless --reset-author is given.

git-gui discards the author details on amend.

Fix by reading the author details along with the commit message, and setting the appropriate environment variables required for preserving them.

Reported long ago in the mailing list[1].
[1] http://article.gmane.org/gmane.comp.version-control.git/243921
Signed-off-by: Orgad Shaneh <orgads@gmail.com>
---
 git-gui/lib/commit.tcl | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
Show changes to git-gui/lib/commit.tcl +19 −0
diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl
index 864b687..60edf99 100644
--- a/git-gui/lib/commit.tcl
+++ b/git-gui/lib/commit.tcl
@@ -1,8 +1,13 @@
 # git-gui misc. commit reading/writing support
 # Copyright (C) 2006, 2007 Shawn Pearce
 
+set author_name ""
+set author_email ""
+set author_date ""
+
 proc load_last_commit {} {
 	global HEAD PARENT MERGE_HEAD commit_type ui_comm
+	global author_name author_email author_date
 	global repo_config
 
 	if {[llength $PARENT] == 0} {
@@ -34,6 +39,10 @@ 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 author_name $name
+					set author_email $email
+					set author_date $time
 				}
 			}
 			set msg [read $fd]
@@ -107,8 +116,12 @@ proc do_signoff {} {
 
 proc create_new_commit {} {
 	global commit_type ui_comm
+	global author_name author_email author_date
 
 	set commit_type normal
+	set author_name ""
+	set author_email ""
+	set author_date ""
 	$ui_comm delete 0.0 end
 	$ui_comm edit reset
 	$ui_comm edit modified false
@@ -327,6 +340,7 @@ proc commit_committree {fd_wt curHEAD msg_p} {
 	global ui_comm selected_commit_type
 	global file_states selected_paths rescan_active
 	global repo_config
+	global env author_name author_email author_date
 
 	gets $fd_wt tree_id
 	if {[catch {close $fd_wt} err]} {
@@ -366,6 +380,11 @@ A rescan will be automatically started now.
 		}
 	}
 
+	if {$author_name ne ""} {
+		set env(GIT_AUTHOR_NAME) $author_name
+		set env(GIT_AUTHOR_EMAIL) $author_email
+		set env(GIT_AUTHOR_DATE) $author_date
+	}
 	# -- Create the commit.
 	#
 	set cmd [list commit-tree $tree_id]
-- 
2.8.1
Junio C Hamano· May 5, 2016, 17:22 UTC · re: Orgad Shaneh · lore

Re: [PATCH] git-gui: Do not reset author details on amend

Pat, we haven't heard from you for a long time. Are you still around and interested in helping us by maintaining git-gui?

Otherwise we may have to start recruiting a volunteer or two to take this over.

Thanks.
Orgad Shaneh <orgads@gmail.com> writes:
Show 80 quoted lines
> git commit --amend preserves the author details unless --reset-author is
> given.
>
> git-gui discards the author details on amend.
>
> Fix by reading the author details along with the commit message, and
> setting the appropriate environment variables required for preserving
> them.
>
> Reported long ago in the mailing list[1].
>
> [1] http://article.gmane.org/gmane.comp.version-control.git/243921
>
> Signed-off-by: Orgad Shaneh <orgads@gmail.com>
> ---
>  git-gui/lib/commit.tcl | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl
> index 864b687..60edf99 100644
> --- a/git-gui/lib/commit.tcl
> +++ b/git-gui/lib/commit.tcl
> @@ -1,8 +1,13 @@
>  # git-gui misc. commit reading/writing support
>  # Copyright (C) 2006, 2007 Shawn Pearce
>  
> +set author_name ""
> +set author_email ""
> +set author_date ""
> +
>  proc load_last_commit {} {
>  	global HEAD PARENT MERGE_HEAD commit_type ui_comm
> +	global author_name author_email author_date
>  	global repo_config
>  
>  	if {[llength $PARENT] == 0} {
> @@ -34,6 +39,10 @@ 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 author_name $name
> +					set author_email $email
> +					set author_date $time
>  				}
>  			}
>  			set msg [read $fd]
> @@ -107,8 +116,12 @@ proc do_signoff {} {
>  
>  proc create_new_commit {} {
>  	global commit_type ui_comm
> +	global author_name author_email author_date
>  
>  	set commit_type normal
> +	set author_name ""
> +	set author_email ""
> +	set author_date ""
>  	$ui_comm delete 0.0 end
>  	$ui_comm edit reset
>  	$ui_comm edit modified false
> @@ -327,6 +340,7 @@ proc commit_committree {fd_wt curHEAD msg_p} {
>  	global ui_comm selected_commit_type
>  	global file_states selected_paths rescan_active
>  	global repo_config
> +	global env author_name author_email author_date
>  
>  	gets $fd_wt tree_id
>  	if {[catch {close $fd_wt} err]} {
> @@ -366,6 +380,11 @@ A rescan will be automatically started now.
>  		}
>  	}
>  
> +	if {$author_name ne ""} {
> +		set env(GIT_AUTHOR_NAME) $author_name
> +		set env(GIT_AUTHOR_EMAIL) $author_email
> +		set env(GIT_AUTHOR_DATE) $author_date
> +	}
>  	# -- Create the commit.
>  	#
>  	set cmd [list commit-tree $tree_id]
Orgad Shaneh· May 18, 2016, 06:12 UTC · re: Junio C Hamano · lore

Re: [PATCH] git-gui: Do not reset author details on amend

ping?
On Thu, May 5, 2016 at 8:22 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 90 quoted lines
> Pat, we haven't heard from you for a long time.  Are you still
> around and interested in helping us by maintaining git-gui?
>
> Otherwise we may have to start recruiting a volunteer or two to take
> this over.
>
> Thanks.
>
> Orgad Shaneh <orgads@gmail.com> writes:
>
>> git commit --amend preserves the author details unless --reset-author is
>> given.
>>
>> git-gui discards the author details on amend.
>>
>> Fix by reading the author details along with the commit message, and
>> setting the appropriate environment variables required for preserving
>> them.
>>
>> Reported long ago in the mailing list[1].
>>
>> [1] http://article.gmane.org/gmane.comp.version-control.git/243921
>>
>> Signed-off-by: Orgad Shaneh <orgads@gmail.com>
>> ---
>>  git-gui/lib/commit.tcl | 19 +++++++++++++++++++
>>  1 file changed, 19 insertions(+)
>>
>> diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl
>> index 864b687..60edf99 100644
>> --- a/git-gui/lib/commit.tcl
>> +++ b/git-gui/lib/commit.tcl
>> @@ -1,8 +1,13 @@
>>  # git-gui misc. commit reading/writing support
>>  # Copyright (C) 2006, 2007 Shawn Pearce
>>
>> +set author_name ""
>> +set author_email ""
>> +set author_date ""
>> +
>>  proc load_last_commit {} {
>>       global HEAD PARENT MERGE_HEAD commit_type ui_comm
>> +     global author_name author_email author_date
>>       global repo_config
>>
>>       if {[llength $PARENT] == 0} {
>> @@ -34,6 +39,10 @@ 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 author_name $name
>> +                                     set author_email $email
>> +                                     set author_date $time
>>                               }
>>                       }
>>                       set msg [read $fd]
>> @@ -107,8 +116,12 @@ proc do_signoff {} {
>>
>>  proc create_new_commit {} {
>>       global commit_type ui_comm
>> +     global author_name author_email author_date
>>
>>       set commit_type normal
>> +     set author_name ""
>> +     set author_email ""
>> +     set author_date ""
>>       $ui_comm delete 0.0 end
>>       $ui_comm edit reset
>>       $ui_comm edit modified false
>> @@ -327,6 +340,7 @@ proc commit_committree {fd_wt curHEAD msg_p} {
>>       global ui_comm selected_commit_type
>>       global file_states selected_paths rescan_active
>>       global repo_config
>> +     global env author_name author_email author_date
>>
>>       gets $fd_wt tree_id
>>       if {[catch {close $fd_wt} err]} {
>> @@ -366,6 +380,11 @@ A rescan will be automatically started now.
>>               }
>>       }
>>
>> +     if {$author_name ne ""} {
>> +             set env(GIT_AUTHOR_NAME) $author_name
>> +             set env(GIT_AUTHOR_EMAIL) $author_email
>> +             set env(GIT_AUTHOR_DATE) $author_date
>> +     }
>>       # -- Create the commit.
>>       #
>>       set cmd [list commit-tree $tree_id]
Orgad Shaneh· Jul 10, 2016, 04:36 UTC · re: Orgad Shaneh · lore

Re: [PATCH] git-gui: Do not reset author details on amend

It's been over 2 months. Can anyone please review and merge it?
Thanks.
- Orgad
On Wed, May 18, 2016 at 9:12 AM, Orgad Shaneh <orgads@gmail.com> wrote:
Show 93 quoted lines
> ping?
>
> On Thu, May 5, 2016 at 8:22 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Pat, we haven't heard from you for a long time.  Are you still
>> around and interested in helping us by maintaining git-gui?
>>
>> Otherwise we may have to start recruiting a volunteer or two to take
>> this over.
>>
>> Thanks.
>>
>> Orgad Shaneh <orgads@gmail.com> writes:
>>
>>> git commit --amend preserves the author details unless --reset-author is
>>> given.
>>>
>>> git-gui discards the author details on amend.
>>>
>>> Fix by reading the author details along with the commit message, and
>>> setting the appropriate environment variables required for preserving
>>> them.
>>>
>>> Reported long ago in the mailing list[1].
>>>
>>> [1] http://article.gmane.org/gmane.comp.version-control.git/243921
>>>
>>> Signed-off-by: Orgad Shaneh <orgads@gmail.com>
>>> ---
>>>  git-gui/lib/commit.tcl | 19 +++++++++++++++++++
>>>  1 file changed, 19 insertions(+)
>>>
>>> diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl
>>> index 864b687..60edf99 100644
>>> --- a/git-gui/lib/commit.tcl
>>> +++ b/git-gui/lib/commit.tcl
>>> @@ -1,8 +1,13 @@
>>>  # git-gui misc. commit reading/writing support
>>>  # Copyright (C) 2006, 2007 Shawn Pearce
>>>
>>> +set author_name ""
>>> +set author_email ""
>>> +set author_date ""
>>> +
>>>  proc load_last_commit {} {
>>>       global HEAD PARENT MERGE_HEAD commit_type ui_comm
>>> +     global author_name author_email author_date
>>>       global repo_config
>>>
>>>       if {[llength $PARENT] == 0} {
>>> @@ -34,6 +39,10 @@ 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 author_name $name
>>> +                                     set author_email $email
>>> +                                     set author_date $time
>>>                               }
>>>                       }
>>>                       set msg [read $fd]
>>> @@ -107,8 +116,12 @@ proc do_signoff {} {
>>>
>>>  proc create_new_commit {} {
>>>       global commit_type ui_comm
>>> +     global author_name author_email author_date
>>>
>>>       set commit_type normal
>>> +     set author_name ""
>>> +     set author_email ""
>>> +     set author_date ""
>>>       $ui_comm delete 0.0 end
>>>       $ui_comm edit reset
>>>       $ui_comm edit modified false
>>> @@ -327,6 +340,7 @@ proc commit_committree {fd_wt curHEAD msg_p} {
>>>       global ui_comm selected_commit_type
>>>       global file_states selected_paths rescan_active
>>>       global repo_config
>>> +     global env author_name author_email author_date
>>>
>>>       gets $fd_wt tree_id
>>>       if {[catch {close $fd_wt} err]} {
>>> @@ -366,6 +380,11 @@ A rescan will be automatically started now.
>>>               }
>>>       }
>>>
>>> +     if {$author_name ne ""} {
>>> +             set env(GIT_AUTHOR_NAME) $author_name
>>> +             set env(GIT_AUTHOR_EMAIL) $author_email
>>> +             set env(GIT_AUTHOR_DATE) $author_date
>>> +     }
>>>       # -- Create the commit.
>>>       #
>>>       set cmd [list commit-tree $tree_id]
Orgad Shaneh· Sep 26, 2016, 20:06 UTC · re: Orgad Shaneh · lore

Re: [PATCH] git-gui: Do not reset author details on amend

4.5 months and counting... :(
- Orgad
On Sun, Jul 10, 2016 at 7:36 AM, Orgad Shaneh <orgads@gmail.com> wrote:
Show 99 quoted lines
> It's been over 2 months. Can anyone please review and merge it?
>
> Thanks.
> - Orgad
>
> On Wed, May 18, 2016 at 9:12 AM, Orgad Shaneh <orgads@gmail.com> wrote:
>> ping?
>>
>> On Thu, May 5, 2016 at 8:22 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Pat, we haven't heard from you for a long time.  Are you still
>>> around and interested in helping us by maintaining git-gui?
>>>
>>> Otherwise we may have to start recruiting a volunteer or two to take
>>> this over.
>>>
>>> Thanks.
>>>
>>> Orgad Shaneh <orgads@gmail.com> writes:
>>>
>>>> git commit --amend preserves the author details unless --reset-author is
>>>> given.
>>>>
>>>> git-gui discards the author details on amend.
>>>>
>>>> Fix by reading the author details along with the commit message, and
>>>> setting the appropriate environment variables required for preserving
>>>> them.
>>>>
>>>> Reported long ago in the mailing list[1].
>>>>
>>>> [1] http://article.gmane.org/gmane.comp.version-control.git/243921
>>>>
>>>> Signed-off-by: Orgad Shaneh <orgads@gmail.com>
>>>> ---
>>>>  git-gui/lib/commit.tcl | 19 +++++++++++++++++++
>>>>  1 file changed, 19 insertions(+)
>>>>
>>>> diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl
>>>> index 864b687..60edf99 100644
>>>> --- a/git-gui/lib/commit.tcl
>>>> +++ b/git-gui/lib/commit.tcl
>>>> @@ -1,8 +1,13 @@
>>>>  # git-gui misc. commit reading/writing support
>>>>  # Copyright (C) 2006, 2007 Shawn Pearce
>>>>
>>>> +set author_name ""
>>>> +set author_email ""
>>>> +set author_date ""
>>>> +
>>>>  proc load_last_commit {} {
>>>>       global HEAD PARENT MERGE_HEAD commit_type ui_comm
>>>> +     global author_name author_email author_date
>>>>       global repo_config
>>>>
>>>>       if {[llength $PARENT] == 0} {
>>>> @@ -34,6 +39,10 @@ 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 author_name $name
>>>> +                                     set author_email $email
>>>> +                                     set author_date $time
>>>>                               }
>>>>                       }
>>>>                       set msg [read $fd]
>>>> @@ -107,8 +116,12 @@ proc do_signoff {} {
>>>>
>>>>  proc create_new_commit {} {
>>>>       global commit_type ui_comm
>>>> +     global author_name author_email author_date
>>>>
>>>>       set commit_type normal
>>>> +     set author_name ""
>>>> +     set author_email ""
>>>> +     set author_date ""
>>>>       $ui_comm delete 0.0 end
>>>>       $ui_comm edit reset
>>>>       $ui_comm edit modified false
>>>> @@ -327,6 +340,7 @@ proc commit_committree {fd_wt curHEAD msg_p} {
>>>>       global ui_comm selected_commit_type
>>>>       global file_states selected_paths rescan_active
>>>>       global repo_config
>>>> +     global env author_name author_email author_date
>>>>
>>>>       gets $fd_wt tree_id
>>>>       if {[catch {close $fd_wt} err]} {
>>>> @@ -366,6 +380,11 @@ A rescan will be automatically started now.
>>>>               }
>>>>       }
>>>>
>>>> +     if {$author_name ne ""} {
>>>> +             set env(GIT_AUTHOR_NAME) $author_name
>>>> +             set env(GIT_AUTHOR_EMAIL) $author_email
>>>> +             set env(GIT_AUTHOR_DATE) $author_date
>>>> +     }
>>>>       # -- Create the commit.
>>>>       #
>>>>       set cmd [list commit-tree $tree_id]
Junio C Hamano· Sep 26, 2016, 21:34 UTC · re: Orgad Shaneh · lore

Re: [PATCH] git-gui: Do not reset author details on amend

Orgad Shaneh <orgads@gmail.com> writes:
Show 15 quoted lines
> On Sun, Jul 10, 2016 at 7:36 AM, Orgad Shaneh <orgads@gmail.com> wrote:
>
>> On Wed, May 18, 2016 at 9:12 AM, Orgad Shaneh <orgads@gmail.com> wrote:
>>> ping?
>>>
>> It's been over 2 months. Can anyone please review and merge it?
>>
> 4.5 months and counting... :(
>>
>>> On Thu, May 5, 2016 at 8:22 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>>> Pat, we haven't heard from you for a long time.  Are you still
>>>> around and interested in helping us by maintaining git-gui?
>>>>
>>>> Otherwise we may have to start recruiting a volunteer or two to take
>>>> this over.

Sorry about that. No volunteers materialized yet X-<, and I really really do not want to apply anything other than trivial patches to it myself, as I am not a git-gui user.

Orgad Shaneh· Sep 27, 2016, 07:22 UTC · re: Junio C Hamano · lore

Re: [PATCH] git-gui: Do not reset author details on amend

On Tue, Sep 27, 2016 at 12:34 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 22 quoted lines
> Orgad Shaneh <orgads@gmail.com> writes:
>
>> On Sun, Jul 10, 2016 at 7:36 AM, Orgad Shaneh <orgads@gmail.com> wrote:
>>
>>> On Wed, May 18, 2016 at 9:12 AM, Orgad Shaneh <orgads@gmail.com> wrote:
>>>> ping?
>>>>
>>> It's been over 2 months. Can anyone please review and merge it?
>>>
>> 4.5 months and counting... :(
>>>
>>>> On Thu, May 5, 2016 at 8:22 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>>>> Pat, we haven't heard from you for a long time.  Are you still
>>>>> around and interested in helping us by maintaining git-gui?
>>>>>
>>>>> Otherwise we may have to start recruiting a volunteer or two to take
>>>>> this over.
>
> Sorry about that.  No volunteers materialized yet X-<, and I really
> really do not want to apply anything other than trivial patches to
> it myself, as I am not a git-gui user.
>
This patch has been in use in Git for Windows for a decent period of time.

I actually see that there is a problem with it: https://github.com/git-for-windows/git/issues/761

I'll try to revise it and resubmit.
- Orgad
Junio C Hamano· Sep 27, 2016, 16:31 UTC · re: Orgad Shaneh · lore

Re: [PATCH] git-gui: Do not reset author details on amend

Orgad Shaneh <orgads@gmail.com> writes:
Show 7 quoted lines
> On Tue, Sep 27, 2016 at 12:34 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Orgad Shaneh <orgads@gmail.com> writes:
>>
> I actually see that there is a problem with it:
> https://github.com/git-for-windows/git/issues/761
>
> I'll try to revise it and resubmit.
Are you by chance volunteering to be git-gui maintainer?
Orgad Shaneh· Sep 27, 2016, 17:23 UTC · re: Junio C Hamano · lore

Re: [PATCH] git-gui: Do not reset author details on amend

On Tue, Sep 27, 2016 at 7:31 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> Orgad Shaneh <orgads@gmail.com> writes:
>
>> On Tue, Sep 27, 2016 at 12:34 AM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Orgad Shaneh <orgads@gmail.com> writes:
>>>
>> I actually see that there is a problem with it:
>> https://github.com/git-for-windows/git/issues/761
>>
>> I'll try to revise it and resubmit.
>
> Are you by chance volunteering to be git-gui maintainer?
No way, sorry. I don't speak TCL at all. Every change is a true pain... ;)
- Orgad
Stefan Beller· Sep 27, 2016, 17:45 UTC · re: Orgad Shaneh · lore

Re: [PATCH] git-gui: Do not reset author details on amend

On Tue, Sep 27, 2016 at 10:23 AM, Orgad Shaneh <orgads@gmail.com> wrote:
Show 14 quoted lines
> On Tue, Sep 27, 2016 at 7:31 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Orgad Shaneh <orgads@gmail.com> writes:
>>
>>> On Tue, Sep 27, 2016 at 12:34 AM, Junio C Hamano <gitster@pobox.com> wrote:
>>>> Orgad Shaneh <orgads@gmail.com> writes:
>>>>
>>> I actually see that there is a problem with it:
>>> https://github.com/git-for-windows/git/issues/761
>>>
>>> I'll try to revise it and resubmit.
>>
>> Are you by chance volunteering to be git-gui maintainer?
>
> No way, sorry. I don't speak TCL at all. Every change is a true pain... ;)

I considered stepping up as an interim maintainer briefly, but this is the exact reason on why I punted.

Looking at e.g. `git diff --stat gitgui-0.19.0..gitgui-0.20.0` (which is 16 month apart), the workload seems to be very light, so I would not have concerns w.r.t. time spent.

Stepping back a bit and asking "What does a maintainer do?" I think knowing the language very well is not the top point, but rather looking at the design, maintainability of proposed solutions as well as long term well being of the project is what makes a good maintainer.

That said I could step up as a maintainer, but for each patch I"d ask the contributor to find a reviewer who knows tcl well, as that is a part that I cannot cover. And from a contributors perspective this seems to be discouraging.

Stefan
>
> - Orgad

← back to recent threads