summaryrefslogtreecommitdiff
path: root/git-gui
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2006-11-08 23:05:46 -0500
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2006-11-08 23:05:46 -0500
commit97bf01c46526a680fb04ac88cb0ecaefbd3b4d7f (patch)
tree3837fb087e9520b4e5f9556e977e92b430dba1d9 /git-gui
parentgit-gui: Show only the abbreviated SHA1 after committing. (diff)
downloadtgif-97bf01c46526a680fb04ac88cb0ecaefbd3b4d7f.tar.xz
git-gui: Cache the GIT_COMMITTER_IDENT value on first sign-off.
Caching the Signed-Off-By line isn't very important (as its not performance critical). The major improvement here is that we now report an error to the user if we can't obtain their name from git-var. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui')
-rwxr-xr-xgit-gui29
1 files changed, 19 insertions, 10 deletions
diff --git a/git-gui b/git-gui
index 1b1ffee5ea..ad3aa0727c 100755
--- a/git-gui
+++ b/git-gui
@@ -1398,19 +1398,28 @@ proc do_include_all {} {
}
}
+set GIT_COMMITTER_IDENT {}
+
proc do_signoff {} {
- global ui_comm
+ global ui_comm GIT_COMMITTER_IDENT
- catch {
- set me [exec git var GIT_COMMITTER_IDENT]
- if {[regexp {(.*) [0-9]+ [-+0-9]+$} $me me name]} {
- set str "Signed-off-by: $name"
- if {[$ui_comm get {end -1c linestart} {end -1c}] != $str} {
- $ui_comm insert end "\n"
- $ui_comm insert end $str
- $ui_comm see end
- }
+ if {$GIT_COMMITTER_IDENT == {}} {
+ if {[catch {set me [exec git var GIT_COMMITTER_IDENT]} err]} {
+ error_popup "Unable to obtain your identity:\n$err"
+ return
}
+ if {![regexp {^(.*) [0-9]+ [-+0-9]+$} \
+ $me me GIT_COMMITTER_IDENT]} {
+ error_popup "Invalid GIT_COMMITTER_IDENT:\n$me"
+ return
+ }
+ }
+
+ set str "Signed-off-by: $GIT_COMMITTER_IDENT"
+ if {[$ui_comm get {end -1c linestart} {end -1c}] != $str} {
+ $ui_comm insert end "\n"
+ $ui_comm insert end $str
+ $ui_comm see end
}
}