diff options
author | Jiang Xin <worldhello.net@gmail.com> | 2020-12-21 07:10:19 +0800 |
---|---|---|
committer | Jiang Xin <worldhello.net@gmail.com> | 2020-12-21 07:10:19 +0800 |
commit | 3104153d5ea3bd0e68166e02ec847a895f9a76e6 (patch) | |
tree | 8b65383c203c550fab3f6ffea51cd474168ac34b /t | |
parent | l10n: Update Catalan translation (diff) | |
parent | Git 2.30-rc1 (diff) | |
download | tgif-3104153d5ea3bd0e68166e02ec847a895f9a76e6.tar.xz |
Merge remote-tracking branch 'github/master' into git-po-master
* github/master: (42 commits)
Git 2.30-rc1
git-gui: use gray background for inactive text widgets
Another batch before 2.30-rc1
git-gui: Fix selected text colors
Makefile: conditionally include GIT-VERSION-FILE
git-gui: fix colored label backgrounds when using themed widgets
config.mak.uname: remove old NonStop compatibility settings
diff: correct interaction between --exit-code and -I<pattern>
t/perf: fix test_export() failure with BSD `sed`
style: do not "break" in switch() after "return"
compat-util: pretend that stub setitimer() always succeeds
strmap: make callers of strmap_remove() to call it in void context
doc: mention Python 3.x supports
index-format.txt: document v2 format of file system monitor extension
docs: multi-pack-index: remove note about future 'verify' work
init: provide useful advice about init.defaultBranch
get_default_branch_name(): prepare for showing some advice
branch -m: allow renaming a yet-unborn branch
init: document `init.defaultBranch` better
t7900: use --fixed-value in git-maintenance tests
...
Diffstat (limited to 't')
-rw-r--r-- | t/perf/perf-lib.sh | 9 | ||||
-rwxr-xr-x | t/t0001-init.sh | 17 | ||||
-rwxr-xr-x | t/t0064-oid-array.sh (renamed from t/t0064-sha1-array.sh) | 9 | ||||
-rwxr-xr-x | t/t1510-repo-setup.sh | 2 | ||||
-rwxr-xr-x | t/t4015-diff-whitespace.sh | 24 | ||||
-rwxr-xr-x | t/t5616-partial-clone.sh | 10 | ||||
-rwxr-xr-x | t/t6300-for-each-ref.sh | 178 | ||||
-rwxr-xr-x | t/t7064-wtstatus-pv2.sh | 103 | ||||
-rwxr-xr-x | t/t7900-maintenance.sh | 4 | ||||
-rw-r--r-- | t/test-lib-functions.sh | 4 |
10 files changed, 210 insertions, 150 deletions
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh index 821581a885..22d727cef8 100644 --- a/t/perf/perf-lib.sh +++ b/t/perf/perf-lib.sh @@ -148,13 +148,18 @@ test_run_perf_ () { . '"$TEST_DIRECTORY"/test-lib-functions.sh' test_export () { [ $# != 0 ] || return 0 - test_export_="$test_export_\\|$1" + test_export_="$test_export_ $1" shift test_export "$@" } '"$1"' ret=$? -set | sed -n "s'"/'/'\\\\''/g"';s/^\\($test_export_\\)/export '"'&'"'/p" >test_vars +needles= +for v in $test_export_ +do + needles="$needles;s/^$v=/export $v=/p" +done +set | sed -n "s'"/'/'\\\\''/g"'$needles" >test_vars exit $ret' >&3 2>&4 eval_ret=$? diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 69a320489f..0803994874 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -163,7 +163,7 @@ test_expect_success 'reinit' ' ( mkdir again && cd again && - git init >out1 2>err1 && + git -c init.defaultBranch=initial init >out1 2>err1 && git init >out2 2>err2 ) && test_i18ngrep "Initialized empty" again/out1 && @@ -558,6 +558,13 @@ test_expect_success 'overridden default initial branch name (config)' ' grep nmb actual ' +test_expect_success 'advice on unconfigured init.defaultBranch' ' + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= git -c color.advice=always \ + init unconfigured-default-branch-name 2>err && + test_decode_color <err >decoded && + test_i18ngrep "<YELLOW>hint: " decoded +' + test_expect_success 'overridden default main branch name (env)' ' test_config_global init.defaultBranch nmb && GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=env git init main-branch-env && @@ -571,4 +578,12 @@ test_expect_success 'invalid default branch name' ' test_i18ngrep "invalid branch name" err ' +test_expect_success 'branch -m with the initial branch' ' + git init rename-initial && + git -C rename-initial branch -m renamed && + test renamed = $(git -C rename-initial symbolic-ref --short HEAD) && + git -C rename-initial branch -m renamed again && + test again = $(git -C rename-initial symbolic-ref --short HEAD) +' + test_done diff --git a/t/t0064-sha1-array.sh b/t/t0064-oid-array.sh index 45685af2fd..2e5438ccda 100755 --- a/t/t0064-sha1-array.sh +++ b/t/t0064-oid-array.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='basic tests for the SHA1 array implementation' +test_description='basic tests for the oid array implementation' . ./test-lib.sh echoid () { @@ -27,6 +27,7 @@ test_expect_success 'ordered enumeration with duplicate suppression' ' { echoid append 88 44 aa 55 && echoid append 88 44 aa 55 && + echoid append 88 44 aa 55 && echo for_each_unique } | test-tool oid-array >actual && test_cmp expect actual @@ -54,17 +55,19 @@ test_expect_success 'lookup with duplicates' ' { echoid append 88 44 aa 55 && echoid append 88 44 aa 55 && + echoid append 88 44 aa 55 && echoid lookup 55 } | test-tool oid-array >actual && n=$(cat actual) && - test "$n" -ge 2 && - test "$n" -le 3 + test "$n" -ge 3 && + test "$n" -le 5 ' test_expect_success 'lookup non-existing entry with duplicates' ' { echoid append 88 44 aa 55 && echoid append 88 44 aa 55 && + echoid append 88 44 aa 55 && echoid lookup 66 } | test-tool oid-array >actual && n=$(cat actual) && diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh index 9974457f56..bbfe05b8e4 100755 --- a/t/t1510-repo-setup.sh +++ b/t/t1510-repo-setup.sh @@ -79,7 +79,7 @@ setup_repo () { name=$1 worktreecfg=$2 gitfile=$3 barecfg=$4 && sane_unset GIT_DIR GIT_WORK_TREE && - git init "$name" && + git -c init.defaultBranch=initial init "$name" && maybe_config "$name/.git/config" core.worktree "$worktreecfg" && maybe_config "$name/.git/config" core.bare "$barecfg" && mkdir -p "$name/sub/sub" && diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index 47f0e2889d..8c574221b2 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -567,6 +567,30 @@ test_expect_success '--check and --quiet are not exclusive' ' git diff --check --quiet ' +test_expect_success '-w and --exit-code interact sensibly' ' + test_when_finished "git checkout x" && + { + test_seq 15 && + echo " 16" + } >x && + test_must_fail git diff --exit-code && + git diff -w >actual && + test_must_be_empty actual && + git diff -w --exit-code +' + +test_expect_success '-I and --exit-code interact sensibly' ' + test_when_finished "git checkout x" && + { + test_seq 15 && + echo " 16" + } >x && + test_must_fail git diff --exit-code && + git diff -I. >actual && + test_must_be_empty actual && + git diff -I. --exit-code +' + test_expect_success 'check staged with no whitespace errors' ' echo "foo();" >x && git add x && diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh index 2ea66205cf..d98c550267 100755 --- a/t/t5616-partial-clone.sh +++ b/t/t5616-partial-clone.sh @@ -289,7 +289,15 @@ test_expect_success 'upload-pack limits tree depth filters' ' test_config -C srv.bare uploadpackfilter.tree.maxDepth 0 && test_must_fail ok=sigpipe git clone --no-checkout --filter=tree:1 \ "file://$(pwd)/srv.bare" pc3 2>err && - test_i18ngrep "tree filter allows max depth 0, but got 1" err + test_i18ngrep "tree filter allows max depth 0, but got 1" err && + + git clone --no-checkout --filter=tree:0 "file://$(pwd)/srv.bare" pc4 && + + test_config -C srv.bare uploadpackfilter.tree.maxDepth 5 && + git clone --no-checkout --filter=tree:5 "file://$(pwd)/srv.bare" pc5 && + test_must_fail ok=sigpipe git clone --no-checkout --filter=tree:6 \ + "file://$(pwd)/srv.bare" pc6 2>err && + test_i18ngrep "tree filter allows max depth 5, but got 6" err ' test_expect_success 'partial clone fetches blobs pointed to by refs even if normally filtered out' ' diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index b359023189..810cdbb6f8 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -28,12 +28,13 @@ test_expect_success setup ' echo "Using $datestamp" > one && git add one && git commit -m "Initial" && + git branch -M main && setdate_and_increment && git tag -a -m "Tagging at $datestamp" testtag && - git update-ref refs/remotes/origin/master master && + git update-ref refs/remotes/origin/main main && git remote add origin nowhere && - git config branch.master.remote origin && - git config branch.master.merge refs/heads/master && + git config branch.main.remote origin && + git config branch.main.merge refs/heads/main && git remote add myfork elsewhere && git config remote.pushdefault myfork && git config push.default current @@ -41,7 +42,7 @@ test_expect_success setup ' test_atom() { case "$1" in - head) ref=refs/heads/master ;; + head) ref=refs/heads/main ;; tag) ref=refs/tags/testtag ;; sym) ref=refs/heads/sym ;; *) ref=$1 ;; @@ -76,49 +77,49 @@ test_atom() { hexlen=$(test_oid hexsz) disklen=$(test_oid disklen) -test_atom head refname refs/heads/master -test_atom head refname: refs/heads/master -test_atom head refname:short master -test_atom head refname:lstrip=1 heads/master -test_atom head refname:lstrip=2 master -test_atom head refname:lstrip=-1 master -test_atom head refname:lstrip=-2 heads/master +test_atom head refname refs/heads/main +test_atom head refname: refs/heads/main +test_atom head refname:short main +test_atom head refname:lstrip=1 heads/main +test_atom head refname:lstrip=2 main +test_atom head refname:lstrip=-1 main +test_atom head refname:lstrip=-2 heads/main test_atom head refname:rstrip=1 refs/heads test_atom head refname:rstrip=2 refs test_atom head refname:rstrip=-1 refs test_atom head refname:rstrip=-2 refs/heads -test_atom head refname:strip=1 heads/master -test_atom head refname:strip=2 master -test_atom head refname:strip=-1 master -test_atom head refname:strip=-2 heads/master -test_atom head upstream refs/remotes/origin/master -test_atom head upstream:short origin/master -test_atom head upstream:lstrip=2 origin/master -test_atom head upstream:lstrip=-2 origin/master +test_atom head refname:strip=1 heads/main +test_atom head refname:strip=2 main +test_atom head refname:strip=-1 main +test_atom head refname:strip=-2 heads/main +test_atom head upstream refs/remotes/origin/main +test_atom head upstream:short origin/main +test_atom head upstream:lstrip=2 origin/main +test_atom head upstream:lstrip=-2 origin/main test_atom head upstream:rstrip=2 refs/remotes test_atom head upstream:rstrip=-2 refs/remotes -test_atom head upstream:strip=2 origin/master -test_atom head upstream:strip=-2 origin/master -test_atom head push refs/remotes/myfork/master -test_atom head push:short myfork/master -test_atom head push:lstrip=1 remotes/myfork/master -test_atom head push:lstrip=-1 master +test_atom head upstream:strip=2 origin/main +test_atom head upstream:strip=-2 origin/main +test_atom head push refs/remotes/myfork/main +test_atom head push:short myfork/main +test_atom head push:lstrip=1 remotes/myfork/main +test_atom head push:lstrip=-1 main test_atom head push:rstrip=1 refs/remotes/myfork test_atom head push:rstrip=-1 refs -test_atom head push:strip=1 remotes/myfork/master -test_atom head push:strip=-1 master +test_atom head push:strip=1 remotes/myfork/main +test_atom head push:strip=-1 main test_atom head objecttype commit test_atom head objectsize $((131 + hexlen)) test_atom head objectsize:disk $disklen test_atom head deltabase $ZERO_OID -test_atom head objectname $(git rev-parse refs/heads/master) -test_atom head objectname:short $(git rev-parse --short refs/heads/master) -test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master) -test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/master) -test_atom head tree $(git rev-parse refs/heads/master^{tree}) -test_atom head tree:short $(git rev-parse --short refs/heads/master^{tree}) -test_atom head tree:short=1 $(git rev-parse --short=1 refs/heads/master^{tree}) -test_atom head tree:short=10 $(git rev-parse --short=10 refs/heads/master^{tree}) +test_atom head objectname $(git rev-parse refs/heads/main) +test_atom head objectname:short $(git rev-parse --short refs/heads/main) +test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/main) +test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/main) +test_atom head tree $(git rev-parse refs/heads/main^{tree}) +test_atom head tree:short $(git rev-parse --short refs/heads/main^{tree}) +test_atom head tree:short=1 $(git rev-parse --short=1 refs/heads/main^{tree}) +test_atom head tree:short=10 $(git rev-parse --short=10 refs/heads/main^{tree}) test_atom head parent '' test_atom head parent:short '' test_atom head parent:short=1 '' @@ -171,8 +172,8 @@ test_atom tag deltabase $ZERO_OID test_atom tag '*deltabase' $ZERO_OID test_atom tag objectname $(git rev-parse refs/tags/testtag) test_atom tag objectname:short $(git rev-parse --short refs/tags/testtag) -test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master) -test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/master) +test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/main) +test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/main) test_atom tag tree '' test_atom tag tree:short '' test_atom tag tree:short=1 '' @@ -253,7 +254,7 @@ test_date () { author_date=$3 && tagger_date=$4 && cat >expected <<-EOF && - 'refs/heads/master' '$committer_date' '$author_date' + 'refs/heads/main' '$committer_date' '$author_date' 'refs/tags/testtag' '$tagger_date' EOF ( @@ -375,8 +376,8 @@ test_expect_success 'exercise strftime with odd fields' ' ' cat >expected <<\EOF -refs/heads/master -refs/remotes/origin/master +refs/heads/main +refs/remotes/origin/main refs/tags/testtag EOF @@ -388,8 +389,8 @@ test_expect_success 'Verify ascending sort' ' cat >expected <<\EOF refs/tags/testtag -refs/remotes/origin/master -refs/heads/master +refs/remotes/origin/main +refs/heads/main EOF test_expect_success 'Verify descending sort' ' @@ -424,8 +425,8 @@ test_expect_success 'exercise glob patterns with prefixes' ' ' cat >expected <<\EOF -'refs/heads/master' -'refs/remotes/origin/master' +'refs/heads/main' +'refs/remotes/origin/main' 'refs/tags/testtag' EOF @@ -445,8 +446,8 @@ test_expect_success 'Quoting style: python' ' ' cat >expected <<\EOF -"refs/heads/master" -"refs/remotes/origin/master" +"refs/heads/main" +"refs/remotes/origin/main" "refs/tags/testtag" EOF @@ -473,8 +474,8 @@ test_atom head upstream:nobracket,track 'ahead 1' test_expect_success 'setup for push:track[short]' ' test_commit third && - git update-ref refs/remotes/myfork/master master && - git reset master~1 + git update-ref refs/remotes/myfork/main main && + git reset main~1 ' test_atom head push:track '[behind 1]' @@ -490,8 +491,8 @@ test_expect_success 'Check that :track[short] works when upstream is invalid' ' [gone] EOF - test_when_finished "git config branch.master.merge refs/heads/master" && - git config branch.master.merge refs/heads/does-not-exist && + test_when_finished "git config branch.main.merge refs/heads/main" && + git config branch.main.merge refs/heads/does-not-exist && git for-each-ref \ --format="%(upstream:track)$LF%(upstream:trackshort)" \ refs/heads >actual && @@ -504,9 +505,9 @@ test_expect_success 'Check for invalid refname format' ' test_expect_success 'set up color tests' ' cat >expected.color <<-EOF && - $(git rev-parse --short refs/heads/master) <GREEN>master<RESET> - $(git rev-parse --short refs/remotes/myfork/master) <GREEN>myfork/master<RESET> - $(git rev-parse --short refs/remotes/origin/master) <GREEN>origin/master<RESET> + $(git rev-parse --short refs/heads/main) <GREEN>main<RESET> + $(git rev-parse --short refs/remotes/myfork/main) <GREEN>myfork/main<RESET> + $(git rev-parse --short refs/remotes/origin/main) <GREEN>origin/main<RESET> $(git rev-parse --short refs/tags/testtag) <GREEN>testtag<RESET> $(git rev-parse --short refs/tags/third) <GREEN>third<RESET> $(git rev-parse --short refs/tags/two) <GREEN>two<RESET> @@ -538,8 +539,8 @@ test_expect_success 'color.ui=always does not override tty check' ' ' cat >expected <<\EOF -heads/master -tags/master +heads/main +tags/main EOF test_expect_success 'Check ambiguous head and tag refs (strict)' ' @@ -549,19 +550,19 @@ test_expect_success 'Check ambiguous head and tag refs (strict)' ' git add one && git commit -m "Branch" && setdate_and_increment && - git tag -m "Tagging at $datestamp" master && - git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual && + git tag -m "Tagging at $datestamp" main && + git for-each-ref --format "%(refname:short)" refs/heads/main refs/tags/main >actual && test_cmp expected actual ' cat >expected <<\EOF -heads/master -master +heads/main +main EOF test_expect_success 'Check ambiguous head and tag refs (loose)' ' git config --bool core.warnambiguousrefs false && - git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual && + git for-each-ref --format "%(refname:short)" refs/heads/main refs/tags/main >actual && test_cmp expected actual ' @@ -571,7 +572,7 @@ ambiguous EOF test_expect_success 'Check ambiguous head and tag refs II (loose)' ' - git checkout master && + git checkout main && git tag ambiguous testtag^0 && git branch ambiguous testtag^0 && git for-each-ref --format "%(refname:short)" refs/heads/ambiguous refs/tags/ambiguous >actual && @@ -705,8 +706,8 @@ body contents $sig" test_expect_success 'set up refs pointing to tree and blob' ' - git update-ref refs/mytrees/first refs/heads/master^{tree} && - git update-ref refs/myblobs/first refs/heads/master:one + git update-ref refs/mytrees/first refs/heads/main^{tree} && + git update-ref refs/myblobs/first refs/heads/main:one ' test_atom refs/mytrees/first subject "" @@ -778,7 +779,7 @@ test_expect_success 'equivalent sorts fall back on refname' ' ' test_expect_success 'do not dereference NULL upon %(HEAD) on unborn branch' ' - test_when_finished "git checkout master" && + test_when_finished "git checkout main" && git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual && sed -e "s/^\* / /" actual >expect && git checkout --orphan orphaned-branch && @@ -815,9 +816,9 @@ test_expect_success '%(trailers:unfold) unfolds trailers' ' unfold <trailers echo } >expect && - git for-each-ref --format="%(trailers:unfold)" refs/heads/master >actual && + git for-each-ref --format="%(trailers:unfold)" refs/heads/main >actual && test_cmp expect actual && - git for-each-ref --format="%(contents:trailers:unfold)" refs/heads/master >actual && + git for-each-ref --format="%(contents:trailers:unfold)" refs/heads/main >actual && test_cmp expect actual ' @@ -826,9 +827,9 @@ test_expect_success '%(trailers:only) shows only "key: value" trailers' ' grep -v patch.description <trailers && echo } >expect && - git for-each-ref --format="%(trailers:only)" refs/heads/master >actual && + git for-each-ref --format="%(trailers:only)" refs/heads/main >actual && test_cmp expect actual && - git for-each-ref --format="%(contents:trailers:only)" refs/heads/master >actual && + git for-each-ref --format="%(contents:trailers:only)" refs/heads/main >actual && test_cmp expect actual ' @@ -837,13 +838,13 @@ test_expect_success '%(trailers:only) and %(trailers:unfold) work together' ' grep -v patch.description <trailers | unfold && echo } >expect && - git for-each-ref --format="%(trailers:only,unfold)" refs/heads/master >actual && + git for-each-ref --format="%(trailers:only,unfold)" refs/heads/main >actual && test_cmp expect actual && - git for-each-ref --format="%(trailers:unfold,only)" refs/heads/master >actual && + git for-each-ref --format="%(trailers:unfold,only)" refs/heads/main >actual && test_cmp actual actual && - git for-each-ref --format="%(contents:trailers:only,unfold)" refs/heads/master >actual && + git for-each-ref --format="%(contents:trailers:only,unfold)" refs/heads/main >actual && test_cmp expect actual && - git for-each-ref --format="%(contents:trailers:unfold,only)" refs/heads/master >actual && + git for-each-ref --format="%(contents:trailers:unfold,only)" refs/heads/main >actual && test_cmp actual actual ' @@ -867,7 +868,7 @@ test_expect_success 'if arguments, %(contents:trailers) shows error if colon is ' test_expect_success 'basic atom: head contents:trailers' ' - git for-each-ref --format="%(contents:trailers)" refs/heads/master >actual && + git for-each-ref --format="%(contents:trailers)" refs/heads/main >actual && sanitize_pgp <actual >actual.clean && # git for-each-ref ends with a blank line cat >expect <<-EOF && @@ -896,16 +897,16 @@ test_expect_success 'trailer parsing not fooled by --- line' ' echo "trailer: right" && echo } >expect && - git for-each-ref --format="%(trailers)" refs/heads/master >actual && + git for-each-ref --format="%(trailers)" refs/heads/main >actual && test_cmp expect actual ' test_expect_success 'Add symbolic ref for the following tests' ' - git symbolic-ref refs/heads/sym refs/heads/master + git symbolic-ref refs/heads/sym refs/heads/main ' cat >expected <<EOF -refs/heads/master +refs/heads/main EOF test_expect_success 'Verify usage of %(symref) atom' ' @@ -914,7 +915,7 @@ test_expect_success 'Verify usage of %(symref) atom' ' ' cat >expected <<EOF -heads/master +heads/main EOF test_expect_success 'Verify usage of %(symref:short) atom' ' @@ -923,8 +924,8 @@ test_expect_success 'Verify usage of %(symref:short) atom' ' ' cat >expected <<EOF -master -heads/master +main +heads/main EOF test_expect_success 'Verify usage of %(symref:lstrip) atom' ' @@ -953,22 +954,23 @@ test_expect_success ':remotename and :remoteref' ' ( cd remote-tests && test_commit initial && + git branch -M main && git remote add from fifth.coffee:blub && - git config branch.master.remote from && - git config branch.master.merge refs/heads/stable && + git config branch.main.remote from && + git config branch.main.merge refs/heads/stable && git remote add to southridge.audio:repo && git config remote.to.push "refs/heads/*:refs/heads/pushed/*" && - git config branch.master.pushRemote to && + git config branch.main.pushRemote to && for pair in "%(upstream)=refs/remotes/from/stable" \ "%(upstream:remotename)=from" \ "%(upstream:remoteref)=refs/heads/stable" \ - "%(push)=refs/remotes/to/pushed/master" \ + "%(push)=refs/remotes/to/pushed/main" \ "%(push:remotename)=to" \ - "%(push:remoteref)=refs/heads/pushed/master" + "%(push:remoteref)=refs/heads/pushed/main" do echo "${pair#*=}" >expect && git for-each-ref --format="${pair%=*}" \ - refs/heads/master >actual && + refs/heads/main >actual && test_cmp expect actual done && git branch push-simple && @@ -981,12 +983,12 @@ test_expect_success ':remotename and :remoteref' ' ' test_expect_success 'for-each-ref --ignore-case ignores case' ' - git for-each-ref --format="%(refname)" refs/heads/MASTER >actual && + git for-each-ref --format="%(refname)" refs/heads/MAIN >actual && test_must_be_empty actual && - echo refs/heads/master >expect && + echo refs/heads/main >expect && git for-each-ref --format="%(refname)" --ignore-case \ - refs/heads/MASTER >actual && + refs/heads/MAIN >actual && test_cmp expect actual ' diff --git a/t/t7064-wtstatus-pv2.sh b/t/t7064-wtstatus-pv2.sh index 537787e598..601b47830b 100755 --- a/t/t7064-wtstatus-pv2.sh +++ b/t/t7064-wtstatus-pv2.sh @@ -9,6 +9,7 @@ This test exercises porcelain V2 output for git status.' test_expect_success setup ' + git checkout -f --orphan initial-branch && test_tick && git config core.autocrlf false && echo x >file_x && @@ -22,7 +23,7 @@ test_expect_success setup ' test_expect_success 'before initial commit, nothing added, only untracked' ' cat >expect <<-EOF && # branch.oid (initial) - # branch.head master + # branch.head initial-branch ? actual ? dir1/ ? expect @@ -45,7 +46,7 @@ test_expect_success 'before initial commit, things added' ' cat >expect <<-EOF && # branch.oid (initial) - # branch.head master + # branch.head initial-branch 1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a 1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b 1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x @@ -62,7 +63,7 @@ test_expect_success 'before initial commit, things added' ' test_expect_success 'before initial commit, things added (-z)' ' lf_to_nul >expect <<-EOF && # branch.oid (initial) - # branch.head master + # branch.head initial-branch 1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a 1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b 1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x @@ -81,7 +82,7 @@ test_expect_success 'make first commit, comfirm HEAD oid and branch' ' H0=$(git rev-parse HEAD) && cat >expect <<-EOF && # branch.oid $H0 - # branch.head master + # branch.head initial-branch ? actual ? expect EOF @@ -98,7 +99,7 @@ test_expect_success 'after first commit, create unstaged changes' ' cat >expect <<-EOF && # branch.oid $H0 - # branch.head master + # branch.head initial-branch 1 .M N... 100644 100644 100644 $OID_X $OID_X file_x 1 .D N... 100644 100644 000000 $OID_Z $OID_Z file_z ? actual @@ -126,7 +127,7 @@ test_expect_success 'after first commit, stage existing changes' ' cat >expect <<-EOF && # branch.oid $H0 - # branch.head master + # branch.head initial-branch 1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x 1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z ? actual @@ -143,7 +144,7 @@ test_expect_success 'rename causes 2 path lines' ' q_to_tab >expect <<-EOF && # branch.oid $H0 - # branch.head master + # branch.head initial-branch 1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x 1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z 2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y @@ -161,7 +162,7 @@ test_expect_success 'rename causes 2 path lines (-z)' ' ## Lines use NUL path separator and line terminator, so double transform here. q_to_nul <<-EOF | lf_to_nul >expect && # branch.oid $H0 - # branch.head master + # branch.head initial-branch 1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x 1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z 2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y @@ -179,7 +180,7 @@ test_expect_success 'make second commit, confirm clean and new HEAD oid' ' cat >expect <<-EOF && # branch.oid $H1 - # branch.head master + # branch.head initial-branch ? actual ? expect EOF @@ -231,7 +232,7 @@ test_expect_success 'create and commit permanent ignore file' ' cat >expect <<-EOF && # branch.oid $H1 - # branch.head master + # branch.head initial-branch EOF git status --porcelain=v2 --branch >actual && @@ -257,14 +258,14 @@ test_expect_success 'verify --intent-to-add output' ' test_expect_success 'verify AA (add-add) conflict' ' test_when_finished "git reset --hard" && - git branch AA_A master && + git branch AA_A initial-branch && git checkout AA_A && echo "Branch AA_A" >conflict.txt && OID_AA_A=$(git hash-object -t blob -- conflict.txt) && git add conflict.txt && git commit -m "branch aa_a" && - git branch AA_B master && + git branch AA_B initial-branch && git checkout AA_B && echo "Branch AA_B" >conflict.txt && OID_AA_B=$(git hash-object -t blob -- conflict.txt) && @@ -290,7 +291,7 @@ test_expect_success 'verify AA (add-add) conflict' ' test_expect_success 'verify UU (edit-edit) conflict' ' test_when_finished "git reset --hard" && - git branch UU_ANC master && + git branch UU_ANC initial-branch && git checkout UU_ANC && echo "Ancestor" >conflict.txt && OID_UU_ANC=$(git hash-object -t blob -- conflict.txt) && @@ -328,18 +329,18 @@ test_expect_success 'verify UU (edit-edit) conflict' ' ' test_expect_success 'verify upstream fields in branch header' ' - git checkout master && + git checkout initial-branch && test_when_finished "rm -rf sub_repo" && git clone . sub_repo && ( - ## Confirm local master tracks remote master. + ## Confirm local initial-branch tracks remote initial-branch. cd sub_repo && HUF=$(git rev-parse HEAD) && cat >expect <<-EOF && # branch.oid $HUF - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +0 -0 EOF @@ -355,8 +356,8 @@ test_expect_success 'verify upstream fields in branch header' ' cat >expect <<-EOF && # branch.oid $HUF - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +1 -0 EOF @@ -367,9 +368,9 @@ test_expect_success 'verify upstream fields in branch header' ' git status --porcelain=v2 --untracked-files=all >actual && test_must_be_empty actual && - ## Test upstream-gone case. Fake this by pointing origin/master at - ## a non-existing commit. - OLD=$(git rev-parse origin/master) && + ## Test upstream-gone case. Fake this by pointing + ## origin/initial-branch at a non-existing commit. + OLD=$(git rev-parse origin/initial-branch) && NEW=$ZERO_OID && mv .git/packed-refs .git/old-packed-refs && sed "s/$OLD/$NEW/g" <.git/old-packed-refs >.git/packed-refs && @@ -378,8 +379,8 @@ test_expect_success 'verify upstream fields in branch header' ' cat >expect <<-EOF && # branch.oid $HUF - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch EOF git status --porcelain=v2 --branch --untracked-files=all >actual && @@ -388,19 +389,19 @@ test_expect_success 'verify upstream fields in branch header' ' ' test_expect_success 'verify --[no-]ahead-behind with V2 format' ' - git checkout master && + git checkout initial-branch && test_when_finished "rm -rf sub_repo" && git clone . sub_repo && ( - ## Confirm local master tracks remote master. + ## Confirm local initial-branch tracks remote initial-branch. cd sub_repo && HUF=$(git rev-parse HEAD) && # Confirm --no-ahead-behind reports traditional branch.ab with 0/0 for equal branches. cat >expect <<-EOF && # branch.oid $HUF - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +0 -0 EOF @@ -410,8 +411,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' ' # Confirm --ahead-behind reports traditional branch.ab with 0/0. cat >expect <<-EOF && # branch.oid $HUF - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +0 -0 EOF @@ -428,8 +429,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' ' # Confirm --no-ahead-behind reports branch.ab with ?/? for non-equal branches. cat >expect <<-EOF && # branch.oid $HUF - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +? -? EOF @@ -439,8 +440,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' ' # Confirm --ahead-behind reports traditional branch.ab with 1/0. cat >expect <<-EOF && # branch.oid $HUF - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +1 -0 EOF @@ -458,7 +459,7 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' ' ' test_expect_success 'create and add submodule, submodule appears clean (A. S...)' ' - git checkout master && + git checkout initial-branch && git clone . sub_repo && git clone . super_repo && ( cd super_repo && @@ -471,8 +472,8 @@ test_expect_success 'create and add submodule, submodule appears clean (A. S...) cat >expect <<-EOF && # branch.oid $HSUP - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +0 -0 1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules 1 A. S... 000000 160000 160000 $ZERO_OID $HSUB sub1 @@ -496,8 +497,8 @@ test_expect_success 'untracked changes in added submodule (AM S..U)' ' cat >expect <<-EOF && # branch.oid $HSUP - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +0 -0 1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules 1 AM S..U 000000 160000 160000 $ZERO_OID $HSUB sub1 @@ -521,8 +522,8 @@ test_expect_success 'staged changes in added submodule (AM S.M.)' ' cat >expect <<-EOF && # branch.oid $HSUP - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +0 -0 1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules 1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1 @@ -548,8 +549,8 @@ test_expect_success 'staged and unstaged changes in added (AM S.M.)' ' cat >expect <<-EOF && # branch.oid $HSUP - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +0 -0 1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules 1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1 @@ -575,8 +576,8 @@ test_expect_success 'staged and untracked changes in added submodule (AM S.MU)' cat >expect <<-EOF && # branch.oid $HSUP - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +0 -0 1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules 1 AM S.MU 000000 160000 160000 $ZERO_OID $HSUB sub1 @@ -602,8 +603,8 @@ test_expect_success 'commit within the submodule appears as new commit in super cat >expect <<-EOF && # branch.oid $HSUP - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +0 -0 1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules 1 AM SC.. 000000 160000 160000 $ZERO_OID $HSUB sub1 @@ -625,8 +626,8 @@ test_expect_success 'stage submodule in super and commit' ' cat >expect <<-EOF && # branch.oid $HSUP - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +1 -0 EOF @@ -646,8 +647,8 @@ test_expect_success 'make unstaged changes in existing submodule (.M S.M.)' ' cat >expect <<-EOF && # branch.oid $HSUP - # branch.head master - # branch.upstream origin/master + # branch.head initial-branch + # branch.upstream origin/initial-branch # branch.ab +1 -0 1 .M S.M. 160000 160000 160000 $HSUB $HSUB sub1 EOF diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index e987b44f87..d1e0c8f830 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -422,7 +422,7 @@ test_expect_success 'start from empty cron table' ' GIT_TEST_CRONTAB="test-tool crontab cron.txt" git maintenance start && # start registers the repo - git config --get --global maintenance.repo "$(pwd)" && + git config --get --global --fixed-value maintenance.repo "$(pwd)" && grep "for-each-repo --config=maintenance.repo maintenance run --schedule=daily" cron.txt && grep "for-each-repo --config=maintenance.repo maintenance run --schedule=hourly" cron.txt && @@ -433,7 +433,7 @@ test_expect_success 'stop from existing schedule' ' GIT_TEST_CRONTAB="test-tool crontab cron.txt" git maintenance stop && # stop does not unregister the repo - git config --get --global maintenance.repo "$(pwd)" && + git config --get --global --fixed-value maintenance.repo "$(pwd)" && # Operation is idempotent GIT_TEST_CRONTAB="test-tool crontab cron.txt" git maintenance stop && diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index eca4d311ef..999982fe4a 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1202,7 +1202,9 @@ test_create_repo () { mkdir -p "$repo" ( cd "$repo" || error "Cannot setup test environment" - "${GIT_TEST_INSTALLED:-$GIT_EXEC_PATH}/git$X" init \ + "${GIT_TEST_INSTALLED:-$GIT_EXEC_PATH}/git$X" -c \ + init.defaultBranch="${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME-master}" \ + init \ "--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 || error "cannot run git init -- have you built things yet?" mv .git/hooks .git/hooks-disabled |