From: Junio C Hamano Date: Sun, 24 Sep 2017 10:39:42 +0000 (+0900) Subject: Merge branch 'mk/describe-match-with-all' into next X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f96d58dd83f425192fa1d39b7cab7425275a2026?hp=-c Merge branch 'mk/describe-match-with-all' into next "git describe --match " has been taught to play well with the "--all" option. * mk/describe-match-with-all: describe: teach --match to handle branches and remotes --- f96d58dd83f425192fa1d39b7cab7425275a2026 diff --combined t/t6120-describe.sh index 70d92d24cb,0a8f754100..1c0e8659d9 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@@ -190,6 -190,33 +190,33 @@@ check_describe "test1-lightweight-*" -- check_describe "test1-lightweight-*" --long --tags --match="test3-*" --match="test1-*" HEAD + test_expect_success 'set-up branches' ' + git branch branch_A A && + git branch branch_C c && + git update-ref refs/remotes/origin/remote_branch_A "A^{commit}" && + git update-ref refs/remotes/origin/remote_branch_C "c^{commit}" && + git update-ref refs/original/original_branch_A test-annotated~2 + ' + + check_describe "heads/branch_A*" --all --match="branch_*" --exclude="branch_C" HEAD + + check_describe "remotes/origin/remote_branch_A*" --all --match="origin/remote_branch_*" --exclude="origin/remote_branch_C" HEAD + + check_describe "original/original_branch_A*" --all test-annotated~1 + + test_expect_success '--match does not work for other types' ' + test_must_fail git describe --all --match="*original_branch_*" test-annotated~1 + ' + + test_expect_success '--exclude does not work for other types' ' + R=$(git describe --all --exclude="any_pattern_even_not_matching" test-annotated~1) && + case "$R" in + *original_branch_A*) echo "fail: Found unknown reference $R with --exclude" + false;; + *) echo ok: Found some known type;; + esac + ' + test_expect_success 'name-rev with exact tags' ' echo A >expect && tag_object=$(git rev-parse refs/tags/A) && @@@ -202,31 -229,6 +229,31 @@@ test_cmp expect actual ' +test_expect_success 'name-rev --all' ' + >expect.unsorted && + for rev in $(git rev-list --all) + do + git name-rev $rev >>expect.unsorted + done && + sort expect && + git name-rev --all >actual.unsorted && + sort actual && + test_cmp expect actual +' + +test_expect_success 'name-rev --stdin' ' + >expect.unsorted && + for rev in $(git rev-list --all) + do + name=$(git name-rev --name-only $rev) && + echo "$rev ($name)" >>expect.unsorted + done && + sort expect && + git rev-list --all | git name-rev --stdin >actual.unsorted && + sort actual && + test_cmp expect actual +' + test_expect_success 'describe --contains with the exact tags' ' echo "A^0" >expect && tag_object=$(git rev-parse refs/tags/A) && @@@ -279,38 -281,7 +306,38 @@@ test_expect_success 'describe chokes o ' test_expect_success 'describe ignoring a borken submodule' ' git describe --broken >out && + test_when_finished "mv .git/modules/sub_moved .git/modules/sub1" && grep broken out ' +test_expect_failure ULIMIT_STACK_SIZE 'name-rev works in a deep repo' ' + i=1 && + while test $i -lt 8000 + do + echo "commit refs/heads/master +committer A U Thor $((1000000000 + $i * 100)) +0200 +data <expect && + git name-rev HEAD~4000 >actual && + test_cmp expect actual && + run_with_limited_stack git name-rev HEAD~4000 >actual && + test_cmp expect actual +' + +test_expect_success ULIMIT_STACK_SIZE 'describe works in a deep repo' ' + git tag -f far-far-away HEAD~7999 && + echo "far-far-away" >expect && + git describe --tags --abbrev=0 HEAD~4000 >actual && + test_cmp expect actual && + run_with_limited_stack git describe --tags --abbrev=0 HEAD~4000 >actual && + test_cmp expect actual +' + test_done