Merge branch 'yd/use-test-config-unconfig'

Bulk-update of the test suite.

* yd/use-test-config-unconfig:
  t5520: use test_config to set/unset git config variables (leftover bits)
  t7600: use test_config to set/unset git config variables
  t7502: remove clear_config
  t7502: use test_config to set/unset git config variables
  t9500: use test_config to set/unset git config variables
  t7508: use test_config to set/unset git config variables
  t7500: use test_config to set/unset git config variables
  t5541: use test_config to set/unset git config variables
  t5520: use test_config to set/unset git config variables
  t4202: use test_config/test_unconfig to set/unset git config variables
  t4034: use test_config/test_unconfig to set/unset git config variables
  t4304: use test_config to set/unset git config variables
  t3400: use test_config to set/unset git config variables
maint
Junio C Hamano 2013-03-28 14:38:27 -07:00
commit 631bc94e67
11 changed files with 75 additions and 142 deletions

View File

@ -138,8 +138,7 @@ test_expect_success 'rebase a single mode change' '
' '


test_expect_success 'rebase is not broken by diff.renames' ' test_expect_success 'rebase is not broken by diff.renames' '
git config diff.renames copies && test_config diff.renames copies &&
test_when_finished "git config --unset diff.renames" &&
git checkout filemove && git checkout filemove &&
GIT_TRACE=1 git rebase force-3way GIT_TRACE=1 git rebase force-3way
' '

View File

@ -937,8 +937,7 @@ test_expect_success 'rebase --edit-todo can be used to modify todo' '
test_expect_success 'rebase -i respects core.commentchar' ' test_expect_success 'rebase -i respects core.commentchar' '
git reset --hard && git reset --hard &&
git checkout E^0 && git checkout E^0 &&
git config core.commentchar "\\" && test_config core.commentchar "\\" &&
test_when_finished "git config --unset core.commentchar" &&
write_script remove-all-but-first.sh <<-\EOF && write_script remove-all-but-first.sh <<-\EOF &&
sed -e "2,\$s/^/\\\\/" "$1" >"$1.tmp" && sed -e "2,\$s/^/\\\\/" "$1" >"$1.tmp" &&
mv "$1.tmp" "$1" mv "$1.tmp" "$1"

View File

@ -230,7 +230,7 @@ test_expect_success '.gitattributes override config' '
' '


test_expect_success 'setup: remove diff driver regex' ' test_expect_success 'setup: remove diff driver regex' '
test_might_fail git config --unset diff.testdriver.wordRegex test_unconfig diff.testdriver.wordRegex
' '


test_expect_success 'use configured regex' ' test_expect_success 'use configured regex' '
@ -335,8 +335,7 @@ test_expect_success 'word-diff with diff.sbe' '


c c
EOF EOF
test_when_finished "git config --unset diff.suppress-blank-empty" && test_config diff.suppress-blank-empty true &&
git config diff.suppress-blank-empty true &&
word_diff --word-diff=plain word_diff --word-diff=plain
' '


@ -368,7 +367,7 @@ test_expect_success 'setup history with two files' '


test_expect_success 'wordRegex for the first file does not apply to the second' ' test_expect_success 'wordRegex for the first file does not apply to the second' '
echo "*.tex diff=tex" >.gitattributes && echo "*.tex diff=tex" >.gitattributes &&
git config diff.tex.wordRegex "[a-z]+|." && test_config diff.tex.wordRegex "[a-z]+|." &&
cat >expect <<-\EOF && cat >expect <<-\EOF &&
diff --git a/a.tex b/a.tex diff --git a/a.tex b/a.tex
--- a/a.tex --- a/a.tex

View File

@ -419,8 +419,6 @@ test_expect_success 'log --graph with merge' '
' '


test_expect_success 'log.decorate configuration' ' test_expect_success 'log.decorate configuration' '
test_might_fail git config --unset-all log.decorate &&

git log --oneline >expect.none && git log --oneline >expect.none &&
git log --oneline --decorate >expect.short && git log --oneline --decorate >expect.short &&
git log --oneline --decorate=full >expect.full && git log --oneline --decorate=full >expect.full &&
@ -429,8 +427,7 @@ test_expect_success 'log.decorate configuration' '
git log --oneline >actual && git log --oneline >actual &&
test_cmp expect.short actual && test_cmp expect.short actual &&


