]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'js/default-branch-name-tests-final-stretch'
authorJunio C Hamano <gitster@pobox.com>
Mon, 25 Jan 2021 22:19:18 +0000 (14:19 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Jan 2021 22:19:18 +0000 (14:19 -0800)
Prepare tests not to be affected by the name of the default branch
"git init" creates.

* js/default-branch-name-tests-final-stretch: (28 commits)
  tests: drop prereq `PREPARE_FOR_MAIN_BRANCH` where no longer needed
  t99*: adjust the references to the default branch name "main"
  tests(git-p4): transition to the default branch name `main`
  t9[5-7]*: adjust the references to the default branch name "main"
  t9[0-4]*: adjust the references to the default branch name "main"
  t8*: adjust the references to the default branch name "main"
  t7[5-9]*: adjust the references to the default branch name "main"
  t7[0-4]*: adjust the references to the default branch name "main"
  t6[4-9]*: adjust the references to the default branch name "main"
  t64*: preemptively adjust alignment to prepare for `master` -> `main`
  t6[0-3]*: adjust the references to the default branch name "main"
  t5[6-9]*: adjust the references to the default branch name "main"
  t55[4-9]*: adjust the references to the default branch name "main"
  t55[23]*: adjust the references to the default branch name "main"
  t551*: adjust the references to the default branch name "main"
  t550*: adjust the references to the default branch name "main"
  t5503: prepare aligned comment for replacing `master` with `main`
  t5[0-4]*: adjust the references to the default branch name "main"
  t5323: prepare centered comment for `master` -> `main`
  t4*: adjust the references to the default branch name "main"
  ...

36 files changed:
1  2 
t/t1300-config.sh
t/t1400-update-ref.sh
t/t1500-rev-parse.sh
t/t1503-rev-parse-verify.sh
t/t1506-rev-parse-diagnosis.sh
t/t1508-at-combinations.sh
t/t1512-rev-parse-disambiguation.sh
t/t3200-branch.sh
t/t3201-branch-contains.sh
t/t3203-branch-output.sh
t/t3205-branch-color.sh
t/t3301-notes.sh
t/t3404-rebase-interactive.sh
t/t3701-add-interactive.sh
t/t4014-format-patch.sh
t/t4041-diff-submodule-option.sh
t/t5310-pack-bitmaps.sh
t/t5323-pack-redundant.sh
t/t5505-remote.sh
t/t5510-fetch.sh
t/t5511-refspec.sh
t/t5516-fetch-push.sh
t/t5526-fetch-submodules.sh
t/t5570-git-daemon.sh
t/t5572-pull-submodule.sh
t/t5582-fetch-negative-refspec.sh
t/t5616-partial-clone.sh
t/t5703-upload-pack-ref-in-want.sh
t/t6016-rev-list-graph-simplify-history.sh
t/t6030-bisect-porcelain.sh
t/t6050-replace.sh
t/t6300-for-each-ref.sh
t/t6302-for-each-ref-filter.sh
t/t7064-wtstatus-pv2.sh
t/t7610-mergetool.sh
t/t9902-completion.sh

Simple merge
Simple merge
index 51d7d40ec1c65e25706dd015adda6f9566415653,9e911e0054c53db06ae83b9fac00d2fbe623fec0..abdda360d5258daf5c97184c900ace674534537f
@@@ -1,18 -1,11 +1,21 @@@
  #!/bin/sh
  
  test_description='test git rev-parse'
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
  . ./test-lib.sh
  
 +test_one () {
 +      dir="$1" &&
 +      expect="$2" &&
 +      shift &&
 +      shift &&
 +      echo "$expect" >expect &&
 +      git -C "$dir" rev-parse "$@" >actual &&
 +      test_cmp expect actual
 +}
 +
  # usage: [options] label is-bare is-inside-git is-inside-work prefix git-dir absolute-git-dir
  test_rev_parse () {
        d=
Simple merge
Simple merge
index e4521b7b97a5afebfab0fe7c14243c8e4092d682,17421a368df4e203c345cdc59545f60764e359e7..87a42864145f85ed539b9d1cbb9a3dd5f71fc708
@@@ -99,17 -102,4 +102,17 @@@ test_expect_success 'create path with @
  check "@:normal" blob content
  check "@:fun@ny" blob content
  
-       git checkout -B newbranch master &&
 +test_expect_success '@{1} works with only one reflog entry' '
-       git checkout -B newbranch master &&
++      git checkout -B newbranch main &&
 +      git reflog expire --expire=now refs/heads/newbranch &&
 +      git commit --allow-empty -m "first after expiration" &&
 +      test_cmp_rev newbranch~ newbranch@{1}
 +'
 +
 +test_expect_success '@{0} works with empty reflog' '
++      git checkout -B newbranch main &&
 +      git reflog expire --expire=now refs/heads/newbranch &&
 +      test_cmp_rev newbranch newbranch@{0}
 +'
 +
  test_done
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index c5e5e0da3feef439415dbf9cfd235140eba7d0d9,af67c46cd312c03aa6cfe0425fc1ce4226de948d..66630c8413d5008caa53a2e3c36c652e61937cc5
@@@ -313,63 -316,9 +316,63 @@@ test_expect_success 'multiple files' 
        ls patches/0001-Side-changes-1.patch patches/0002-Side-changes-2.patch patches/0003-Side-changes-3-with-n-backslash-n-in-it.patch
  '
  
 +test_expect_success 'filename length limit' '
 +      test_when_finished "rm -f 000*" &&
 +      rm -rf 000[1-9]-*.patch &&
 +      for len in 15 25 35
 +      do
 +              git format-patch --filename-max-length=$len -3 side &&
 +              max=$(
 +                      for patch in 000[1-9]-*.patch
 +                      do
 +                              echo "$patch" | wc -c
 +                      done |
 +                      sort -nr |
 +                      head -n 1
 +              ) &&
 +              test $max -le $len || return 1
 +      done
 +'
 +
 +test_expect_success 'filename length limit from config' '
 +      test_when_finished "rm -f 000*" &&
 +      rm -rf 000[1-9]-*.patch &&
 +      for len in 15 25 35
 +      do
 +              git -c format.filenameMaxLength=$len format-patch -3 side &&
 +              max=$(
 +                      for patch in 000[1-9]-*.patch
 +                      do
 +                              echo "$patch" | wc -c
 +                      done |
 +                      sort -nr |
 +                      head -n 1
 +              ) &&
 +              test $max -le $len || return 1
 +      done
 +'
 +
 +test_expect_success 'filename limit applies only to basename' '
 +      test_when_finished "rm -rf patches/" &&
 +      rm -rf patches/ &&
 +      for len in 15 25 35
 +      do
 +              git format-patch -o patches --filename-max-length=$len -3 side &&
 +              max=$(
 +                      for patch in patches/000[1-9]-*.patch
 +                      do
 +                              echo "${patch#patches/}" | wc -c
 +                      done |
 +                      sort -nr |
 +                      head -n 1
 +              ) &&
 +              test $max -le $len || return 1
 +      done
 +'
 +
  test_expect_success 'reroll count' '
        rm -fr patches &&
-       git format-patch -o patches --cover-letter --reroll-count 4 master..side >list &&
+       git format-patch -o patches --cover-letter --reroll-count 4 main..side >list &&
        ! grep -v "^patches/v4-000[0-3]-" list &&
        sed -n -e "/^Subject: /p" $(cat list) >subjects &&
        ! grep -v "^Subject: \[PATCH v4 [0-3]/3\] " subjects
Simple merge
Simple merge
index 543cb4c6a87781916b9fe86fbc1fd3decad6a9e4,89c868864710013f387521445d7eb2490676b486..8b01793845ff65b7e3244259842af3d3de63e0a1
@@@ -36,11 -36,9 +36,11 @@@ relationship between packs and objects 
  
  . ./test-lib.sh
  
- master_repo=master.git
+ main_repo=main.git
  shared_repo=shared.git
  
 +git_pack_redundant='git pack-redundant --i-still-use-this'
 +
  # Create commits in <repo> and assign each commit's oid to shell variables
  # given in the arguments (A, B, and C). E.g.:
  #
@@@ -109,34 -107,25 +109,34 @@@ format_packfiles () 
        sort
  }
  
- test_expect_success 'setup master repo' '
-       git init --bare "$master_repo" &&
-       create_commits_in "$master_repo" A B C D E F G H I J K L M N O P Q R
+ test_expect_success 'setup main repo' '
+       git init --bare "$main_repo" &&
+       create_commits_in "$main_repo" A B C D E F G H I J K L M N O P Q R
  '
  
 +test_expect_success 'master: pack-redundant works with no packfile' '
 +      (
 +              cd "$master_repo" &&
 +              cat >expect <<-EOF &&
 +                      fatal: Zero packs found!
 +                      EOF
 +              test_must_fail $git_pack_redundant --all >actual 2>&1 &&
 +              test_cmp expect actual
 +      )
 +'
 +
  #############################################################################
  # Chart of packs and objects for this test case
  #
  #         | T A B C D E F G H I J K L M N O P Q R
  #     ----+--------------------------------------
  #     P1  | x x x x x x x                       x
 -#     P2  |     x x x x   x x x
 -#     P3  |             x     x x x x x
  #     ----+--------------------------------------
 -#     ALL | x x x x x x x x x x x x x x         x
 +#     ALL | x x x x x x x                       x
  #
  #############################################################################
- test_expect_success 'master: pack-redundant works with one packfile' '
-       create_pack_in "$master_repo" P1 <<-EOF &&
 -test_expect_success 'main: no redundant for pack 1, 2, 3' '
++test_expect_success 'main: pack-redundant works with one packfile' '
+       create_pack_in "$main_repo" P1 <<-EOF &&
                $T
                $A
                $B
                $F
                $R
                EOF
-               cd "$master_repo" &&
 +      (
- test_expect_success 'master: no redundant for pack 1, 2, 3' '
-       create_pack_in "$master_repo" P2 <<-EOF &&
++              cd "$main_repo" &&
 +              $git_pack_redundant --all >out &&
 +              test_must_be_empty out
 +      )
 +'
 +
 +#############################################################################
 +# Chart of packs and objects for this test case
 +#
 +#         | T A B C D E F G H I J K L M N O P Q R
 +#     ----+--------------------------------------
 +#     P1  | x x x x x x x                       x
 +#     P2  |     x x x x   x x x
 +#     P3  |             x     x x x x x
 +#     ----+--------------------------------------
 +#     ALL | x x x x x x x x x x x x x x         x
 +#
 +#############################################################################
++test_expect_success 'main: no redundant for pack 1, 2, 3' '
+       create_pack_in "$main_repo" P2 <<-EOF &&
                $B
                $C
                $D
                $M
                EOF
        (
-               cd "$master_repo" &&
+               cd "$main_repo" &&
 -              git pack-redundant --all >out &&
 +              $git_pack_redundant --all >out &&
                test_must_be_empty out
        )
  '
@@@ -312,12 -281,12 +312,12 @@@ test_expect_success 'main: clean loose 
        )
  '
  
