chiark / gitweb /
tg-push: Filter out plain SHA1s from being pushed.
authorThomas Schwinge <thomas@schwinge.name>
Sun, 28 Feb 2010 13:57:41 +0000 (14:57 +0100)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 4 Mar 2010 09:38:25 +0000 (10:38 +0100)
Otherwise, problems arise when branches depend (via .topdeps) on SHA1s:

    $ tg push -r tmp t/____longjmp_chk_cleanup_linux_x86_64
    fatal: 77c84aeb81808c3109665949448dba59965c391e cannot be resolved to branch.
    fatal: The remote end hung up unexpectedly

Signed-off-by: Thomas Schwinge <thomas@schwinge.name>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
tg-push.sh
tg.sh

index cd208a06413878de19fde4eb166717158a44c4e6..199d7389b48ea4563ac2217022f410b2aebf4d4b 100644 (file)
@@ -53,6 +53,10 @@ push_branch()
        # if so desired omit non tgish deps
        $tgish_deps_only && [ -z "$_dep_is_tgish" ] && return 0
 
+       # filter out plain SHA1s.  These don't need to be pushed explicitly as
+       # the patches that depend on the sha1 have it already in their ancestry.
+       is_sha1 "$_dep" && return 0
+
        echo "$_dep" >> "$_listfile"
        [ -z "$_dep_is_tgish" ] ||
                echo "top-bases/$_dep" >> "$_listfile"
diff --git a/tg.sh b/tg.sh
index 1f6d3da6aab7949716a71efc8201fa6b62331eed..91c374a0978a8a7bcb447130a032f264b14d5c91 100644 (file)
--- a/tg.sh
+++ b/tg.sh
@@ -126,6 +126,13 @@ branch_annihilated()
        test "$(git rev-parse "$mb^{tree}")" = "$(git rev-parse "$_name^{tree}")";
 }
 
+# is_sha1 REF
+# Whether REF is a SHA1 (compared to a symbolic name).
+is_sha1()
+{
+       [ "$(git rev-parse "$1")" = "$1" ]
+}
+
 # recurse_deps CMD NAME [BRANCHPATH...]
 # Recursively eval CMD on all dependencies of NAME.
 # CMD can refer to $_name for queried branch name,