From 3d0c424ca06fc122c4191a31999130810ec64deb Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Fri, 3 Oct 2008 01:29:42 -0500 Subject: [PATCH] Store the branch name for the lulz. --- server/post-receive-assign-commit-numbers | 2 +- tests/t3200-server-post-receive-assign-commit-numbers.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/server/post-receive-assign-commit-numbers b/server/post-receive-assign-commit-numbers index 39c3f48..364618b 100644 --- a/server/post-receive-assign-commit-numbers +++ b/server/post-receive-assign-commit-numbers @@ -6,7 +6,7 @@ while read oldrev newrev refname ; do set_new_commits echo "$new_commits" | git rev-list --reverse --stdin | while read commit ; do if [[ $(grep "$commit" "$GIT_DIR/commitnumbers" 2>/dev/null) == "" ]] ; then - with_lock "$GIT_DIR/commitnumbers.lock" 'echo "$commit" >> "$GIT_DIR/commitnumbers"' + with_lock "$GIT_DIR/commitnumbers.lock" 'echo "$commit $refname" >> "$GIT_DIR/commitnumbers"' number=$(grep --max-count=1 --line-number "$commit" "$GIT_DIR/commitnumbers" | grep -oP "^\d+(?=:)") git tag "r/$number" "$commit" fi diff --git a/tests/t3200-server-post-receive-assign-commit-numbers.sh b/tests/t3200-server-post-receive-assign-commit-numbers.sh index 4f8f924..b4cdac3 100644 --- a/tests/t3200-server-post-receive-assign-commit-numbers.sh +++ b/tests/t3200-server-post-receive-assign-commit-numbers.sh @@ -27,6 +27,7 @@ test_expect_success 'assign one new commit' ' test "$(git rev-parse HEAD)" = "$(git rev-parse r/1)" test "$(git describe --tags)" = "r/1" + test "$(git rev-parse HEAD) refs/heads/master" = "$(cat server/.git/commitnumbers)" ' test_expect_success 'assign two new commits' ' -- 2.39.5