- test_expect_success 'master: remove redundant packs and pass fsck' '
+ test_expect_success 'main: remove redundant packs and pass fsck' '
        (
-               cd "$master_repo" &&
+               cd "$main_repo" &&
 -              git pack-redundant --all | xargs rm &&
 +              $git_pack_redundant --all | xargs rm &&
                git fsck &&
 -              git pack-redundant --all >out &&
 +              $git_pack_redundant --all >out &&
                test_must_be_empty out
        )
  '
Simple merge
Simple merge
Simple merge
index 3ed121d0cefe95e18fe4af3489dbbe909fa4a212,b037439c497bb90875be5161cfc5c4a7f88b1a3f..15262b41929d81fe51ea03d1aba298860ca346b3
@@@ -436,83 -439,77 +439,76 @@@ test_expect_success 'push ref expressio
  
  '
  
 -test_expect_success 'push with HEAD' '
 -
 -      mk_test testrepo heads/main &&
 -      git checkout main &&
 -      git push testrepo HEAD &&
 -      check_push_result testrepo $the_commit heads/main
 -
 -'
 -
 -test_expect_success 'push with HEAD nonexisting at remote' '
 -
 -      mk_test testrepo heads/main &&
 -      git checkout -b local main &&
 -      git push testrepo HEAD &&
 -      check_push_result testrepo $the_commit heads/local
 -'
 -
 -test_expect_success 'push with +HEAD' '
 +for head in HEAD @
 +do
  
 -      mk_test testrepo heads/main &&
 -      git checkout main &&
 -      git branch -D local &&
 -      git checkout -b local &&
 -      git push testrepo main local &&
 -      check_push_result testrepo $the_commit heads/main &&
 -      check_push_result testrepo $the_commit heads/local &&
 +      test_expect_success "push with $head" '
