@matheusbsbs / matheus-bagliano / commits / 1daf1d0c81
Fork 0

git-gui: Teach sign off to be more intelligent.

When we sign off on a commit we want to add a blank line between whatever is in the commit buffer and the new Signed-off-by line, unless there already is a Signed-off-by (or Acked-by) tag at the end of the buffer already. This change makes us do the right thing more often. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Nov 11, 2006 at 20:44 UTC 1daf1d0c81c7c2623867f7884c8cbc5ff0a10d30
1 file changed +8 -3
git-gui
+8 -3
@@ -1510,10 +1510,15 @@ proc do_signoff {} {
1510 }
1511 }
1512
1513 - set str "Signed-off-by: $GIT_COMMITTER_IDENT"
1514 - if {[$ui_comm get {end -1c linestart} {end -1c}] != $str} {
1513 + set sob "Signed-off-by: $GIT_COMMITTER_IDENT"
1514 + set last [$ui_comm get {end -1c linestart} {end -1c}]
1515 + if {$last != $sob} {
1516 $ui_comm edit separator
1516 - $ui_comm insert end "\n$str"
1517 + if {$last != {}
1518 + && ![regexp {^[A-Z][A-Za-z]*-[A-Za-z-]+: *} $last]} {
1519 + $ui_comm insert end "\n"
1520 + }
1521 + $ui_comm insert end "\n$sob"
1522 $ui_comm edit separator
1523 $ui_comm see end
1524 }