chiark / gitweb /
Fix merge failure handling in tg export
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 8 Mar 2009 20:52:14 +0000 (21:52 +0100)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 8 Mar 2009 20:52:14 +0000 (21:52 +0100)
There exist two problems that show that up to now the error handling was
completely untested:

  - tg.sh uses `set -e`, so `git merge $branch; retmerge=$?` obviously
    doesn't do the right thing.
  - in recurse_deps stdin is redirected from $_depsfile.  Starting a
    shell with that doesn't give the user any chance to do something.

Reported-by: "Bernhard R. Link" <brlink@debian.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
tg-export.sh

index 748ca54..37cd9cd 100644 (file)
@@ -216,22 +216,24 @@ linearize()
                        # already included, just skip
                        :;
                else
-                       git merge -s recursive "$_dep";
-                       retmerge="$?";
+                       retmerge=0;
+
+                       git merge -s recursive "$_dep" || retmerge="$?";
                        if test "x$retmerge" != "x0"; then
                                echo fix up the merge, commit and then exit;
                                #todo error handling
-                               sh -i
+                               sh -i </dev/tty;
                        fi;
                fi;
        else
-               git merge-recursive "$(pretty_tree "refs/top-bases/$_dep")" -- HEAD "$(pretty_tree "refs/heads/$_dep")";
-               retmerge="$?";
+               retmerge=0;
+
+               git merge-recursive "$(pretty_tree "refs/top-bases/$_dep")" -- HEAD "$(pretty_tree "refs/heads/$_dep")" || retmerge="$?";
 
                if test "x$retmerge" != "x0"; then
                        echo "fix up the merge and update the index.  Don't commit!"
                        #todo error handling
-                       sh -i
+                       sh -i </dev/tty;
                fi
 
                result_tree=$(git write-tree)