Merge branch 'jc/t3404-one-shot-export-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 24 Jul 2018 21:50:49 +0000 (14:50 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 Jul 2018 21:50:49 +0000 (14:50 -0700)
Correct a broken use of "VAR=VAL shell_func" in a test.

* jc/t3404-one-shot-export-fix:
t3404: fix use of "VAR=VAL cmd" with a shell function

1  2 
t/t3404-rebase-interactive.sh
index c5d39e2b23f0f257af1553a9f50efc3f6cf0ad5e,489b6196e0748997f0e06ff36bf07a6e0a1de4e5..01616901bdc868619fee8e28dce14649bd2661db
@@@ -225,14 -225,6 +225,14 @@@ test_expect_success 'stop on conflictin
        test 0 = $(grep -c "^[^#]" < .git/rebase-merge/git-rebase-todo)
  '
  
 +test_expect_success 'show conflicted patch' '
 +      GIT_TRACE=1 git rebase --show-current-patch >/dev/null 2>stderr &&
 +      grep "show.*REBASE_HEAD" stderr &&
 +      # the original stopped-sha1 is abbreviated
 +      stopped_sha1="$(git rev-parse $(cat ".git/rebase-merge/stopped-sha"))" &&
 +      test "$(git rev-parse REBASE_HEAD)" = "$stopped_sha1"
 +'
 +
  test_expect_success 'abort' '
        git rebase --abort &&
        test $(git rev-parse new-branch1) = $(git rev-parse HEAD) &&
@@@ -264,11 -256,18 +264,18 @@@ test_expect_success 'retain authorship
  '
  
  test_expect_success 'retain authorship w/ conflicts' '
+       oGIT_AUTHOR_NAME=$GIT_AUTHOR_NAME &&
+       test_when_finished "GIT_AUTHOR_NAME=\$oGIT_AUTHOR_NAME" &&
        git reset --hard twerp &&
        test_commit a conflict a conflict-a &&
        git reset --hard twerp &&
-       GIT_AUTHOR_NAME=AttributeMe \
+       GIT_AUTHOR_NAME=AttributeMe &&
+       export GIT_AUTHOR_NAME &&
        test_commit b conflict b conflict-b &&
+       GIT_AUTHOR_NAME=$oGIT_AUTHOR_NAME &&
        set_fake_editor &&
        test_must_fail git rebase -i conflict-a &&
        echo resolved >conflict &&
@@@ -461,10 -460,6 +468,10 @@@ test_expect_success C_LOCALE_OUTPUT 'sq
                git rebase -i $base &&
        git cat-file commit HEAD | sed -e 1,/^\$/d > actual-squash-fixup &&
        test_cmp expect-squash-fixup actual-squash-fixup &&
 +      git cat-file commit HEAD@{2} |
 +              grep "^# This is a combination of 3 commits\."  &&
 +      git cat-file commit HEAD@{3} |
 +              grep "^# This is a combination of 2 commits\."  &&
        git checkout to-be-rebased &&
        git branch -D squash-fixup
  '
@@@ -553,16 -548,15 +560,16 @@@ test_expect_success '--continue tries t
  '
  
  test_expect_success 'aborted --continue does not squash commits after "edit"' '
 +      test_when_finished "git rebase --abort" &&
        old=$(git rev-parse HEAD) &&
        test_tick &&
        set_fake_editor &&
        FAKE_LINES="edit 1" git rebase -i HEAD^ &&
        echo "edited again" > file7 &&
        git add file7 &&
 -      test_must_fail env FAKE_COMMIT_MESSAGE=" " git rebase --continue &&
 -      test $old = $(git rev-parse HEAD) &&
 -      git rebase --abort
 +      echo all the things >>conflict &&
 +      test_must_fail git rebase --continue &&
 +      test $old = $(git rev-parse HEAD)
  '
  
  test_expect_success 'auto-amend only edited commits after "edit"' '
@@@ -712,13 -706,13 +719,13 @@@ test_expect_success 'rebase -i continu
  test_expect_success 'avoid unnecessary reset' '
        git checkout master &&
        git reset --hard &&
 -      test-chmtime =123456789 file3 &&
 +      test-tool chmtime =123456789 file3 &&
        git update-index --refresh &&
        HEAD=$(git rev-parse HEAD) &&
        set_fake_editor &&
        git rebase -i HEAD~4 &&
        test $HEAD = $(git rev-parse HEAD) &&
 -      MTIME=$(test-chmtime -v +0 file3 | sed 's/[^0-9].*$//') &&
 +      MTIME=$(test-tool chmtime --get file3) &&
        test 123456789 = $MTIME
  '
  
@@@ -928,8 -922,10 +935,8 @@@ test_expect_success 'rebase --exec work
  test_expect_success 'rebase -i --exec without <CMD>' '
        git reset --hard execute &&
        set_fake_editor &&
 -      test_must_fail git rebase -i --exec 2>tmp &&
 -      sed -e "1d" tmp >actual &&
 -      test_must_fail git rebase -h >expected &&
 -      test_cmp expected actual &&
 +      test_must_fail git rebase -i --exec 2>actual &&
 +      test_i18ngrep "requires a value" actual &&
        git checkout master
  '
  