git config --unset-all log.decorate && test_config log.decorate true &&
git config log.decorate true &&
git log --oneline >actual && git log --oneline >actual &&
test_cmp expect.short actual && test_cmp expect.short actual &&
git log --oneline --decorate=full >actual && git log --oneline --decorate=full >actual &&
@ -438,8 +435,7 @@ test_expect_success 'log.decorate configuration' '
git log --oneline --decorate=no >actual && git log --oneline --decorate=no >actual &&
test_cmp expect.none actual && test_cmp expect.none actual &&


git config --unset-all log.decorate && test_config log.decorate no &&
git config log.decorate no &&
git log --oneline >actual && git log --oneline >actual &&
test_cmp expect.none actual && test_cmp expect.none actual &&
git log --oneline --decorate >actual && git log --oneline --decorate >actual &&
@ -447,8 +443,7 @@ test_expect_success 'log.decorate configuration' '
git log --oneline --decorate=full >actual && git log --oneline --decorate=full >actual &&
test_cmp expect.full actual && test_cmp expect.full actual &&


git config --unset-all log.decorate && test_config log.decorate 1 &&
git config log.decorate 1 &&
git log --oneline >actual && git log --oneline >actual &&
test_cmp expect.short actual && test_cmp expect.short actual &&
git log --oneline --decorate=full >actual && git log --oneline --decorate=full >actual &&
@ -456,8 +451,7 @@ test_expect_success 'log.decorate configuration' '
git log --oneline --decorate=no >actual && git log --oneline --decorate=no >actual &&
test_cmp expect.none actual && test_cmp expect.none actual &&


git config --unset-all log.decorate && test_config log.decorate short &&
git config log.decorate short &&
git log --oneline >actual && git log --oneline >actual &&
test_cmp expect.short actual && test_cmp expect.short actual &&
git log --oneline --no-decorate >actual && git log --oneline --no-decorate >actual &&
@ -465,8 +459,7 @@ test_expect_success 'log.decorate configuration' '
git log --oneline --decorate=full >actual && git log --oneline --decorate=full >actual &&
test_cmp expect.full actual && test_cmp expect.full actual &&


git config --unset-all log.decorate && test_config log.decorate full &&
git config log.decorate full &&
git log --oneline >actual && git log --oneline >actual &&
test_cmp expect.full actual && test_cmp expect.full actual &&
git log --oneline --no-decorate >actual && git log --oneline --no-decorate >actual &&
@ -474,16 +467,15 @@ test_expect_success 'log.decorate configuration' '
git log --oneline --decorate >actual && git log --oneline --decorate >actual &&
test_cmp expect.short actual test_cmp expect.short actual


git config --unset-all log.decorate && test_unconfig log.decorate &&
git log --pretty=raw >expect.raw && git log --pretty=raw >expect.raw &&
git config log.decorate full && test_config log.decorate full &&
git log --pretty=raw >actual && git log --pretty=raw >actual &&
test_cmp expect.raw actual test_cmp expect.raw actual


' '


test_expect_success 'reflog is expected format' ' test_expect_success 'reflog is expected format' '
test_might_fail git config --remove-section log &&
git log -g --abbrev-commit --pretty=oneline >expect && git log -g --abbrev-commit --pretty=oneline >expect &&
git reflog >actual && git reflog >actual &&
test_cmp expect actual test_cmp expect actual
@ -496,10 +488,6 @@ test_expect_success 'whatchanged is expected format' '
' '


test_expect_success 'log.abbrevCommit configuration' ' test_expect_success 'log.abbrevCommit configuration' '
test_when_finished "git config --unset log.abbrevCommit" &&

test_might_fail git config --unset log.abbrevCommit &&

git log --abbrev-commit >expect.log.abbrev && git log --abbrev-commit >expect.log.abbrev &&
git log --no-abbrev-commit >expect.log.full && git log --no-abbrev-commit >expect.log.full &&
git log --pretty=raw >expect.log.raw && git log --pretty=raw >expect.log.raw &&
@ -508,7 +496,7 @@ test_expect_success 'log.abbrevCommit configuration' '
git whatchanged --abbrev-commit >expect.whatchanged.abbrev && git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
git whatchanged --no-abbrev-commit >expect.whatchanged.full && git whatchanged --no-abbrev-commit >expect.whatchanged.full &&


git config log.abbrevCommit true && test_config log.abbrevCommit true &&


git log >actual && git log >actual &&
test_cmp expect.log.abbrev actual && test_cmp expect.log.abbrev actual &&

View File

@ -96,8 +96,7 @@ test_expect_success '--rebase' '
' '
test_expect_success 'pull.rebase' ' test_expect_success 'pull.rebase' '
git reset --hard before-rebase && git reset --hard before-rebase &&
git config --bool pull.rebase true && test_config pull.rebase true &&
test_when_finished "git config --unset pull.rebase" &&
git pull . copy && git pull . copy &&
test $(git rev-parse HEAD^) = $(git rev-parse copy) && test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
test new = $(git show HEAD:file2) test new = $(git show HEAD:file2)
@ -105,8 +104,7 @@ test_expect_success 'pull.rebase' '


test_expect_success 'branch.to-rebase.rebase' ' test_expect_success 'branch.to-rebase.rebase' '
git reset --hard before-rebase && git reset --hard before-rebase &&
git config --bool branch.to-rebase.rebase true && test_config branch.to-rebase.rebase true &&
test_when_finished "git config --unset branch.to-rebase.rebase" &&
git pull . copy && git pull . copy &&
test $(git rev-parse HEAD^) = $(git rev-parse copy) && test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
test new = $(git show HEAD:file2) test new = $(git show HEAD:file2)
@ -114,10 +112,8 @@ test_expect_success 'branch.to-rebase.rebase' '


test_expect_success 'branch.to-rebase.rebase should override pull.rebase' ' test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '
git reset --hard before-rebase && git reset --hard before-rebase &&
git config --bool pull.rebase true && test_config pull.rebase true &&
test_when_finished "git config --unset pull.rebase" && test_config branch.to-rebase.rebase false &&
git config --bool branch.to-rebase.rebase false &&
test_when_finished "git config --unset branch.to-rebase.rebase" &&
git pull . copy && git pull . copy &&
test $(git rev-parse HEAD^) != $(git rev-parse copy) && test $(git rev-parse HEAD^) != $(git rev-parse copy) &&
test new = $(git show HEAD:file2) test new = $(git show HEAD:file2)
@ -171,9 +167,9 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '
git update-ref refs/remotes/me/copy copy^ && git update-ref refs/remotes/me/copy copy^ &&
COPY=$(git rev-parse --verify me/copy) && COPY=$(git rev-parse --verify me/copy) &&
git rebase --onto $COPY copy && git rebase --onto $COPY copy &&
git config branch.to-rebase.remote me && test_config branch.to-rebase.remote me &&
git config branch.to-rebase.merge refs/heads/copy && test_config branch.to-rebase.merge refs/heads/copy &&
git config branch.to-rebase.rebase true && test_config branch.to-rebase.rebase true &&
echo dirty >> file && echo dirty >> file &&
git add file && git add file &&
test_must_fail git pull && test_must_fail git pull &&

View File

