]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Meta/KO: allow checking against mirror sites other than k.org
authorJunio C Hamano <gitster@pobox.com>
Thu, 29 Sep 2011 01:14:23 +0000 (18:14 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 29 Sep 2011 01:14:23 +0000 (18:14 -0700)
KO

diff --git a/KO b/KO
index 2d7346ff7bb7392dec4fe0007a234d64ea48f5a1..72a10c88c99b3489af03c0892078f1d1c912ade1 100755 (executable)
--- a/KO
+++ b/KO
@@ -3,16 +3,30 @@
 # Not for general consumption; a script I used to make sure
 # I do not accidentally push a rewound master to public.
 
-case "$1" in --no-fetch) shift ;; *) git fetch ko ;; esac
+no_fetch= ko=ko
+while :
+do
+       case "$#,$1" in
+       0,*) break ;;
+       *,--no-fetch) no_fetch=t; shift ;;
+       *,--*) echo >&2 "unknown option $1"; exit 1 ;;
+       *) ko=$1; shift ;;
+       esac
+done
 
-mb=$(git merge-base ko/master master)
-h=$(git rev-parse $mb ko/master | sort -u | wc -l)
+if test -z "$no_fetch"
+then
+       git fetch "$ko"
+fi
+
+mb=$(git merge-base $ko/master master)
+h=$(git rev-parse $mb $ko/master | sort -u | wc -l)
 if test "$h" != 1
 then
-       echo "OOOOOPPPPPPPPPPPPPPSSS! master is not ko/master fast forward."
+       echo "OOOOOPPPPPPPPPPPPPPSSS! master is not $ko/master fast forward."
        exit 1
 fi
-git show-branch --topo-order ko/master master
-git show-branch --topo-order ko/maint maint
-git show-branch --topo-order ko/next next
-git show-branch --topo-order ko/pu pu
+git show-branch --topo-order $ko/master master
+git show-branch --topo-order $ko/maint maint
+git show-branch --topo-order $ko/next next
+git show-branch --topo-order $ko/pu pu