Merge branch 'fc/transport-helper-error-reporting'
[gitweb.git] / git-remote-testgit
index e7ed3a33e6d7180e65f06a882342fa2d7efb4d03..2b865deeb161db0a88814afcd03a61aca88d8c89 100755 (executable)
@@ -62,12 +62,31 @@ do
                        echo "feature import-marks=$gitmarks"
                        echo "feature export-marks=$gitmarks"
                fi
+
+               if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
+               then
+                       echo "feature done"
+                       exit 1
+               fi
+
                echo "feature done"
                git fast-export "${testgitmarks_args[@]}" $refs |
                sed -e "s#refs/heads/#${prefix}/heads/#g"
                echo "done"
                ;;
        export)
+               if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
+               then
+                       # consume input so fast-export doesn't get SIGPIPE;
+                       # git would also notice that case, but we want
+                       # to make sure we are exercising the later
+                       # error checks
+                       while read line; do
+                               test "done" = "$line" && break
+                       done
+                       exit 1
+               fi
+
                before=$(git for-each-ref --format='%(refname) %(objectname)')
 
                git fast-import "${testgitmarks_args[@]}" --quiet
@@ -79,7 +98,12 @@ do
                while read ref a b
                do
                        test $a == $b && continue
-                       echo "ok $ref"
+                       if test -z "$GIT_REMOTE_TESTGIT_PUSH_ERROR"
+                       then
+                               echo "ok $ref"
+                       else
+                               echo "error $ref $GIT_REMOTE_TESTGIT_PUSH_ERROR"
+                       fi
                done
 
                echo