X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=hooks%2Fpre-commit.sh;fp=hooks%2Fpre-commit.sh;h=9d677e91279a4275e284fd94077e5a4a90a366d1;hb=ea8ed4c34d3d46584bd62b30a30ad5226bba41ad;hp=da631856909dba5a7420ee402e583fbde892f68a;hpb=b7672a78740c5477351e216393f662712743dff2;p=topgit.git diff --git a/hooks/pre-commit.sh b/hooks/pre-commit.sh index da63185..9d677e9 100644 --- a/hooks/pre-commit.sh +++ b/hooks/pre-commit.sh @@ -17,9 +17,19 @@ tg_util ## Generally have fun # Don't do anything on non-topgit branch -git rev-parse --verify "$(git symbolic-ref HEAD | sed 's/heads/top-bases/')" >/dev/null 2>&1 || - exit 0 - +if head_=$(git symbolic-ref -q HEAD); then + case "$head_" in + refs/heads/*) + git rev-parse -q --verify "refs/top-bases${head_#refs/heads}" >/dev/null || exit 0;; + *) + exit 0;; + esac + +else + exit 0; +fi + +# TODO: check the index, not the working copy [ -s "$root_dir/.topdeps" ] || die ".topdeps is missing" [ -s "$root_dir/.topmsg" ] ||