]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Add untested git push conflict testing to commit script.
authorGary V. Vaughan <gary@gnu.org>
Sun, 7 Sep 2008 11:53:16 +0000 (19:53 +0800)
committerGary V. Vaughan <gary@gnu.org>
Sun, 7 Sep 2008 11:53:16 +0000 (19:53 +0800)
* clcommit.m4sh (func_check_conflicts): Test return status
of 'git push --dry-run', and display an error on non-zero.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
ChangeLog
clcommit.m4sh

index 07b50743f914f5028fa6c98cf3abcf42a894b2b8..7ac504cfab6d7c7bbc3cd20a59b2a08b0c0384c3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2008-09-07  Gary V. Vaughan  <gary@gnu.org>
 
+       Add untested git push conflict testing to commit script.
+       * clcommit.m4sh (func_check_conflicts): Test return status
+       of 'git push --dry-run', and display an error on non-zero.
+
        Enable release procedure to work with lzma OLDRELEASE file.
        * Makefile.maint (diffs, prev-tarball, new-tarball): If lzma
        tarballs are present use them to generate the diffs, otherwise
index 4eefd071421349435e915eb0ee0c54da7540811c..3394311a9528cc6fe06f2659b92b1bd0c9074bcb 100644 (file)
@@ -110,6 +110,7 @@ fi
 signature_file=
 log_dir="`func_mktempdir`"
 log_file="$log_dir/log"
+push_conflicts="$log_dir/git_push.log"
 
 trap '$RM -r "$log_dir"; exit $EXIT_FAILURE' 1 2 15
 
@@ -289,9 +290,9 @@ set -e
 # func_check_conflicts
 func_check_conflicts ()
 {
-    # HELP?!?  How to check for git push conflicts?
-    if false; then
-      func_fatal_error "some conflicts were found with CVS repository, aborting..."
+    if $GIT push --dry-run > "$push_conflicts" 2>&1; then :; else
+      cat "$push_conflicts" >&2
+      func_fatal_error "some conflicts were found with upstream repository, aborting..."
     fi
 }
 
@@ -420,8 +421,6 @@ func_mailnotify ()
 ## ----- ##
 
 {
-  $opt_update && func_check_conflicts
-
   test -f "$log_file" || func_check_commit_msg
 
   grep '[^     ]' < "$log_file" > /dev/null ||
@@ -432,15 +431,16 @@ func_mailnotify ()
     func_error "*** They should be used to separate distinct commits."
   fi
 
+  $opt_update && $opt_push && func_check_conflicts
+
   # Do not check for empty $log_file again, even though the user might have
   # zeroed it out.  If s/he did, it was probably intentional.
   if $opt_commit; then
     func_commit ${1+"$@"}
   fi
 
-  subject=`sed -n '1p' "$log_file"`
-
   # Send a copy of the log_file if sendmail_to was set:
+  subject=`sed -n '1p' "$log_file"`
   if test -n "$sendmail_to"; then
     if ! $opt_push; then
       func_warning "Mail notification NOT sent for commit to local repository."