@@@ -972,45 -968,7 +979,45 @@@ test_expect_success 'rebase -i --root f
        test 0 = $(git cat-file commit HEAD | grep -c ^parent\ )
  '
  
 +test_expect_success 'rebase -i --root reword root commit' '
 +      test_when_finished "test_might_fail git rebase --abort" &&
 +      git checkout -b reword-root-branch master &&
 +      set_fake_editor &&
 +      FAKE_LINES="reword 1 2" FAKE_COMMIT_MESSAGE="A changed" \
 +      git rebase -i --root &&
 +      git show HEAD^ | grep "A changed" &&
 +      test -z "$(git show -s --format=%p HEAD^)"
 +'
 +
 +test_expect_success 'rebase -i --root when root has untracked file confilct' '
 +      test_when_finished "reset_rebase" &&
 +      git checkout -b failing-root-pick A &&
 +      echo x >file2 &&
 +      git rm file1 &&
 +      git commit -m "remove file 1 add file 2" &&
 +      echo z >file1 &&
 +      set_fake_editor &&
 +      test_must_fail env FAKE_LINES="1 2" git rebase -i --root &&
 +      rm file1 &&
 +      git rebase --continue &&
 +      test "$(git log -1 --format=%B)" = "remove file 1 add file 2" &&
 +      test "$(git rev-list --count HEAD)" = 2
 +'
 +
 +test_expect_success 'rebase -i --root reword root when root has untracked file conflict' '
 +      test_when_finished "reset_rebase" &&
 +      echo z>file1 &&
 +      set_fake_editor &&
 +      test_must_fail env FAKE_LINES="reword 1 2" \
 +              FAKE_COMMIT_MESSAGE="Modified A" git rebase -i --root &&
 +      rm file1 &&
 +      FAKE_COMMIT_MESSAGE="Reworded A" git rebase --continue &&
 +      test "$(git log -1 --format=%B HEAD^)" = "Reworded A" &&
 +      test "$(git rev-list --count HEAD)" = 2
 +'
 +
  test_expect_success C_LOCALE_OUTPUT 'rebase --edit-todo does not work on non-interactive rebase' '
 +      git checkout reword-root-branch &&
        git reset --hard &&
        git checkout conflict-branch &&
        set_fake_editor &&
@@@ -1243,6 -1201,10 +1250,6 @@@ test_expect_success 'drop' 
        test A = $(git cat-file commit HEAD^^ | sed -ne \$p)
  '
  
 -cat >expect <<EOF
 -Successfully rebased and updated refs/heads/missing-commit.
 -EOF
 -
  test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' '
        test_config rebase.missingCommitsCheck ignore &&
        rebase_setup_and_clean missing-commit &&
        FAKE_LINES="1 2 3 4" \
                git rebase -i --root 2>actual &&
        test D = $(git cat-file commit HEAD | sed -ne \$p) &&
 -      test_i18ncmp expect actual
 +      test_i18ngrep \
 +              "Successfully rebased and updated refs/heads/missing-commit" \
 +              actual
  '
  
  cat >expect <<EOF
@@@ -1264,24 -1224,15 +1271,24 @@@ To avoid this message, use "drop" to ex
  Use 'git config rebase.missingCommitsCheck' to change the level of warnings.
  The possible behaviours are: ignore, warn, error.
  
 +Rebasing (1/4)
 +Rebasing (2/4)
 +Rebasing (3/4)
 +Rebasing (4/4)
  Successfully rebased and updated refs/heads/missing-commit.
  EOF
  
 +cr_to_nl () {
 +      tr '\015' '\012'
 +}
 +
  test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '
        test_config rebase.missingCommitsCheck warn &&
        rebase_setup_and_clean missing-commit &&
        set_fake_editor &&
        FAKE_LINES="1 2 3 4" \
 -              git rebase -i --root 2>actual &&
 +              git rebase -i --root 2>actual.2 &&
 +      cr_to_nl <actual.2 >actual &&
        test_i18ncmp expect actual &&
        test D = $(git cat-file commit HEAD | sed -ne \$p)
  '
@@@ -1392,16 -1343,6 +1399,16 @@@ test_expect_success 'editor saves as CR
  
  SQ="'"
  test_expect_success 'rebase -i --gpg-sign=<key-id>' '
 +      test_when_finished "test_might_fail git rebase --abort" &&
 +      set_fake_editor &&
 +      FAKE_LINES="edit 1" git rebase -i --gpg-sign="\"S I Gner\"" HEAD^ \
 +              >out 2>err &&
 +      test_i18ngrep "$SQ-S\"S I Gner\"$SQ" err
 +'
 +
 +test_expect_success 'rebase -i --gpg-sign=<key-id> overrides commit.gpgSign' '
 +      test_when_finished "test_might_fail git rebase --abort" &&
 +      test_config commit.gpgsign true &&
        set_fake_editor &&
        FAKE_LINES="edit 1" git rebase -i --gpg-sign="\"S I Gner\"" HEAD^ \
                >out 2>err &&