Discard stderr when using rev ranges
authorSimon Schubert <corecode@dragonflybsd.org>
Wed, 4 Feb 2009 09:43:29 +0000 (10:43 +0100)
committerSimon Schubert <corecode@dragonflybsd.org>
Wed, 4 Feb 2009 09:43:29 +0000 (10:43 +0100)
If a branch is created or deleted, we have an invalid revision range.
Discard stderr so that committers don't get confused.

post-receive-email
update

index d72a50d..285f59e 100755 (executable)
@@ -330,7 +330,7 @@ set_update_branch_subject()
 {
        set_describe $newrev
 
-       detail=$(git diff-tree -r -c --name-only $oldrev${oldrev:+..}$newrev |
+       detail=$(git diff-tree -r -c --name-only $oldrev${oldrev:+..}$newrev 2>/dev/null |
                        skip_diff_tree_parent |
                        sed -E -e 's#/([^/]*)$# \1#' |
                        awk 'pos > 74 {
@@ -346,7 +346,7 @@ set_update_branch_subject()
                                printf " %s", $2;
                                pos += length($2) + 1;
                        }')
-       [ -n "$(git diff-tree -r --name-only --cc $oldrev${oldrev:+..}$newrev |
+       [ -n "$(git diff-tree -r --name-only --cc $oldrev${oldrev:+..}$newrev 2>/dev/null |
                skip_diff_tree_parent)" ]
 }
 
diff --git a/update b/update
index 4c734a1..b84f471 100755 (executable)
--- a/update
+++ b/update
@@ -79,7 +79,7 @@ case "$refname","$newrev_type" in
                ;;
        refs/heads/*,commit)
                # branch
-               if [ -n "$(git rev-list $newrev..$oldrev)" -a "$allownonfastfwd" != "true" ]; then
+               if [ -n "$(git rev-list $newrev..$oldrev 2>/dev/null)" -a "$allownonfastfwd" != "true" ]; then
                        echo "*** Non fast forward pushes are not allowed in this repository" >&2
                        exit 1
                fi