summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-05-29 16:32:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-30 04:32:16 (GMT)
commit5971b0836eece0ffcafe15fd5d67934787ea1777 (patch)
treedcd12e4f818cc88061eef668cb7ce77665102785 /t
parent35d515b53f594e9b281f15943ba1b66a2305857a (diff)
downloadgit-5971b0836eece0ffcafe15fd5d67934787ea1777.zip
git-5971b0836eece0ffcafe15fd5d67934787ea1777.tar.gz
git-5971b0836eece0ffcafe15fd5d67934787ea1777.tar.bz2
sequencer: ensure labels that are object IDs are rewritten
When writing the todo script for --rebase-merges, we try to find a label for certain commits. If the label ends up being a valid object ID, such as when we merge a detached commit, we want to rewrite it so it is no longer a valid object ID. However, the code path that does this checks for its length to be equivalent to GIT_SHA1_RAWSZ, which isn't correct, since what we are reading is a hex object ID. Instead, check for the length being equivalent to that of a hex object ID. Use the_hash_algo so this code works regardless of the hash size. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t3430-rebase-merges.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh
index 3d4dfdf..472ad94 100755
--- a/t/t3430-rebase-merges.sh
+++ b/t/t3430-rebase-merges.sh
@@ -70,6 +70,7 @@ test_expect_success 'create completely different structure' '
merge -C H second
merge onebranch # Merge the topic branch '\''onebranch'\''
EOF
+ cp script-from-scratch script-from-scratch-orig &&
test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
test_tick &&
git rebase -i -r A &&
@@ -241,4 +242,20 @@ test_expect_success 'refuse to merge ancestors of HEAD' '
test_cmp_rev HEAD $before
'
+test_expect_success 'labels that are object IDs are rewritten' '
+ git checkout -b third B &&
+ test_tick &&
+ test_commit I &&
+ third=$(git rev-parse HEAD) &&
+ git checkout -b labels master &&
+ git merge --no-commit third &&
+ test_tick &&
+ git commit -m "Merge commit '\''$third'\'' into labels" &&
+ cp script-from-scratch-orig script-from-scratch &&
+ test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
+ test_tick &&
+ git rebase -i -r A &&
+ ! grep "^label $third$" .git/ORIGINAL-TODO
+'
+
test_done