-               mk_test testrepo heads/master &&
-               git checkout master &&
++              mk_test testrepo heads/main &&
++              git checkout main &&
 +              git push testrepo $head &&
-               check_push_result testrepo $the_commit heads/master
++              check_push_result testrepo $the_commit heads/main
 +      '
  
 -      # Without force rewinding should fail
 -      git reset --hard HEAD^ &&
 -      test_must_fail git push testrepo HEAD &&
 -      check_push_result testrepo $the_commit heads/local &&
 +      test_expect_success "push with $head nonexisting at remote" '
-               mk_test testrepo heads/master &&
-               git checkout -b local master &&
-               test_when_finished "git checkout master; git branch -D local" &&
++              mk_test testrepo heads/main &&
++              git checkout -b local main &&
++              test_when_finished "git checkout main; git branch -D local" &&
 +              git push testrepo $head &&
 +              check_push_result testrepo $the_commit heads/local
 +      '
  
 -      # With force rewinding should succeed
 -      git push testrepo +HEAD &&
 -      check_push_result testrepo $the_first_commit heads/local
 +      test_expect_success "push with +$head" '
-               mk_test testrepo heads/master &&
-               git checkout -b local master &&
-               test_when_finished "git checkout master; git branch -D local" &&
-               git push testrepo master local &&
-               check_push_result testrepo $the_commit heads/master &&
++              mk_test testrepo heads/main &&
++              git checkout -b local main &&
++              test_when_finished "git checkout main; git branch -D local" &&
++              git push testrepo main local &&
++              check_push_result testrepo $the_commit heads/main &&
 +              check_push_result testrepo $the_commit heads/local &&
  
 -'
 +              # Without force rewinding should fail
 +              git reset --hard $head^ &&
 +              test_must_fail git push testrepo $head &&
 +              check_push_result testrepo $the_commit heads/local &&
  
 -test_expect_success 'push HEAD with non-existent, incomplete dest' '
 +              # With force rewinding should succeed
 +              git push testrepo +$head &&
 +              check_push_result testrepo $the_first_commit heads/local
 +      '
  
 -      mk_test testrepo &&
 -      git checkout main &&
 -      git push testrepo HEAD:branch &&
 -      check_push_result testrepo $the_commit heads/branch
 +      test_expect_success "push $head with non-existent, incomplete dest" '
 +              mk_test testrepo &&
