Merge branch 'jc/t3404-one-shot-export-fix' into es/test-lint-one-shot-export
authorJunio C Hamano <gitster@pobox.com>
Mon, 16 Jul 2018 21:54:55 +0000 (14:54 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Jul 2018 21:54:55 +0000 (14:54 -0700)
* 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 352a52e59d1a25d6fe50c5001ba3c84e2fc4a30c,489b6196e0748997f0e06ff36bf07a6e0a1de4e5..449401e859a2e7205b10b2a765b4be7b4848db09
@@@ -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
  '
@@@ -711,13 -706,13 +718,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
  '
  
@@@ -927,8 -922,10 +934,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
  '
  
@@@ -971,16 -968,6 +978,16 @@@ 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 C_LOCALE_OUTPUT 'rebase --edit-todo does not work on non-interactive rebase' '
        git reset --hard &&
        git checkout conflict-branch &&
@@@ -1214,6 -1201,10 +1221,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
@@@ -1235,24 -1224,15 +1242,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)
  '
@@@ -1363,16 -1343,6 +1370,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 &&