diff options
Diffstat (limited to 't/t6018-rev-list-glob.sh')
-rwxr-xr-x | t/t6018-rev-list-glob.sh | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/t/t6018-rev-list-glob.sh b/t/t6018-rev-list-glob.sh index bb5aeac07f..24b34add83 100755 --- a/t/t6018-rev-list-glob.sh +++ b/t/t6018-rev-list-glob.sh @@ -2,6 +2,9 @@ test_description='rev-list/rev-parse --glob' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./test-lib.sh commit () { @@ -20,23 +23,23 @@ compare () { test_expect_success 'setup' ' - commit master && - git checkout -b subspace/one master && + commit main && + git checkout -b subspace/one main && commit one && - git checkout -b subspace/two master && + git checkout -b subspace/two main && commit two && - git checkout -b subspace-x master && + git checkout -b subspace-x main && commit subspace-x && - git checkout -b other/three master && + git checkout -b other/three main && commit three && - git checkout -b someref master && + git checkout -b someref main && commit some && - git checkout master && - commit master2 && - git tag foo/bar master && - commit master3 && - git update-ref refs/remotes/foo/baz master && - commit master4 && + git checkout main && + commit topic_2 && + git tag foo/bar main && + commit topic_3 && + git update-ref refs/remotes/foo/baz main && + commit topic_4 && git update-ref refs/remotes/upstream/one subspace/one && git update-ref refs/remotes/upstream/two subspace/two && git update-ref refs/remotes/upstream/x subspace-x && @@ -83,7 +86,7 @@ test_expect_failure 'rev-parse accepts --glob as detached option' ' test_expect_failure 'rev-parse is not confused by option-like glob' ' - compare rev-parse "master" "--glob --symbolic master" + compare rev-parse "main" "--glob --symbolic main" ' @@ -111,15 +114,15 @@ test_expect_success 'rev-parse --glob=heads/subspace/* --glob=heads/other/*' ' ' -test_expect_success 'rev-parse --glob=heads/someref/* master' ' +test_expect_success 'rev-parse --glob=heads/someref/* main' ' - compare rev-parse "master" "--glob=heads/someref/* master" + compare rev-parse "main" "--glob=heads/someref/* main" ' test_expect_success 'rev-parse --glob=heads/*' ' - compare rev-parse "master other/three someref subspace-x subspace/one subspace/two" "--glob=heads/*" + compare rev-parse "main other/three someref subspace-x subspace/one subspace/two" "--glob=heads/*" ' @@ -136,7 +139,7 @@ test_expect_success 'rev-parse --remotes=foo' ' ' test_expect_success 'rev-parse --exclude with --branches' ' - compare rev-parse "--exclude=*/* --branches" "master someref subspace-x" + compare rev-parse "--exclude=*/* --branches" "main someref subspace-x" ' test_expect_success 'rev-parse --exclude with --all' ' @@ -221,7 +224,7 @@ test_expect_success 'rev-list --glob refs/heads/subspace/*' ' test_expect_success 'rev-list not confused by option-like --glob arg' ' - compare rev-list "master" "--glob -0 master" + compare rev-list "main" "--glob -0 main" ' @@ -269,13 +272,13 @@ test_expect_success 'rev-list --branches=subspace' ' test_expect_success 'rev-list --branches' ' - compare rev-list "master subspace-x someref other/three subspace/one subspace/two" "--branches" + compare rev-list "main subspace-x someref other/three subspace/one subspace/two" "--branches" ' -test_expect_success 'rev-list --glob=heads/someref/* master' ' +test_expect_success 'rev-list --glob=heads/someref/* main' ' - compare rev-list "master" "--glob=heads/someref/* master" + compare rev-list "main" "--glob=heads/someref/* main" ' @@ -287,7 +290,7 @@ test_expect_success 'rev-list --glob=heads/subspace/* --glob=heads/other/*' ' test_expect_success 'rev-list --glob=heads/*' ' - compare rev-list "master other/three someref subspace-x subspace/one subspace/two" "--glob=heads/*" + compare rev-list "main other/three someref subspace-x subspace/one subspace/two" "--glob=heads/*" ' @@ -310,7 +313,7 @@ test_expect_success 'rev-list --remotes=foo' ' ' test_expect_success 'rev-list --exclude with --branches' ' - compare rev-list "--exclude=*/* --branches" "master someref subspace-x" + compare rev-list "--exclude=*/* --branches" "main someref subspace-x" ' test_expect_success 'rev-list --exclude with --all' ' @@ -345,17 +348,22 @@ test_expect_success 'rev-list should succeed with empty output with empty glob' test_must_be_empty actual ' +test_expect_success 'rev-list should succeed with empty output when ignoring missing' ' + git rev-list --ignore-missing $ZERO_OID >actual && + test_must_be_empty actual +' + test_expect_success 'shortlog accepts --glob/--tags/--remotes' ' compare shortlog "subspace/one subspace/two" --branches=subspace && compare shortlog \ - "master subspace-x someref other/three subspace/one subspace/two" \ + "main subspace-x someref other/three subspace/one subspace/two" \ --branches && - compare shortlog master "--glob=heads/someref/* master" && + compare shortlog main "--glob=heads/someref/* main" && compare shortlog "subspace/one subspace/two other/three" \ "--glob=heads/subspace/* --glob=heads/other/*" && compare shortlog \ - "master other/three someref subspace-x subspace/one subspace/two" \ + "main other/three someref subspace-x subspace/one subspace/two" \ "--glob=heads/*" && compare shortlog foo/bar --tags=foo && compare shortlog "foo/bar qux/one qux/two qux/x" --tags && @@ -366,14 +374,14 @@ test_expect_success 'shortlog accepts --glob/--tags/--remotes' ' test_expect_failure 'shortlog accepts --glob as detached option' ' compare shortlog \ - "master other/three someref subspace-x subspace/one subspace/two" \ + "main other/three someref subspace-x subspace/one subspace/two" \ "--glob heads/*" ' test_expect_failure 'shortlog --glob is not confused by option-like argument' ' - compare shortlog master "--glob -e master" + compare shortlog main "--glob -e main" ' |