-               git checkout master &&
++              git checkout main &&
 +              git push testrepo $head:branch &&
 +              check_push_result testrepo $the_commit heads/branch
  
 -'
 +      '
  
 -test_expect_success 'push with config remote.*.push = HEAD' '
 +      test_expect_success "push with config remote.*.push = $head" '
 +              mk_test testrepo heads/local &&
-               git checkout master &&
++              git checkout main &&
 +              git branch -f local $the_commit &&
 +              test_when_finished "git branch -D local" &&
 +              (
 +                      cd testrepo &&
 +                      git checkout local &&
 +                      git reset --hard $the_first_commit
 +              ) &&
 +              test_config remote.there.url testrepo &&
 +              test_config remote.there.push $head &&
-               test_config branch.master.remote there &&
++              test_config branch.main.remote there &&
 +              git push &&
-               check_push_result testrepo $the_commit heads/master &&
++              check_push_result testrepo $the_commit heads/main &&
 +              check_push_result testrepo $the_first_commit heads/local
 +      '
  
 -      mk_test testrepo heads/local &&
 -      git checkout main &&
 -      git branch -f local $the_commit &&
 -      (
 -              cd testrepo &&
 -              git checkout local &&
 -              git reset --hard $the_first_commit
 -      ) &&
 -      test_config remote.there.url testrepo &&
 -      test_config remote.there.push HEAD &&
 -      test_config branch.main.remote there &&
 -      git push &&
 -      check_push_result testrepo $the_commit heads/main &&
 -      check_push_result testrepo $the_first_commit heads/local
 -'
 +done
  
  test_expect_success 'push with remote.pushdefault' '
