Merge branch 'en/object-name-with-funny-refname-fix'
Extended SHA-1 expression parser did not work well when a branch
with an unusual name (e.g. "foo{bar") is involved.
* en/object-name-with-funny-refname-fix:
object-name: be more strict in parsing describe-like output
object-name: fix resolution of object names containing curly braces
This commit is contained in:
@@ -240,7 +240,8 @@ test_expect_success "setup" '
|
||||
git config extensions.objectformat $test_hash_algo &&
|
||||
git config extensions.compatobjectformat $test_compat_hash_algo &&
|
||||
echo_without_newline "$hello_content" > hello &&
|
||||
git update-index --add hello
|
||||
git update-index --add hello &&
|
||||
git commit -m "add hello file"
|
||||
'
|
||||
|
||||
run_blob_tests () {
|
||||
@@ -602,6 +603,34 @@ test_expect_success FUNNYNAMES '--batch-check, -Z with newline in input' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'setup with curly braches in input' '
|
||||
git branch "foo{bar" HEAD &&
|
||||
git branch "foo@" HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'object reference with curly brace' '
|
||||
git cat-file -p "foo{bar:hello" >actual &&
|
||||
git cat-file -p HEAD:hello >expect &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'object reference with at-sign' '
|
||||
git cat-file -p "foo@@{0}:hello" >actual &&
|
||||
git cat-file -p HEAD:hello >expect &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'setup with commit with colon' '
|
||||
git commit-tree -m "testing: just a bunch of junk" HEAD^{tree} >out &&
|
||||
git branch other $(cat out)
|
||||
'
|
||||
|
||||
test_expect_success 'object reference via commit text search' '
|
||||
git cat-file -p "other^{/testing:}:hello" >actual &&
|
||||
git cat-file -p HEAD:hello >expect &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'setup blobs which are likely to delta' '
|
||||
test-tool genrandom foo 10240 >foo &&
|
||||
{ cat foo && echo plus; } >foo-plus &&
|
||||
|
||||
@@ -82,11 +82,13 @@ check_describe R-2-gHASH HEAD^^
|
||||
check_describe A-3-gHASH HEAD^^2
|
||||
check_describe B HEAD^^2^
|
||||
check_describe R-1-gHASH HEAD^^^
|
||||
check_describe R-1-gHASH R-1-g$(git rev-parse --short HEAD^^)~1
|
||||
|
||||
check_describe c-7-gHASH --tags HEAD
|
||||
check_describe c-6-gHASH --tags HEAD^
|
||||
check_describe e-1-gHASH --tags HEAD^^
|
||||
check_describe c-2-gHASH --tags HEAD^^2
|
||||
check_describe c-2-gHASH --tags c-2-g$(git rev-parse --short HEAD^^2)^0
|
||||
check_describe B --tags HEAD^^2^
|
||||
check_describe e --tags HEAD^^^
|
||||
check_describe e --tags --exact-match HEAD^^^
|
||||
@@ -725,4 +727,26 @@ test_expect_success '--exact-match does not show --always fallback' '
|
||||
test_must_fail git describe --exact-match --always
|
||||
'
|
||||
|
||||
test_expect_success 'avoid being fooled by describe-like filename' '
|
||||
test_when_finished rm out &&
|
||||
|
||||
git rev-parse --short HEAD >out &&
|
||||
FILENAME=filename-g$(cat out) &&
|
||||
touch $FILENAME &&
|
||||
git add $FILENAME &&
|
||||
git commit -m "Add $FILENAME" &&
|
||||
|
||||
git cat-file -t HEAD:$FILENAME >actual &&
|
||||
|
||||
echo blob >expect &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'do not be fooled by invalid describe format ' '
|
||||
test_when_finished rm out &&
|
||||
|
||||
git rev-parse --short HEAD >out &&
|
||||
test_must_fail git cat-file -t "refs/tags/super-invalid/./../...../ ~^:/?*[////\\\\\\&}/busted.lock-42-g"$(cat out)
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
Reference in New Issue
Block a user