Skip to contentSkip to conversation

git-gui: Do not reset author details on amend

PATCH In review Orgad Shaneh 3 participants 10 messages Jun 16, 2016 – Sep 27, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-gui: Do not reset author details on amend

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

---
 git-gui/lib/commit.tcl | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
git-gui/lib/commit.tcl +19 -0
index 864b687..60edf99 100644
@@ -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]
Signature · 1 line
2.8.1
#1 lore raw

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.

Quoted 80 lines · Orgad Shaneh

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

---
 git-gui/lib/commit.tcl | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
git-gui/lib/commit.tcl +19 -0
index 864b687..60edf99 100644
@@ -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 lore raw

ping?

Quoted 90 lines · Junio C Hamano

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.

Quoted 80 lines · Orgad Shaneh

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

---
 git-gui/lib/commit.tcl | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
git-gui/lib/commit.tcl +19 -0
index 864b687..60edf99 100644
@@ -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]
#3 lore raw

It's been over 2 months. Can anyone please review and merge it?

Thanks.
- Orgad

Quoted 93 lines · Orgad Shaneh

ping?

Quoted 90 lines · Junio C Hamano

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.

Quoted 80 lines · Orgad Shaneh

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

---
 git-gui/lib/commit.tcl | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
git-gui/lib/commit.tcl +19 -0
index 864b687..60edf99 100644
@@ -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]
#4 lore raw

4.5 months and counting... :(

- Orgad

Quoted 99 lines · Orgad Shaneh

It's been over 2 months. Can anyone please review and merge it?

Thanks.
- Orgad

Quoted 93 lines · Orgad Shaneh

ping?

Quoted 90 lines · Junio C Hamano

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.

Quoted 80 lines · Orgad Shaneh

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

---
 git-gui/lib/commit.tcl | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
git-gui/lib/commit.tcl +19 -0
index 864b687..60edf99 100644
@@ -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]
#5 lore raw
Quoted 15 lines · Orgad Shaneh
Quoted 5 lines · Orgad Shaneh
Quoted 2 lines · Orgad Shaneh

ping?

It's been over 2 months. Can anyone please review and merge it?

4.5 months and counting... :(

Quoted 7 lines
Quoted 7 lines · Junio C Hamano
Quoted 5 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.

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.

#6 lore raw
Quoted 15 lines · Junio C Hamano
Quoted 13 lines · Orgad Shaneh
Quoted 5 lines · Orgad Shaneh
Quoted 2 lines · Orgad Shaneh

ping?

It's been over 2 months. Can anyone please review and merge it?

4.5 months and counting... :(

Quoted 5 lines
Quoted 5 lines · Junio C Hamano
Quoted 3 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?

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

#8 lore raw
Quoted 11 lines · Junio C Hamano
Quoted 7 lines · Orgad Shaneh
Quoted 2 lines · Junio C Hamano

Orgad Shaneh <[email protected]> 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

#9 lore raw
Quoted 6 lines · Orgad Shaneh
Quoted 5 lines · Junio C Hamano
Quoted 3 lines · Orgad Shaneh
Quoted 2 lines · Junio C Hamano

Orgad Shaneh <[email protected]> writes:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

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

Quoted 2 lines

- Orgad