-       mk_test up_repo heads/master &&
-       mk_test down_repo heads/master &&
+       mk_test up_repo heads/main &&
+       mk_test down_repo heads/main &&
        test_config remote.up.url up_repo &&
        test_config remote.down.url down_repo &&
-       test_config branch.master.remote up &&
+       test_config branch.main.remote up &&
        test_config remote.pushdefault down &&
        test_config push.default matching &&
        git push &&
Simple merge
Simple merge
index 37fd06b0be8f488889554696fceb7d0be615f89f,d6a75964d8428f3667d498338326cfacf1565421..29537f4798ef85845f3b2f267abf227d9bd1fe3c
@@@ -144,50 -136,6 +144,50 @@@ test_expect_success 'pull --rebase --re
        test_i18ngrep "locally recorded submodule modifications" err
  '
  
-       git -C superclone pull --rebase --recurse-submodules origin master
 +test_expect_success 'pull --rebase --recurse-submodules (no submodule changes, no fork-point)' '
 +      # This tests the following scenario :
 +      # - local submodule does not have new commits
 +      # - local superproject has new commits that *do not* change the submodule pointer
 +      # - upstream superproject has new commits that *do not* change the submodule pointer
 +      # - local superproject branch has no fork-point with its remote-tracking counter-part
 +
 +      # create upstream superproject
 +      test_create_repo submodule &&
 +      test_commit -C submodule first_in_sub &&
 +
 +      test_create_repo superprojet &&
 +      test_commit -C superprojet first_in_super &&
 +      git -C superprojet submodule add ../submodule &&
 +      git -C superprojet commit -m "add submodule" &&
 +      test_commit -C superprojet third_in_super &&
 +
 +      # clone superproject
 +      git clone --recurse-submodules superprojet superclone &&
 +
 +      # add commits upstream
 +      test_commit -C superprojet fourth_in_super &&
 +
 +      # create topic branch in clone, not based on any remote-tracking branch
 +      git -C superclone checkout -b feat HEAD~1 &&
 +      test_commit -C superclone first_on_feat &&
++      git -C superclone pull --rebase --recurse-submodules origin HEAD
 +'
 +
 +# NOTE:
 +#
 +# This test is particular because there is only a single commit in the upstream superproject
 +# 'parent' (which adds the submodule 'a-submodule'). The clone of the superproject
 +# ('child') hard-resets its branch to a new root commit with the same tree as the one
 +# from the upstream superproject, so that its branch has no merge-base with its
 +# remote-tracking counterpart, and then calls 'git pull --recurse-submodules --rebase'.
 +# The result is that the local branch is reset to the remote-tracking branch (as it was
 +# originally before the hard-reset).
 +
 +# The only commit in the range generated by 'submodule.c::submodule_touches_in_range' and
 +# passed to 'submodule.c::collect_changed_submodules' is the new (regenerated) initial commit,
 +# which adds the submodule.
 +# However, 'submodule_touches_in_range' does not error (even though this commit adds the submodule)
 +# because 'combine-diff.c::diff_tree_combined' returns early, as the initial commit has no parents.
  test_expect_success 'branch has no merge base with remote-tracking counterpart' '
        rm -rf parent child &&
  
  
        git clone parent child &&
  
-       # Reset master so that it has no merge base with
-       # refs/remotes/origin/master.
 -      # Reset main so that it has no merge base with
 -      # refs/remotes/origin/main.
++      # Reset the current branch so that it has no merge base with
++      # the remote-tracking branch.
        OTHER=$(git -C child commit-tree -m bar \
                $(git -C child rev-parse HEAD^{tree})) &&
        git -C child reset --hard "$OTHER" &&
Simple merge
Simple merge
Simple merge
index f79df8b6d197f98094d1e5c16d110f52ad285ea2,6eddbbcc9f9303904f15a689a85e9c4a8b054a67..54b0a6f5f8a4b2996bd49ab3251837967f8fd57a
@@@ -7,13 -7,10 +7,16 @@@
  
  test_description='--graph and simplified history'
  
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
  . ./test-lib.sh
 +. "$TEST_DIRECTORY"/lib-log-graph.sh
 +
 +check_graph () {
 +      cat >expect &&
 +      lib_test_cmp_graph --format=%s "$@"
 +}
  
  test_expect_success 'set up rev-list --graph test' '
        # 3 commits on branch A
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge