diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-11-06 14:24:28 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-06 14:24:28 +0900 |
commit | 5a74ce22e61ce0c8d7325b891ef1a926cf4f6154 (patch) | |
tree | 7c4c6d967be2268e7163e861f44c493642af42a8 /t | |
parent | f113d4bc799d4d0b751761db7d3760fcb9ba2c1a (diff) | |
parent | 89dd32aedcb52a77240f3923a687edc8a61662e7 (diff) | |
download | git-5a74ce22e61ce0c8d7325b891ef1a926cf4f6154.tar.gz git-5a74ce22e61ce0c8d7325b891ef1a926cf4f6154.tar.xz |
Merge branch 'jc/check-ref-format-oor'
"git check-ref-format --branch @{-1}" bit a "BUG()" when run
outside a repository for obvious reasons; clarify the documentation
and make sure we do not even try to expand the at-mark magic in
such a case, but still call the validation logic for branch names.
* jc/check-ref-format-oor:
check-ref-format doc: --branch validates and expands <branch>
check-ref-format --branch: strip refs/heads/ using skip_prefix
check-ref-format --branch: do not expand @{...} outside repository
Diffstat (limited to 't')
-rwxr-xr-x | t/t1402-check-ref-format.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh index 0790edf60..98e4a8613 100755 --- a/t/t1402-check-ref-format.sh +++ b/t/t1402-check-ref-format.sh @@ -144,6 +144,11 @@ test_expect_success "check-ref-format --branch @{-1}" ' refname2=$(git check-ref-format --branch @{-2}) && test "$refname2" = master' +test_expect_success 'check-ref-format --branch -naster' ' + test_must_fail git check-ref-format --branch -naster >actual && + test_must_be_empty actual +' + test_expect_success 'check-ref-format --branch from subdir' ' mkdir subdir && @@ -161,6 +166,17 @@ test_expect_success 'check-ref-format --branch from subdir' ' test "$refname" = "$sha1" ' +test_expect_success 'check-ref-format --branch @{-1} from non-repo' ' + nongit test_must_fail git check-ref-format --branch @{-1} >actual && + test_must_be_empty actual +' + +test_expect_success 'check-ref-format --branch master from non-repo' ' + echo master >expect && + nongit git check-ref-format --branch master >actual && + test_cmp expect actual +' + valid_ref_normalized() { prereq= case $1 in |