@ -181,8 +181,7 @@ test_expect_success 'push (chunked)' '
git checkout master && git checkout master &&
test_commit commit path3 && test_commit commit path3 &&
HEAD=$(git rev-parse --verify HEAD) && HEAD=$(git rev-parse --verify HEAD) &&
git config http.postbuffer 4 && test_config http.postbuffer 4 &&
test_when_finished "git config --unset http.postbuffer" &&
git push -v -v origin $BRANCH 2>err && git push -v -v origin $BRANCH 2>err &&
grep "POST git-receive-pack (chunked)" err && grep "POST git-receive-pack (chunked)" err &&
(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git && (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&

View File

@ -36,8 +36,7 @@ test_expect_success 'nonexistent template file should return error' '
' '


test_expect_success 'nonexistent template file in config should return error' ' test_expect_success 'nonexistent template file in config should return error' '
git config commit.template "$PWD"/notexist && test_config commit.template "$PWD"/notexist &&
test_when_finished "git config --unset commit.template" &&
( (
GIT_EDITOR="echo hello >\"\$1\"" && GIT_EDITOR="echo hello >\"\$1\"" &&
export GIT_EDITOR && export GIT_EDITOR &&
@ -93,14 +92,13 @@ test_expect_success '-t option should be short for --template' '


test_expect_success 'config-specified template should commit' ' test_expect_success 'config-specified template should commit' '
echo "new template" > "$TEMPLATE" && echo "new template" > "$TEMPLATE" &&
git config commit.template "$TEMPLATE" && test_config commit.template "$TEMPLATE" &&
echo "more content" >> foo && echo "more content" >> foo &&
git add foo && git add foo &&
( (
test_set_editor "$TEST_DIRECTORY"/t7500/add-content && test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
git commit git commit
) && ) &&
git config --unset commit.template &&
commit_msg_is "new templatecommit message" commit_msg_is "new templatecommit message"
' '



View File

@ -171,10 +171,9 @@ test_expect_success 'verbose' '


test_expect_success 'verbose respects diff config' ' test_expect_success 'verbose respects diff config' '


git config color.diff always && test_config color.diff always &&
git status -v >actual && git status -v >actual &&
grep "\[1mdiff --git" actual && grep "\[1mdiff --git" actual
git config --unset color.diff
' '


mesg_with_comment_and_newlines=' mesg_with_comment_and_newlines='
@ -435,16 +434,6 @@ EOF


echo '## Custom template' >template echo '## Custom template' >template


clear_config () {
(
git config --unset-all "$1"
case $? in
0|5) exit 0 ;;
*) exit 1 ;;
esac
)
}

try_commit () { try_commit () {
git reset --hard && git reset --hard &&
echo >>negative && echo >>negative &&
@ -460,67 +449,57 @@ try_commit () {
try_commit_status_combo () { try_commit_status_combo () {


test_expect_success 'commit' ' test_expect_success 'commit' '
clear_config commit.status &&
try_commit "" && try_commit "" &&
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
' '


test_expect_success 'commit' ' test_expect_success 'commit' '
clear_config commit.status &&
try_commit "" && try_commit "" &&
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
' '


test_expect_success 'commit --status' ' test_expect_success 'commit --status' '
clear_config commit.status &&
try_commit --status && try_commit --status &&
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
' '


test_expect_success 'commit --no-status' ' test_expect_success 'commit --no-status' '
clear_config commit.status &&
try_commit --no-status && try_commit --no-status &&
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
' '


test_expect_success 'commit with commit.status = yes' ' test_expect_success 'commit with commit.status = yes' '
clear_config commit.status && test_config commit.status yes &&
git config commit.status yes &&
try_commit "" && try_commit "" &&
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
' '


test_expect_success 'commit with commit.status = no' ' test_expect_success 'commit with commit.status = no' '
clear_config commit.status && test_config commit.status no &&
git config commit.status no &&
try_commit "" && try_commit "" &&
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
' '


test_expect_success 'commit --status with commit.status = yes' ' test_expect_success 'commit --status with commit.status = yes' '
clear_config commit.status && test_config commit.status yes &&
git config commit.status yes &&
try_commit --status && try_commit --status &&
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
' '


test_expect_success 'commit --no-status with commit.status = yes' ' test_expect_success 'commit --no-status with commit.status = yes' '
clear_config commit.status && test_config commit.status yes &&
git config commit.status yes &&
try_commit --no-status && try_commit --no-status &&
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
' '


test_expect_success 'commit --status with commit.status = no' ' test_expect_success 'commit --status with commit.status = no' '
clear_config commit.status && test_config commit.status no &&
git config commit.status no &&
try_commit --status && try_commit --status &&
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
' '


test_expect_success 'commit --no-status with commit.status = no' ' test_expect_success 'commit --no-status with commit.status = no' '
clear_config commit.status && test_config commit.status no &&
git config commit.status no &&
try_commit --no-status && try_commit --no-status &&
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
' '
@ -534,8 +513,7 @@ use_template="-t template"
try_commit_status_combo try_commit_status_combo


test_expect_success 'commit --status with custom comment character' ' test_expect_success 'commit --status with custom comment character' '
test_when_finished "git config --unset core.commentchar" && test_config core.commentchar ";" &&
git config core.commentchar ";" &&
try_commit --status && try_commit --status &&
test_i18ngrep "^; Changes to be committed:" .git/COMMIT_EDITMSG test_i18ngrep "^; Changes to be committed:" .git/COMMIT_EDITMSG
' '

View File

@ -131,8 +131,7 @@ cat >expect <<\EOF
EOF EOF


test_expect_success 'status (advice.statusHints false)' ' test_expect_success 'status (advice.statusHints false)' '
test_when_finished "git config --unset advice.statusHints" && test_config advice.statusHints false &&
git config advice.statusHints false &&
git status >output && git status >output &&
test_i18ncmp expect output test_i18ncmp expect output


@ -332,8 +331,7 @@ test_expect_success 'status -uno' '
' '


test_expect_success 'status (status.showUntrackedFiles no)' ' test_expect_success 'status (status.showUntrackedFiles no)' '
git config status.showuntrackedfiles no test_config status.showuntrackedfiles no &&
test_when_finished "git config --unset status.showuntrackedfiles" &&
git status >output && git status >output &&
test_i18ncmp expect output test_i18ncmp expect output
' '
@ -348,12 +346,11 @@ cat >expect <<EOF
# #
# Untracked files not listed # Untracked files not listed
EOF EOF
git config advice.statusHints false
test_expect_success 'status -uno (advice.statusHints false)' ' test_expect_success 'status -uno (advice.statusHints false)' '
test_config advice.statusHints false &&
git status -uno >output && git status -uno >output &&
test_i18ncmp expect output test_i18ncmp expect output
' '
git config --unset advice.statusHints


cat >expect << EOF cat >expect << EOF
M dir1/modified M dir1/modified
@ -400,8 +397,7 @@ test_expect_success 'status -unormal' '
' '


test_expect_success 'status (status.showUntrackedFiles normal)' ' test_expect_success 'status (status.showUntrackedFiles normal)' '
git config status.showuntrackedfiles normal test_config status.showuntrackedfiles normal
test_when_finished "git config --unset status.showuntrackedfiles" &&
git status >output && git status >output &&
test_i18ncmp expect output test_i18ncmp expect output
' '
@ -459,8 +455,7 @@ test_expect_success 'status -uall' '
' '


test_expect_success 'status (status.showUntrackedFiles all)' ' test_expect_success 'status (status.showUntrackedFiles all)' '
git config status.showuntrackedfiles all test_config status.showuntrackedfiles all
test_when_finished "git config --unset status.showuntrackedfiles" &&
git status >output && git status >output &&
test_i18ncmp expect output test_i18ncmp expect output
' '
@ -485,10 +480,9 @@ test_expect_success 'status -s -uall' '
test_cmp expect output test_cmp expect output
' '
test_expect_success 'status -s (status.showUntrackedFiles all)' ' test_expect_success 'status -s (status.showUntrackedFiles all)' '
git config status.showuntrackedfiles all test_config status.showuntrackedfiles all &&
git status -s >output && git status -s >output &&
rm -rf dir3 && rm -rf dir3 &&
git config --unset status.showuntrackedfiles &&
test_cmp expect output test_cmp expect output
' '


@ -588,15 +582,13 @@ cat >expect <<\EOF
EOF EOF


test_expect_success 'status with color.ui' ' test_expect_success 'status with color.ui' '
git config color.ui always && test_config color.ui always &&
test_when_finished "git config --unset color.ui" &&
git status | test_decode_color >output && git status | test_decode_color >output &&
test_i18ncmp expect output test_i18ncmp expect output
' '


test_expect_success 'status with color.status' ' test_expect_success 'status with color.status' '
git config color.status always && test_config color.status always &&
test_when_finished "git config --unset color.status" &&
git status | test_decode_color >output && git status | test_decode_color >output &&
test_i18ncmp expect output test_i18ncmp expect output
' '
@ -720,8 +712,7 @@ EOF


test_expect_success 'status without relative paths' ' test_expect_success 'status without relative paths' '


git config status.relativePaths false && test_config status.relativePaths false &&
test_when_finished "git config --unset status.relativePaths" &&
(cd dir1 && git status) >output && (cd dir1 && git status) >output &&
test_i18ncmp expect output test_i18ncmp expect output


@ -740,8 +731,7 @@ EOF


test_expect_success 'status -s without relative paths' ' test_expect_success 'status -s without relative paths' '


git config status.relativePaths false && test_config status.relativePaths false &&
test_when_finished "git config --unset status.relativePaths" &&
(cd dir1 && git status -s) >output && (cd dir1 && git status -s) >output &&
test_cmp expect output test_cmp expect output


@ -1038,15 +1028,14 @@ test_expect_success '--ignore-submodules=untracked suppresses submodules with un
' '


test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' ' test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
git config diff.ignoreSubmodules dirty && test_config diff.ignoreSubmodules dirty &&
git status >output && git status >output &&
test_i18ncmp expect output && test_i18ncmp expect output &&
git config --add -f .gitmodules submodule.subname.ignore untracked && git config --add -f .gitmodules submodule.subname.ignore untracked &&
git config --add -f .gitmodules submodule.subname.path sm && git config --add -f .gitmodules submodule.subname.path sm &&
git status >output && git status >output &&
test_i18ncmp expect output && test_i18ncmp expect output &&
git config -f .gitmodules --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname
git config --unset diff.ignoreSubmodules
' '


test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' ' test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
@ -1066,15 +1055,14 @@ test_expect_success '--ignore-submodules=dirty suppresses submodules with untrac
' '


test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' ' test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
git config diff.ignoreSubmodules dirty && test_config diff.ignoreSubmodules dirty &&
git status >output && git status >output &&
! test -s actual && ! test -s actual &&
git config --add -f .gitmodules submodule.subname.ignore dirty && git config --add -f .gitmodules submodule.subname.ignore dirty &&
git config --add -f .gitmodules submodule.subname.path sm && git config --add -f .gitmodules submodule.subname.path sm &&
git status >output && git status >output &&
test_i18ncmp expect output && test_i18ncmp expect output &&
git config -f .gitmodules --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname
git config --unset diff.ignoreSubmodules
' '


test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' ' test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
@ -1291,15 +1279,13 @@ cat > expect << EOF
EOF EOF


test_expect_success "status (core.commentchar with submodule summary)" ' test_expect_success "status (core.commentchar with submodule summary)" '
test_when_finished "git config --unset core.commentchar" && test_config core.commentchar ";" &&
git config core.commentchar ";" &&
git status >output && git status >output &&
test_i18ncmp expect output test_i18ncmp expect output
' '


test_expect_success "status (core.commentchar with two chars with submodule summary)" ' test_expect_success "status (core.commentchar with two chars with submodule summary)" '
test_when_finished "git config --unset core.commentchar" && test_config core.commentchar ";;" &&
git config core.commentchar ";;" &&
git status >output && git status >output &&
test_i18ncmp expect output test_i18ncmp expect output
' '

View File

@ -56,7 +56,8 @@ create_merge_msgs () {
echo && echo &&
git log --no-merges ^HEAD c2 c3 git log --no-merges ^HEAD c2 c3
} >squash.1-5-9 && } >squash.1-5-9 &&
echo >msg.nolog && : >msg.nologff &&
echo >msg.nolognoff &&
{ {
echo "* tag 'c3':" && echo "* tag 'c3':" &&
echo " commit 3" && echo " commit 3" &&
@ -244,8 +245,7 @@ test_expect_success 'merges with --ff-only' '
test_expect_success 'merges with merge.ff=only' ' test_expect_success 'merges with merge.ff=only' '
git reset --hard c1 && git reset --hard c1 &&
test_tick && test_tick &&
test_when_finished "git config --unset merge.ff" && test_config merge.ff "only" &&
git config merge.ff only &&
test_must_fail git merge c2 && test_must_fail git merge c2 &&
test_must_fail git merge c3 && test_must_fail git merge c3 &&
test_must_fail git merge c2 c3 && test_must_fail git merge c2 c3 &&
@ -336,7 +336,7 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge c1 with c2 (no-commit in config)' ' test_expect_success 'merge c1 with c2 (no-commit in config)' '
git reset --hard c1 && git reset --hard c1 &&
git config branch.master.mergeoptions "--no-commit" && test_config branch.master.mergeoptions "--no-commit" &&
git merge c2 && git merge c2 &&
verify_merge file result.1-5 && verify_merge file result.1-5 &&
verify_head $c1 && verify_head $c1 &&
@ -346,12 +346,11 @@ test_expect_success 'merge c1 with c2 (no-commit in config)' '
test_debug 'git log --graph --decorate --oneline --all' test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge c1 with c2 (log in config)' ' test_expect_success 'merge c1 with c2 (log in config)' '
git config branch.master.mergeoptions "" &&
git reset --hard c1 && git reset --hard c1 &&
git merge --log c2 && git merge --log c2 &&
git show -s --pretty=tformat:%s%n%b >expect && git show -s --pretty=tformat:%s%n%b >expect &&


git config branch.master.mergeoptions --log && test_config branch.master.mergeoptions "--log" &&
git reset --hard c1 && git reset --hard c1 &&
git merge c2 && git merge c2 &&
git show -s --pretty=tformat:%s%n%b >actual && git show -s --pretty=tformat:%s%n%b >actual &&
@ -360,17 +359,12 @@ test_expect_success 'merge c1 with c2 (log in config)' '
' '


test_expect_success 'merge c1 with c2 (log in config gets overridden)' ' test_expect_success 'merge c1 with c2 (log in config gets overridden)' '
test_when_finished "git config --remove-section branch.master" &&
test_when_finished "git config --remove-section merge" &&
test_might_fail git config --remove-section branch.master &&
test_might_fail git config --remove-section merge &&

git reset --hard c1 && git reset --hard c1 &&
git merge c2 && git merge c2 &&
git show -s --pretty=tformat:%s%n%b >expect && git show -s --pretty=tformat:%s%n%b >expect &&


git config branch.master.mergeoptions "--no-log" && test_config branch.master.mergeoptions "--no-log" &&
git config merge.log true && test_config merge.log "true" &&
git reset --hard c1 && git reset --hard c1 &&
git merge c2 && git merge c2 &&
git show -s --pretty=tformat:%s%n%b >actual && git show -s --pretty=tformat:%s%n%b >actual &&
@ -380,7 +374,7 @@ test_expect_success 'merge c1 with c2 (log in config gets overridden)' '


test_expect_success 'merge c1 with c2 (squash in config)' ' test_expect_success 'merge c1 with c2 (squash in config)' '
git reset --hard c1 && git reset --hard c1 &&
git config branch.master.mergeoptions "--squash" && test_config branch.master.mergeoptions "--squash" &&
git merge c2 && git merge c2 &&
verify_merge file result.1-5 && verify_merge file result.1-5 &&
verify_head $c1 && verify_head $c1 &&
@ -392,7 +386,7 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'override config option -n with --summary' ' test_expect_success 'override config option -n with --summary' '
git reset --hard c1 && git reset --hard c1 &&
git config branch.master.mergeoptions "-n" && test_config branch.master.mergeoptions "-n" &&
test_tick && test_tick &&
git merge --summary c2 >diffstat.txt && git merge --summary c2 >diffstat.txt &&
verify_merge file result.1-5 msg.1-5 && verify_merge file result.1-5 msg.1-5 &&
@ -406,7 +400,7 @@ test_expect_success 'override config option -n with --summary' '


test_expect_success 'override config option -n with --stat' ' test_expect_success 'override config option -n with --stat' '
git reset --hard c1 && git reset --hard c1 &&
git config branch.master.mergeoptions "-n" && test_config branch.master.mergeoptions "-n" &&
test_tick && test_tick &&
git merge --stat c2 >diffstat.txt && git merge --stat c2 >diffstat.txt &&
verify_merge file result.1-5 msg.1-5 && verify_merge file result.1-5 msg.1-5 &&
@ -422,7 +416,7 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'override config option --stat' ' test_expect_success 'override config option --stat' '
git reset --hard c1 && git reset --hard c1 &&
git config branch.master.mergeoptions "--stat" && test_config branch.master.mergeoptions "--stat" &&
test_tick && test_tick &&
git merge -n c2 >diffstat.txt && git merge -n c2 >diffstat.txt &&
verify_merge file result.1-5 msg.1-5 && verify_merge file result.1-5 msg.1-5 &&
@ -438,7 +432,7 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge c1 with c2 (override --no-commit)' ' test_expect_success 'merge c1 with c2 (override --no-commit)' '
git reset --hard c1 && git reset --hard c1 &&
git config branch.master.mergeoptions "--no-commit" && test_config branch.master.mergeoptions "--no-commit" &&
test_tick && test_tick &&
git merge --commit c2 && git merge --commit c2 &&
verify_merge file result.1-5 msg.1-5 && verify_merge file result.1-5 msg.1-5 &&
@ -449,7 +443,7 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge c1 with c2 (override --squash)' ' test_expect_success 'merge c1 with c2 (override --squash)' '
git reset --hard c1 && git reset --hard c1 &&
git config branch.master.mergeoptions "--squash" && test_config branch.master.mergeoptions "--squash" &&
test_tick && test_tick &&
git merge --no-squash c2 && git merge --no-squash c2 &&
verify_merge file result.1-5 msg.1-5 && verify_merge file result.1-5 msg.1-5 &&
@ -460,7 +454,6 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge c0 with c1 (no-ff)' ' test_expect_success 'merge c0 with c1 (no-ff)' '
git reset --hard c0 && git reset --hard c0 &&
git config branch.master.mergeoptions "" &&
test_tick && test_tick &&
git merge --no-ff c1 && git merge --no-ff c1 &&
verify_merge file result.1 && verify_merge file result.1 &&
@ -471,10 +464,9 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge c0 with c1 (merge.ff=false)' ' test_expect_success 'merge c0 with c1 (merge.ff=false)' '
git reset --hard c0 && git reset --hard c0 &&
git config merge.ff false && test_config merge.ff "false" &&
test_tick && test_tick &&
git merge c1 && git merge c1 &&
git config --remove-section merge &&
verify_merge file result.1 && verify_merge file result.1 &&
verify_parents $c0 $c1 verify_parents $c0 $c1
' '
@ -482,22 +474,19 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'combine branch.master.mergeoptions with merge.ff' ' test_expect_success 'combine branch.master.mergeoptions with merge.ff' '
git reset --hard c0 && git reset --hard c0 &&
git config branch.master.mergeoptions --ff && test_config branch.master.mergeoptions "--ff" &&
git config merge.ff false && test_config merge.ff "false" &&
test_tick && test_tick &&
git merge c1 && git merge c1 &&
git config --remove-section "branch.master" &&
git config --remove-section "merge" &&
verify_merge file result.1 && verify_merge file result.1 &&
verify_parents "$c0" verify_parents "$c0"
' '


test_expect_success 'tolerate unknown values for merge.ff' ' test_expect_success 'tolerate unknown values for merge.ff' '
git reset --hard c0 && git reset --hard c0 &&
git config merge.ff something-new && test_config merge.ff "something-new" &&
test_tick && test_tick &&
git merge c1 2>message && git merge c1 2>message &&
git config --remove-section "merge" &&
verify_head "$c1" && verify_head "$c1" &&
test_cmp empty message test_cmp empty message
' '
@ -515,7 +504,7 @@ test_expect_success 'combining --ff-only and --no-ff is refused' '


test_expect_success 'merge c0 with c1 (ff overrides no-ff)' ' test_expect_success 'merge c0 with c1 (ff overrides no-ff)' '
git reset --hard c0 && git reset --hard c0 &&
git config branch.master.mergeoptions "--no-ff" && test_config branch.master.mergeoptions "--no-ff" &&
git merge --ff c1 && git merge --ff c1 &&
verify_merge file result.1 && verify_merge file result.1 &&
verify_head $c1 verify_head $c1
@ -525,14 +514,20 @@ test_expect_success 'merge log message' '
git reset --hard c0 && git reset --hard c0 &&
git merge --no-log c2 && git merge --no-log c2 &&
git show -s --pretty=format:%b HEAD >msg.act && git show -s --pretty=format:%b HEAD >msg.act &&
test_cmp msg.nolog msg.act && test_cmp msg.nologff msg.act &&

git reset --hard c0 &&
test_config branch.master.mergeoptions "--no-ff" &&
git merge --no-log c2 &&
git show -s --pretty=format:%b HEAD >msg.act &&
test_cmp msg.nolognoff msg.act &&


git merge --log c3 && git merge --log c3 &&
git show -s --pretty=format:%b HEAD >msg.act && git show -s --pretty=format:%b HEAD >msg.act &&
test_cmp msg.log msg.act && test_cmp msg.log msg.act &&


git reset --hard HEAD^ && git reset --hard HEAD^ &&
git config merge.log yes && test_config merge.log "yes" &&
git merge c3 && git merge c3 &&
git show -s --pretty=format:%b HEAD >msg.act && git show -s --pretty=format:%b HEAD >msg.act &&
test_cmp msg.log msg.act test_cmp msg.log msg.act
@ -542,7 +537,6 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge c1 with c0, c2, c0, and c1' ' test_expect_success 'merge c1 with c0, c2, c0, and c1' '
git reset --hard c1 && git reset --hard c1 &&
git config branch.master.mergeoptions "" &&
test_tick && test_tick &&
git merge c0 c2 c0 c1 && git merge c0 c2 c0 c1 &&
verify_merge file result.1-5 && verify_merge file result.1-5 &&
@ -553,7 +547,6 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge c1 with c0, c2, c0, and c1' ' test_expect_success 'merge c1 with c0, c2, c0, and c1' '
git reset --hard c1 && git reset --hard c1 &&
git config branch.master.mergeoptions "" &&
test_tick && test_tick &&
git merge c0 c2 c0 c1 && git merge c0 c2 c0 c1 &&
verify_merge file result.1-5 && verify_merge file result.1-5 &&
@ -564,7 +557,6 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge c1 with c1 and c2' ' test_expect_success 'merge c1 with c1 and c2' '
git reset --hard c1 && git reset --hard c1 &&
git config branch.master.mergeoptions "" &&
test_tick && test_tick &&
git merge c1 c2 && git merge c1 c2 &&
verify_merge file result.1-5 && verify_merge file result.1-5 &&

View File

@ -539,8 +539,7 @@ test_expect_success \
test_when_finished "GIT_COMMITTER_NAME=\"C O Mitter\"" && test_when_finished "GIT_COMMITTER_NAME=\"C O Mitter\"" &&
echo "ISO-8859-1" >> file && echo "ISO-8859-1" >> file &&
git add file && git add file &&
git config i18n.commitencoding ISO-8859-1 && test_config i18n.commitencoding ISO-8859-1 &&
test_when_finished "git config --unset i18n.commitencoding" &&
git commit -F "$TEST_DIRECTORY"/t3900/ISO8859-1.txt && git commit -F "$TEST_DIRECTORY"/t3900/ISO8859-1.txt &&
gitweb_run "p=.git;a=commit"' gitweb_run "p=.git;a=commit"'