Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/README4
-rw-r--r--t/helper/test-config.c2
-rw-r--r--t/helper/test-read-midx.c8
-rwxr-xr-xt/t0001-init.sh13
-rwxr-xr-xt/t0040-parse-options.sh2
-rwxr-xr-xt/t1400-update-ref.sh30
-rwxr-xr-xt/t1405-main-ref-store.sh5
-rwxr-xr-xt/t1416-ref-transaction-hooks.sh27
-rwxr-xr-xt/t3000-ls-files-others.sh24
-rwxr-xr-xt/t3404-rebase-interactive.sh8
-rwxr-xr-xt/t3500-cherry.sh23
-rwxr-xr-xt/t3507-cherry-pick-conflict.sh20
-rwxr-xr-xt/t4013-diff-various.sh3
-rw-r--r--t/t4013/diff.log_--diff-merges=off_-p_--first-parent_master78
-rw-r--r--t/t4013/diff.log_--first-parent_--diff-merges=off_-p_master78
-rw-r--r--t/t4013/diff.log_--no-diff-merges_-p_--first-parent_master78
-rw-r--r--t/t4013/diff.log_-p_--first-parent_master22
-rw-r--r--t/t4018/fortran-block-data5
-rw-r--r--t/t4018/fortran-comment13
-rw-r--r--t/t4018/fortran-comment-keyword14
-rw-r--r--t/t4018/fortran-comment-legacy13
-rw-r--r--t/t4018/fortran-comment-legacy-star13
-rw-r--r--t/t4018/fortran-external-function9
-rw-r--r--t/t4018/fortran-external-subroutine5
-rw-r--r--t/t4018/fortran-module5
-rw-r--r--t/t4018/fortran-module-procedure13
-rw-r--r--t/t4018/fortran-program5
-rwxr-xr-xt/t4140-apply-ita.sh56
-rwxr-xr-xt/t4216-log-bloom.sh9
-rwxr-xr-xt/t5318-commit-graph.sh38
-rwxr-xr-xt/t5319-multi-pack-index.sh61
-rwxr-xr-xt/t5324-split-commit-graph.sh5
-rwxr-xr-xt/t5510-fetch.sh15
-rwxr-xr-xt/t5521-pull-options.sh7
-rwxr-xr-xt/t6000-rev-list-misc.sh4
-rwxr-xr-xt/t6002-rev-list-bisect.sh45
-rwxr-xr-xt/t6030-bisect-porcelain.sh104
-rwxr-xr-xt/t6400-merge-df.sh (renamed from t/t6020-merge-df.sh)0
-rwxr-xr-xt/t6401-merge-criss-cross.sh (renamed from t/t6021-merge-criss-cross.sh)0
-rwxr-xr-xt/t6402-merge-rename.sh (renamed from t/t6022-merge-rename.sh)0
-rwxr-xr-xt/t6403-merge-file.sh (renamed from t/t6023-merge-file.sh)0
-rwxr-xr-xt/t6404-recursive-merge.sh (renamed from t/t6024-recursive-merge.sh)0
-rwxr-xr-xt/t6405-merge-symlinks.sh (renamed from t/t6025-merge-symlinks.sh)0
-rwxr-xr-xt/t6406-merge-attr.sh (renamed from t/t6026-merge-attr.sh)0
-rwxr-xr-xt/t6407-merge-binary.sh (renamed from t/t6027-merge-binary.sh)0
-rwxr-xr-xt/t6408-merge-up-to-date.sh (renamed from t/t6028-merge-up-to-date.sh)0
-rwxr-xr-xt/t6409-merge-subtree.sh (renamed from t/t6029-merge-subtree.sh)0
-rwxr-xr-xt/t6411-merge-filemode.sh (renamed from t/t6031-merge-filemode.sh)0
-rwxr-xr-xt/t6412-merge-large-rename.sh (renamed from t/t6032-merge-large-rename.sh)0
-rwxr-xr-xt/t6413-merge-crlf.sh (renamed from t/t6033-merge-crlf.sh)0
-rwxr-xr-xt/t6414-merge-rename-nocruft.sh (renamed from t/t6034-merge-rename-nocruft.sh)0
-rwxr-xr-xt/t6415-merge-dir-to-symlink.sh (renamed from t/t6035-merge-dir-to-symlink.sh)0
-rwxr-xr-xt/t6416-recursive-corner-cases.sh (renamed from t/t6036-recursive-corner-cases.sh)4
-rwxr-xr-xt/t6417-merge-ours-theirs.sh (renamed from t/t6037-merge-ours-theirs.sh)0
-rwxr-xr-xt/t6418-merge-text-auto.sh (renamed from t/t6038-merge-text-auto.sh)3
-rwxr-xr-xt/t6419-merge-ignorecase.sh (renamed from t/t6039-merge-ignorecase.sh)0
-rwxr-xr-xt/t6422-merge-rename-corner-cases.sh (renamed from t/t6042-merge-rename-corner-cases.sh)68
-rwxr-xr-xt/t6423-merge-rename-directories.sh (renamed from t/t6043-merge-rename-directories.sh)39
-rwxr-xr-xt/t6424-merge-unrelated-index-changes.sh (renamed from t/t6044-merge-unrelated-index-changes.sh)0
-rwxr-xr-xt/t6425-merge-rename-delete.sh (renamed from t/t6045-merge-rename-delete.sh)3
-rwxr-xr-xt/t6426-merge-skip-unneeded-updates.sh (renamed from t/t6046-merge-skip-unneeded-updates.sh)2
-rwxr-xr-xt/t6427-diff3-conflict-markers.sh (renamed from t/t6047-diff3-conflict-markers.sh)0
-rwxr-xr-xt/t6430-merge-recursive.sh (renamed from t/t3030-merge-recursive.sh)0
-rwxr-xr-xt/t6431-merge-criscross.sh (renamed from t/t3031-merge-criscross.sh)0
-rwxr-xr-xt/t6432-merge-recursive-space-options.sh (renamed from t/t3032-merge-recursive-space-options.sh)0
-rwxr-xr-xt/t6433-merge-toplevel.sh (renamed from t/t3033-merge-toplevel.sh)0
-rwxr-xr-xt/t6434-merge-recursive-rename-options.sh (renamed from t/t3034-merge-recursive-rename-options.sh)0
-rwxr-xr-xt/t6435-merge-sparse.sh (renamed from t/t3035-merge-sparse.sh)0
-rwxr-xr-xt/t6436-merge-overwrite.sh (renamed from t/t7607-merge-overwrite.sh)0
-rwxr-xr-xt/t6437-submodule-merge.sh (renamed from t/t7405-submodule-merge.sh)0
-rwxr-xr-xt/t6438-submodule-directory-file-conflicts.sh (renamed from t/t7613-merge-submodule.sh)0
-rwxr-xr-xt/t6439-merge-co-error-msgs.sh (renamed from t/t7609-merge-co-error-msgs.sh)0
-rwxr-xr-xt/t8003-blame-corner-cases.sh28
-rwxr-xr-xt/t9001-send-email.sh29
-rw-r--r--t/test-lib-functions.sh16
75 files changed, 901 insertions, 155 deletions
diff --git a/t/README b/t/README
index 70ec61cf88..2adaf7c2d2 100644
--- a/t/README
+++ b/t/README
@@ -421,6 +421,10 @@ GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=<boolean>, when true (which is
the default when running tests), errors out when an abbreviated option
is used.
+GIT_TEST_DEFAULT_HASH=<hash-algo> specifies which hash algorithm to
+use in the test scripts. Recognized values for <hash-algo> are "sha1"
+and "sha256".
+
Naming Tests
------------
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 234c722b48..a6e936721f 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -126,7 +126,7 @@ int cmd__config(int argc, const char **argv)
goto exit1;
}
} else if (argc == 3 && !strcmp(argv[1], "get_string")) {
- if (!git_config_get_string_const(argv[2], &v)) {
+ if (!git_config_get_string_tmp(argv[2], &v)) {
printf("%s\n", v);
goto exit0;
} else {
diff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c
index 831b586d02..2430880f78 100644
--- a/t/helper/test-read-midx.c
+++ b/t/helper/test-read-midx.c
@@ -7,14 +7,18 @@
static int read_midx_file(const char *object_dir)
{
uint32_t i;
- struct multi_pack_index *m = load_multi_pack_index(object_dir, 1);
+ struct multi_pack_index *m;
+
+ setup_git_directory();
+ m = load_multi_pack_index(object_dir, 1);
if (!m)
return 1;
- printf("header: %08x %d %d %d\n",
+ printf("header: %08x %d %d %d %d\n",
m->signature,
m->version,
+ m->hash_len,
m->num_chunks,
m->num_packs);
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index d71d4c7238..50222a10c5 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -316,6 +316,19 @@ test_expect_success 'init with separate gitdir' '
test_path_is_dir realgitdir/refs
'
+test_expect_success 'explicit bare & --separate-git-dir incompatible' '
+ test_must_fail git init --bare --separate-git-dir goop.git bare.git 2>err &&
+ test_i18ngrep "mutually exclusive" err
+'
+
+test_expect_success 'implicit bare & --separate-git-dir incompatible' '
+ test_when_finished "rm -rf bare.git" &&
+ mkdir -p bare.git &&
+ test_must_fail env GIT_DIR=. \
+ git -C bare.git init --separate-git-dir goop.git 2>err &&
+ test_i18ngrep "incompatible" err
+'
+
test_lazy_prereq GETCWD_IGNORES_PERMS '
base=GETCWD_TEST_BASE_DIR &&
mkdir -p $base/dir &&
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index f8178ee4e3..14cafc138b 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -44,7 +44,7 @@ Magic arguments
--no-ambiguous negative ambiguity
Standard options
- --abbrev[=<n>] use <n> digits to display SHA-1s
+ --abbrev[=<n>] use <n> digits to display object names
-v, --verbose be verbose
-n, --dry-run dry run
-q, --quiet be quiet
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index d0d36750bc..770e7be363 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -160,10 +160,10 @@ test_expect_success 'core.logAllRefUpdates=always creates reflog by default' '
git reflog exists $outside
'
-test_expect_success 'core.logAllRefUpdates=always creates no reflog for ORIG_HEAD' '
+test_expect_success 'core.logAllRefUpdates=always creates reflog for ORIG_HEAD' '
test_config core.logAllRefUpdates always &&
git update-ref ORIG_HEAD $A &&
- test_must_fail git reflog exists ORIG_HEAD
+ git reflog exists ORIG_HEAD
'
test_expect_success '--no-create-reflog overrides core.logAllRefUpdates=always' '
@@ -475,57 +475,57 @@ test_expect_success 'git cat-file blob master@{2005-05-26 23:42}:F (expect OTHER
test_expect_success 'given old value for missing pseudoref, do not create' '
test_must_fail git update-ref PSEUDOREF $A $B 2>err &&
- test_path_is_missing .git/PSEUDOREF &&
- test_i18ngrep "could not read ref" err
+ test_must_fail git rev-parse PSEUDOREF &&
+ test_i18ngrep "unable to resolve reference" err
'
test_expect_success 'create pseudoref' '
git update-ref PSEUDOREF $A &&
- test $A = $(cat .git/PSEUDOREF)
+ test $A = $(git rev-parse PSEUDOREF)
'
test_expect_success 'overwrite pseudoref with no old value given' '
git update-ref PSEUDOREF $B &&
- test $B = $(cat .git/PSEUDOREF)
+ test $B = $(git rev-parse PSEUDOREF)
'
test_expect_success 'overwrite pseudoref with correct old value' '
git update-ref PSEUDOREF $C $B &&
- test $C = $(cat .git/PSEUDOREF)
+ test $C = $(git rev-parse PSEUDOREF)
'
test_expect_success 'do not overwrite pseudoref with wrong old value' '
test_must_fail git update-ref PSEUDOREF $D $E 2>err &&
- test $C = $(cat .git/PSEUDOREF) &&
- test_i18ngrep "unexpected object ID" err
+ test $C = $(git rev-parse PSEUDOREF) &&
+ test_i18ngrep "cannot lock ref.*expected" err
'
test_expect_success 'delete pseudoref' '
git update-ref -d PSEUDOREF &&
- test_path_is_missing .git/PSEUDOREF
+ test_must_fail git rev-parse PSEUDOREF
'
test_expect_success 'do not delete pseudoref with wrong old value' '
git update-ref PSEUDOREF $A &&
test_must_fail git update-ref -d PSEUDOREF $B 2>err &&
- test $A = $(cat .git/PSEUDOREF) &&
- test_i18ngrep "unexpected object ID" err
+ test $A = $(git rev-parse PSEUDOREF) &&
+ test_i18ngrep "cannot lock ref.*expected" err
'
test_expect_success 'delete pseudoref with correct old value' '
git update-ref -d PSEUDOREF $A &&
- test_path_is_missing .git/PSEUDOREF
+ test_must_fail git rev-parse PSEUDOREF
'
test_expect_success 'create pseudoref with old OID zero' '
git update-ref PSEUDOREF $A $Z &&
- test $A = $(cat .git/PSEUDOREF)
+ test $A = $(git rev-parse PSEUDOREF)
'
test_expect_success 'do not overwrite pseudoref with old OID zero' '
test_when_finished git update-ref -d PSEUDOREF &&
test_must_fail git update-ref PSEUDOREF $B $Z 2>err &&
- test $A = $(cat .git/PSEUDOREF) &&
+ test $A = $(git rev-parse PSEUDOREF) &&
test_i18ngrep "already exists" err
'
diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh
index 331899ddc4..74af927fba 100755
--- a/t/t1405-main-ref-store.sh
+++ b/t/t1405-main-ref-store.sh
@@ -31,7 +31,10 @@ test_expect_success 'create_symref(FOO, refs/heads/master)' '
test_expect_success 'delete_refs(FOO, refs/tags/new-tag)' '
git rev-parse FOO -- &&
git rev-parse refs/tags/new-tag -- &&
- $RUN delete-refs 0 nothing FOO refs/tags/new-tag &&
+ m=$(git rev-parse master) &&
+ REF_NO_DEREF=1 &&
+ $RUN delete-refs $REF_NO_DEREF nothing FOO refs/tags/new-tag &&
+ test_must_fail git rev-parse --symbolic-full-name FOO &&
test_must_fail git rev-parse FOO -- &&
test_must_fail git rev-parse refs/tags/new-tag --
'
diff --git a/t/t1416-ref-transaction-hooks.sh b/t/t1416-ref-transaction-hooks.sh
index da58d867a5..f6e741c6c0 100755
--- a/t/t1416-ref-transaction-hooks.sh
+++ b/t/t1416-ref-transaction-hooks.sh
@@ -7,6 +7,7 @@ test_description='reference transaction hooks'
test_expect_success setup '
mkdir -p .git/hooks &&
test_commit PRE &&
+ PRE_OID=$(git rev-parse PRE) &&
test_commit POST &&
POST_OID=$(git rev-parse POST)
'
@@ -106,4 +107,30 @@ test_expect_success 'hook gets all queued updates in aborted state' '
test_cmp expect actual
'
+test_expect_success 'interleaving hook calls succeed' '
+ test_when_finished "rm -r target-repo.git" &&
+
+ git init --bare target-repo.git &&
+
+ write_script target-repo.git/hooks/reference-transaction <<-\EOF &&
+ echo $0 "$@" >>actual
+ EOF
+
+ write_script target-repo.git/hooks/update <<-\EOF &&
+ echo $0 "$@" >>actual
+ EOF
+
+ cat >expect <<-EOF &&
+ hooks/update refs/tags/PRE $ZERO_OID $PRE_OID
+ hooks/reference-transaction prepared
+ hooks/reference-transaction committed
+ hooks/update refs/tags/POST $ZERO_OID $POST_OID
+ hooks/reference-transaction prepared
+ hooks/reference-transaction committed
+ EOF
+
+ git push ./target-repo.git PRE POST &&
+ test_cmp expect target-repo.git/actual
+'
+
test_done
diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh
index ffdfb16f58..740ce56eab 100755
--- a/t/t3000-ls-files-others.sh
+++ b/t/t3000-ls-files-others.sh
@@ -152,7 +152,7 @@ test_expect_success 'ls-files -o --directory with mix dir/file pathspecs' '
)
'
-test_expect_success 'ls-files --o --directory with glob filetype match' '
+test_expect_success 'ls-files -o --directory with glob filetype match' '
(
cd nested &&
@@ -168,7 +168,7 @@ test_expect_success 'ls-files --o --directory with glob filetype match' '
)
'
-test_expect_success 'ls-files --o --directory with mix of tracked states' '
+test_expect_success 'ls-files -o --directory with mix of tracked states' '
(
cd nested &&
@@ -184,7 +184,7 @@ test_expect_success 'ls-files --o --directory with mix of tracked states' '
)
'
-test_expect_success 'ls-files --o --directory with glob filetype match only' '
+test_expect_success 'ls-files -o --directory with glob filetype match only' '
(
cd nested &&
@@ -198,7 +198,7 @@ test_expect_success 'ls-files --o --directory with glob filetype match only' '
)
'
-test_expect_success 'ls-files --o --directory to get immediate paths under one dir only' '
+test_expect_success 'ls-files -o --directory to get immediate paths under one dir only' '
(
cd nested &&
@@ -212,4 +212,20 @@ test_expect_success 'ls-files --o --directory to get immediate paths under one d
)
'
+test_expect_success 'ls-files -o avoids listing untracked non-matching gitdir' '
+ test_when_finished "rm -rf nested/untracked/deep/empty" &&
+ (
+ cd nested &&
+
+ git init untracked/deep/empty &&
+ git ls-files --others "untracked/*.c" >actual &&
+
+ cat <<-EOF >expect &&
+ untracked/deep/foo.c
+ EOF
+
+ test_cmp expect actual
+ )
+'
+
test_done
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 9744e88760..07a1617351 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -256,7 +256,7 @@ test_expect_success 'stop on conflicting pick' '
D
=======
G
- >>>>>>> $commit... G
+ >>>>>>> $commit (G)
EOF
git tag new-branch1 &&
test_must_fail git rebase -i master &&
@@ -1791,6 +1791,12 @@ test_expect_success 'correct error message for commit --amend after empty pick'
test_i18ngrep "middle of a rebase -- cannot amend." err
'
+test_expect_success 'todo has correct onto hash' '
+ GIT_SEQUENCE_EDITOR=cat git rebase -i no-conflict-branch~4 no-conflict-branch >actual &&
+ onto=$(git rev-parse --short HEAD~4) &&
+ test_i18ngrep "^# Rebase ..* onto $onto" actual
+'
+
# This must be the last test in this file
test_expect_success '$EDITOR and friends are unchanged' '
test_editor_unchanged
diff --git a/t/t3500-cherry.sh b/t/t3500-cherry.sh
index f038f34b7c..2b8d9cb38e 100755
--- a/t/t3500-cherry.sh
+++ b/t/t3500-cherry.sh
@@ -55,4 +55,27 @@ test_expect_success \
expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* - .*"
'
+test_expect_success 'cherry ignores whitespace' '
+ git switch --orphan=upstream-with-space &&
+ test_commit initial file &&
+ >expect &&
+ git switch --create=feature-without-space &&
+
+ # A spaceless file on the feature branch. Expect a match upstream.
+ printf space >file &&
+ git add file &&
+ git commit -m"file without space" &&
+ git log --format="- %H" -1 >>expect &&
+
+ # A further change. Should not match upstream.
+ test_commit change file &&
+ git log --format="+ %H" -1 >>expect &&
+
+ git switch upstream-with-space &&
+ # Same as the spaceless file, just with spaces and on upstream.
+ test_commit "file with space" file "s p a c e" file-with-space &&
+ git cherry upstream-with-space feature-without-space >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh
index f107622a9e..a21adcf0e4 100755
--- a/t/t3507-cherry-pick-conflict.sh
+++ b/t/t3507-cherry-pick-conflict.sh
@@ -283,12 +283,12 @@ test_expect_success 'failed cherry-pick describes conflict in work tree' '
a
=======
c
- >>>>>>> objid picked
+ >>>>>>> objid (picked)
EOF
test_must_fail git cherry-pick picked &&
- sed "s/[a-f0-9]*\.\.\./objid/" foo >actual &&
+ sed "s/[a-f0-9]* (/objid (/" foo >actual &&
test_cmp expected actual
'
@@ -298,16 +298,16 @@ test_expect_success 'diff3 -m style' '
cat <<-EOF >expected &&
<<<<<<< HEAD
a
- ||||||| parent of objid picked
+ ||||||| parent of objid (picked)
b
=======
c
- >>>>>>> objid picked
+ >>>>>>> objid (picked)
EOF
test_must_fail git cherry-pick picked &&
- sed "s/[a-f0-9]*\.\.\./objid/" foo >actual &&
+ sed "s/[a-f0-9]* (/objid (/" foo >actual &&
test_cmp expected actual
'
@@ -319,7 +319,7 @@ test_expect_success 'revert also handles conflicts sanely' '
a
=======
b
- >>>>>>> parent of objid picked
+ >>>>>>> parent of objid (picked)
EOF
{
git checkout picked -- foo &&
@@ -345,7 +345,7 @@ test_expect_success 'revert also handles conflicts sanely' '
test_must_fail git update-index --refresh -q &&
test_must_fail git diff-index --exit-code HEAD &&
test_cmp expected-stages actual-stages &&
- sed "s/[a-f0-9]*\.\.\./objid/" foo >actual &&
+ sed "s/[a-f0-9]* (/objid (/" foo >actual &&
test_cmp expected actual
'
@@ -429,16 +429,16 @@ test_expect_success 'revert conflict, diff3 -m style' '
cat <<-EOF >expected &&
<<<<<<< HEAD
a
- ||||||| objid picked
+ ||||||| objid (picked)
c
=======
b
- >>>>>>> parent of objid picked
+ >>>>>>> parent of objid (picked)
EOF
test_must_fail git revert picked &&
- sed "s/[a-f0-9]*\.\.\./objid/" foo >actual &&
+ sed "s/[a-f0-9]* (/objid (/" foo >actual &&
test_cmp expected actual
'
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index dfc87a0d19..5c7b0122b4 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -318,6 +318,9 @@ log --root --patch-with-stat --summary master
log --root -c --patch-with-stat --summary master
# improved by Timo's patch
log --root --cc --patch-with-stat --summary master
+log --no-diff-merges -p --first-parent master
+log --diff-merges=off -p --first-parent master
+log --first-parent --diff-merges=off -p master
log -p --first-parent master
log -m -p --first-parent master
log -m -p master
diff --git a/t/t4013/diff.log_--diff-merges=off_-p_--first-parent_master b/t/t4013/diff.log_--diff-merges=off_-p_--first-parent_master
new file mode 100644
index 0000000000..194e893c94
--- /dev/null
+++ b/t/t4013/diff.log_--diff-merges=off_-p_--first-parent_master
@@ -0,0 +1,78 @@
+$ git log --diff-merges=off -p --first-parent master
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
+Merge: 9a6d494 c7a2ab9
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:04:00 2006 +0000
+
+ Merge branch 'side'
+
+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:02:00 2006 +0000
+
+ Third
+
+diff --git a/dir/sub b/dir/sub
+index 8422d40..cead32e 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -2,3 +2,5 @@ A
+ B
+ C
+ D
++E
++F
+diff --git a/file1 b/file1
+new file mode 100644
+index 0000000..b1e6722
+--- /dev/null
++++ b/file1
+@@ -0,0 +1,3 @@
++A
++B
++C
+
+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:01:00 2006 +0000
+
+ Second
+
+ This is the second commit.
+
+diff --git a/dir/sub b/dir/sub
+index 35d242b..8422d40 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -1,2 +1,4 @@
+ A
+ B
++C
++D
+diff --git a/file0 b/file0
+index 01e79c3..b414108 100644
+--- a/file0
++++ b/file0
+@@ -1,3 +1,6 @@
+ 1
+ 2
+ 3
++4
++5
++6
+diff --git a/file2 b/file2
+deleted file mode 100644
+index 01e79c3..0000000
+--- a/file2
++++ /dev/null
+@@ -1,3 +0,0 @@
+-1
+-2
+-3
+
+commit 444ac553ac7612cc88969031b02b3767fb8a353a
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:00:00 2006 +0000
+
+ Initial
+$
diff --git a/t/t4013/diff.log_--first-parent_--diff-merges=off_-p_master b/t/t4013/diff.log_--first-parent_--diff-merges=off_-p_master
new file mode 100644
index 0000000000..5d7461a167
--- /dev/null
+++ b/t/t4013/diff.log_--first-parent_--diff-merges=off_-p_master
@@ -0,0 +1,78 @@
+$ git log --first-parent --diff-merges=off -p master
+commit 80e25ffa65bcdbe82ef654b4d06dbbde7945c37f
+Merge: 9a6d494 c7a2ab9
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:04:00 2006 +0000
+
+ Merge branch 'side'
+
+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:02:00 2006 +0000
+
+ Third
+
+diff --git a/dir/sub b/dir/sub
+index 8422d40..cead32e 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -2,3 +2,5 @@ A
+ B
+ C
+ D
++E
++F
+diff --git a/file1 b/file1
+new file mode 100644
+index 0000000..b1e6722
+--- /dev/null
++++ b/file1
+@@ -0,0 +1,3 @@
++A
++B
++C
+
+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:01:00 2006 +0000
+
+ Second
+
+ This is the second commit.
+
+diff --git a/dir/sub b/dir/sub
+index 35d242b..8422d40 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -1,2 +1,4 @@
+ A
+ B
++C
++D
+diff --git a/file0 b/file0
+index 01e79c3..b414108 100644
+--- a/file0
++++ b/file0
+@@ -1,3 +1,6 @@
+ 1
+ 2
+ 3
++4
++5
++6
+diff --git a/file2 b/file2
+deleted file mode 100644
+index 01e79c3..0000000
+--- a/file2
++++ /dev/null
+@@ -1,3 +0,0 @@
+-1
+-2
+-3
+
+commit 444ac553ac7612cc88969031b02b3767fb8a353a
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:00:00 2006 +0000
+
+ Initial
+$
diff --git a/t/t4013/diff.log_--no-diff-merges_-p_--first-parent_master b/t/t4013/diff.log_--no-diff-merges_-p_--first-parent_master
new file mode 100644
index 0000000000..597002232e
--- /dev/null
+++ b/t/t4013/diff.log_--no-diff-merges_-p_--first-parent_master
@@ -0,0 +1,78 @@
+$ git log --no-diff-merges -p --first-parent master
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
+Merge: 9a6d494 c7a2ab9
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:04:00 2006 +0000
+
+ Merge branch 'side'
+
+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:02:00 2006 +0000
+
+ Third
+
+diff --git a/dir/sub b/dir/sub
+index 8422d40..cead32e 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -2,3 +2,5 @@ A
+ B
+ C
+ D
++E
++F
+diff --git a/file1 b/file1
+new file mode 100644
+index 0000000..b1e6722
+--- /dev/null
++++ b/file1
+@@ -0,0 +1,3 @@
++A
++B
++C
+
+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:01:00 2006 +0000
+
+ Second
+
+ This is the second commit.
+
+diff --git a/dir/sub b/dir/sub
+index 35d242b..8422d40 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -1,2 +1,4 @@
+ A
+ B
++C
++D
+diff --git a/file0 b/file0
+index 01e79c3..b414108 100644
+--- a/file0
++++ b/file0
+@@ -1,3 +1,6 @@
+ 1
+ 2
+ 3
++4
++5
++6
+diff --git a/file2 b/file2
+deleted file mode 100644
+index 01e79c3..0000000
+--- a/file2
++++ /dev/null
+@@ -1,3 +0,0 @@
+-1
+-2
+-3
+
+commit 444ac553ac7612cc88969031b02b3767fb8a353a
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:00:00 2006 +0000
+
+ Initial
+$
diff --git a/t/t4013/diff.log_-p_--first-parent_master b/t/t4013/diff.log_-p_--first-parent_master
index 3fc896d424..28840ebea1 100644
--- a/t/t4013/diff.log_-p_--first-parent_master
+++ b/t/t4013/diff.log_-p_--first-parent_master
@@ -6,6 +6,28 @@ Date: Mon Jun 26 00:04:00 2006 +0000
Merge branch 'side'
+diff --git a/dir/sub b/dir/sub
+index cead32e..992913c 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -4,3 +4,5 @@ C
+ D
+ E
+ F
++1
++2
+diff --git a/file0 b/file0
+index b414108..10a8a9f 100644
+--- a/file0
++++ b/file0
+@@ -4,3 +4,6 @@
+ 4
+ 5
+ 6
++A
++B
++C
+
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000
diff --git a/t/t4018/fortran-block-data b/t/t4018/fortran-block-data
new file mode 100644
index 0000000000..63d4e21d0a
--- /dev/null
+++ b/t/t4018/fortran-block-data
@@ -0,0 +1,5 @@
+ BLOCK DATA RIGHT
+
+ COMMON /B/ C, ChangeMe
+ DATA C, ChangeMe / 2.0, 6.0 /
+ END
diff --git a/t/t4018/fortran-comment b/t/t4018/fortran-comment
new file mode 100644
index 0000000000..7b10d17658
--- /dev/null
+++ b/t/t4018/fortran-comment
@@ -0,0 +1,13 @@
+ module a
+
+ contains
+
+ ! subroutine wrong
+ subroutine RIGHT
+ ! subroutine wrong
+
+ real ChangeMe
+
+ end subroutine RIGHT
+
+ end module a
diff --git a/t/t4018/fortran-comment-keyword b/t/t4018/fortran-comment-keyword
new file mode 100644
index 0000000000..e9206a5379
--- /dev/null
+++ b/t/t4018/fortran-comment-keyword
@@ -0,0 +1,14 @@
+ module a
+
+ contains
+
+ subroutine RIGHT (funcA, funcB)
+
+ real funcA ! grid function a
+ real funcB ! grid function b
+
+ real ChangeMe
+
+ end subroutine RIGHT
+
+ end module a
diff --git a/t/t4018/fortran-comment-legacy b/t/t4018/fortran-comment-legacy
new file mode 100644
index 0000000000..53cd062c1e
--- /dev/null
+++ b/t/t4018/fortran-comment-legacy
@@ -0,0 +1,13 @@
+ module a
+
+ contains
+
+C subroutine wrong
+ subroutine RIGHT
+C subroutine wrong
+
+ real ChangeMe
+
+ end subroutine RIGHT
+
+ end module a
diff --git a/t/t4018/fortran-comment-legacy-star b/t/t4018/fortran-comment-legacy-star
new file mode 100644
index 0000000000..2cbcdc3d8a
--- /dev/null
+++ b/t/t4018/fortran-comment-legacy-star
@@ -0,0 +1,13 @@
+ module a
+
+ contains
+
+* subroutine wrong
+ subroutine RIGHT
+* subroutine wrong
+
+ real ChangeMe
+
+ end subroutine RIGHT
+
+ end module a
diff --git a/t/t4018/fortran-external-function b/t/t4018/fortran-external-function
new file mode 100644
index 0000000000..5a2d85d3aa
--- /dev/null
+++ b/t/t4018/fortran-external-function
@@ -0,0 +1,9 @@
+function RIGHT(a, b) result(c)
+
+integer, intent(in) :: ChangeMe
+integer, intent(in) :: b
+integer, intent(out) :: c
+
+c = a+b
+
+end function RIGHT
diff --git a/t/t4018/fortran-external-subroutine b/t/t4018/fortran-external-subroutine
new file mode 100644
index 0000000000..4ce85fea13
--- /dev/null
+++ b/t/t4018/fortran-external-subroutine
@@ -0,0 +1,5 @@
+subroutine RIGHT
+
+real ChangeMe
+
+end subroutine RIGHT
diff --git a/t/t4018/fortran-module b/t/t4018/fortran-module
new file mode 100644
index 0000000000..c4b737dac3
--- /dev/null
+++ b/t/t4018/fortran-module
@@ -0,0 +1,5 @@
+module RIGHT
+
+use ChangeMe
+
+end module RIGHT
diff --git a/t/t4018/fortran-module-procedure b/t/t4018/fortran-module-procedure
new file mode 100644
index 0000000000..1ce6d854c2
--- /dev/null
+++ b/t/t4018/fortran-module-procedure
@@ -0,0 +1,13 @@
+ module RIGHT
+
+ implicit none
+ private
+
+ interface letters ! generic interface
+ module procedure aaaa, &
+ bbbb, &
+ ChangeMe, &
+ dddd
+ end interface
+
+end module RIGHT
diff --git a/t/t4018/fortran-program b/t/t4018/fortran-program
new file mode 100644
index 0000000000..4616895e4b
--- /dev/null
+++ b/t/t4018/fortran-program
@@ -0,0 +1,5 @@
+program RIGHT
+
+call ChangeMe
+
+end program RIGHT
diff --git a/t/t4140-apply-ita.sh b/t/t4140-apply-ita.sh
new file mode 100755
index 0000000000..c614eaf04c
--- /dev/null
+++ b/t/t4140-apply-ita.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+test_description='git apply of i-t-a file'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ test_write_lines 1 2 3 4 5 >blueprint &&
+
+ cat blueprint >test-file &&
+ git add -N test-file &&
+ git diff >creation-patch &&
+ grep "new file mode 100644" creation-patch &&
+
+ rm -f test-file &&
+ git diff >deletion-patch &&
+ grep "deleted file mode 100644" deletion-patch
+'
+
+test_expect_success 'apply creation patch to ita path (--cached)' '
+ git rm -f test-file &&
+ cat blueprint >test-file &&
+ git add -N test-file &&
+
+ git apply --cached creation-patch &&
+ git cat-file blob :test-file >actual &&
+ test_cmp blueprint actual
+'
+
+test_expect_success 'apply creation patch to ita path (--index)' '
+ git rm -f test-file &&
+ cat blueprint >test-file &&
+ git add -N test-file &&
+ rm -f test-file &&
+
+ test_must_fail git apply --index creation-patch
+'
+
+test_expect_success 'apply deletion patch to ita path (--cached)' '
+ git rm -f test-file &&
+ cat blueprint >test-file &&
+ git add -N test-file &&
+
+ git apply --cached deletion-patch &&
+ test_must_fail git ls-files --stage --error-unmatch test-file
+'
+
+test_expect_success 'apply deletion patch to ita path (--index)' '
+ cat blueprint >test-file &&
+ git add -N test-file &&
+
+ test_must_fail git apply --index deletion-patch &&
+ git ls-files --stage --error-unmatch test-file
+'
+
+test_done
diff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh
index c21cc160f3..4bb9e9dbe2 100755
--- a/t/t4216-log-bloom.sh
+++ b/t/t4216-log-bloom.sh
@@ -30,12 +30,17 @@ test_expect_success 'setup test - repo, commits, commit graph, log outputs' '
rm file_to_be_deleted &&
git add . &&
git commit -m "file removed" &&
- git commit-graph write --reachable --changed-paths
+ git commit-graph write --reachable --changed-paths &&
+
+ test_oid_cache <<-EOF
+ oid_version sha1:1
+ oid_version sha256:2
+ EOF
'
graph_read_expect () {
NUM_CHUNKS=5
cat >expect <<- EOF
- header: 43475048 1 1 $NUM_CHUNKS 0
+ header: 43475048 1 $(test_oid oid_version) $NUM_CHUNKS 0
num_commits: $1
chunks: oid_fanout oid_lookup commit_metadata bloom_indexes bloom_data
EOF
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index 044cf8a3de..2ed0c1544d 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -10,7 +10,12 @@ test_expect_success 'setup full repo' '
cd "$TRASH_DIRECTORY/full" &&
git init &&
git config core.commitGraph true &&
- objdir=".git/objects"
+ objdir=".git/objects" &&
+
+ test_oid_cache <<-EOF
+ oid_version sha1:1
+ oid_version sha256:2
+ EOF
'
test_expect_success POSIXPERM 'tweak umask for modebit tests' '
@@ -77,7 +82,7 @@ graph_read_expect() {
NUM_CHUNKS=$((3 + $(echo "$2" | wc -w)))
fi
cat >expect <<- EOF
- header: 43475048 1 1 $NUM_CHUNKS 0
+ header: 43475048 1 $(test_oid oid_version) $NUM_CHUNKS 0
num_commits: $1
chunks: oid_fanout oid_lookup commit_metadata$OPTIONAL
EOF
@@ -412,6 +417,35 @@ test_expect_success 'replace-objects invalidates commit-graph' '
)
'
+test_expect_success 'warn on improper hash version' '
+ git init --object-format=sha1 sha1 &&
+ (
+ cd sha1 &&
+ test_commit 1 &&
+ git commit-graph write --reachable &&
+ mv .git/objects/info/commit-graph ../cg-sha1
+ ) &&
+ git init --object-format=sha256 sha256 &&
+ (
+ cd sha256 &&
+ test_commit 1 &&
+ git commit-graph write --reachable &&
+ mv .git/objects/info/commit-graph ../cg-sha256
+ ) &&
+ (
+ cd sha1 &&
+ mv ../cg-sha256 .git/objects/info/commit-graph &&
+ git log -1 2>err &&
+ test_i18ngrep "commit-graph hash version 2 does not match version 1" err
+ ) &&
+ (
+ cd sha256 &&
+ mv ../cg-sha1 .git/objects/info/commit-graph &&
+ git log -1 2>err &&
+ test_i18ngrep "commit-graph hash version 1 does not match version 2" err
+ )
+'
+
# the verify tests below expect the commit-graph to contain
# exactly the commits reachable from the commits/8 branch.
# If the file changes the set of commits in the list, then the
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index 7dfff0f8f4..43b1b5b2af 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -5,6 +5,8 @@ test_description='multi-pack-indexes'
objdir=.git/objects
+HASH_LEN=$(test_oid rawsz)
+
midx_read_expect () {
NUM_PACKS=$1
NUM_OBJECTS=$2
@@ -13,7 +15,7 @@ midx_read_expect () {
EXTRA_CHUNKS="$5"
{
cat <<-EOF &&
- header: 4d494458 1 $NUM_CHUNKS $NUM_PACKS
+ header: 4d494458 1 $HASH_LEN $NUM_CHUNKS $NUM_PACKS
chunks: pack-names oid-fanout oid-lookup object-offsets$EXTRA_CHUNKS
num_objects: $NUM_OBJECTS
packs:
@@ -46,7 +48,7 @@ test_expect_success "don't write midx with no packs" '
test_path_is_missing pack/multi-pack-index
'
-test_expect_success "Warn if a midx contains no oid" '
+test_expect_success SHA1 'warn if a midx contains no oid' '
cp "$TEST_DIRECTORY"/t5319/no-objects.midx $objdir/pack/multi-pack-index &&
test_must_fail git multi-pack-index verify &&
rm $objdir/pack/multi-pack-index
@@ -198,6 +200,40 @@ test_expect_success 'write midx with twelve packs' '
compare_results_with_midx "twelve packs"
+test_expect_success 'warn on improper hash version' '
+ git init --object-format=sha1 sha1 &&
+ (
+ cd sha1 &&
+ git config core.multiPackIndex true &&
+ test_commit 1 &&
+ git repack -a &&
+ git multi-pack-index write &&
+ mv .git/objects/pack/multi-pack-index ../mpi-sha1
+ ) &&
+ git init --object-format=sha256 sha256 &&
+ (
+ cd sha256 &&
+ git config core.multiPackIndex true &&
+ test_commit 1 &&
+ git repack -a &&
+ git multi-pack-index write &&
+ mv .git/objects/pack/multi-pack-index ../mpi-sha256
+ ) &&
+ (
+ cd sha1 &&
+ mv ../mpi-sha256 .git/objects/pack/multi-pack-index &&
+ git log -1 2>err &&
+ test_i18ngrep "multi-pack-index hash version 2 does not match version 1" err
+ ) &&
+ (
+ cd sha256 &&
+ mv ../mpi-sha1 .git/objects/pack/multi-pack-index &&
+ git log -1 2>err &&
+ test_i18ngrep "multi-pack-index hash version 1 does not match version 2" err
+ )
+'
+
+
test_expect_success 'verify multi-pack-index success' '
git multi-pack-index verify --object-dir=$objdir
'
@@ -243,7 +279,6 @@ test_expect_success 'verify bad signature' '
"multi-pack-index signature"
'
-HASH_LEN=$(test_oid rawsz)
NUM_OBJECTS=74
MIDX_BYTE_VERSION=4
MIDX_BYTE_OID_VERSION=5
@@ -272,7 +307,7 @@ test_expect_success 'verify bad version' '
'
test_expect_success 'verify bad OID version' '
- corrupt_midx_and_verify $MIDX_BYTE_OID_VERSION "\02" $objdir \
+ corrupt_midx_and_verify $MIDX_BYTE_OID_VERSION "\03" $objdir \
"hash version"
'
@@ -642,6 +677,7 @@ test_expect_success 'expire respects .keep files' '
'
test_expect_success 'repack --batch-size=0 repacks everything' '
+ cp -r dup dup2 &&
(
cd dup &&
rm .git/objects/pack/*.keep &&
@@ -661,4 +697,21 @@ test_expect_success 'repack --batch-size=0 repacks everything' '
)
'
+test_expect_success 'repack --batch-size=<large> repacks everything' '
+ (
+ cd dup2 &&
+ rm .git/objects/pack/*.keep &&
+ ls .git/objects/pack/*idx >idx-list &&
+ test_line_count = 2 idx-list &&
+ git multi-pack-index repack --batch-size=2000000 &&
+ ls .git/objects/pack/*idx >idx-list &&
+ test_line_count = 3 idx-list &&
+ test-tool read-midx .git/objects | grep idx >midx-list &&
+ test_line_count = 3 midx-list &&
+ git multi-pack-index expire &&
+ ls -al .git/objects/pack/*idx >idx-list &&
+ test_line_count = 1 idx-list
+ )
+'
+
test_done
diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh
index ea28d522b8..18216463c7 100755
--- a/t/t5324-split-commit-graph.sh
+++ b/t/t5324-split-commit-graph.sh
@@ -18,6 +18,9 @@ test_expect_success 'setup repo' '
base sha1:1376
base sha256:1496
+
+ oid_version sha1:1
+ oid_version sha256:2
EOM
'
@@ -28,7 +31,7 @@ graph_read_expect() {
NUM_BASE=$2
fi
cat >expect <<- EOF
- header: 43475048 1 1 3 $NUM_BASE
+ header: 43475048 1 $(test_oid oid_version) 3 $NUM_BASE
num_commits: $1
chunks: oid_fanout oid_lookup commit_metadata
EOF
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 25695dfe22..2a1abe91f0 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -543,13 +543,24 @@ test_expect_success 'fetch into the current branch with --update-head-ok' '
'
-test_expect_success 'fetch --dry-run' '
-
+test_expect_success 'fetch --dry-run does not touch FETCH_HEAD' '
rm -f .git/FETCH_HEAD &&
git fetch --dry-run . &&
! test -f .git/FETCH_HEAD
'
+test_expect_success '--no-write-fetch-head does not touch FETCH_HEAD' '
+ rm -f .git/FETCH_HEAD &&
+ git fetch --no-write-fetch-head . &&
+ ! test -f .git/FETCH_HEAD
+'
+
+test_expect_success '--write-fetch-head gets defeated by --dry-run' '
+ rm -f .git/FETCH_HEAD &&
+ git fetch --dry-run --write-fetch-head . &&
+ ! test -f .git/FETCH_HEAD
+'
+
test_expect_success "should be able to fetch with duplicate refspecs" '
mkdir dups &&
(
diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh
index 159afa7ac8..db1a381cd9 100755
--- a/t/t5521-pull-options.sh
+++ b/t/t5521-pull-options.sh
@@ -85,6 +85,13 @@ test_expect_success 'git pull --cleanup errors early on invalid argument' '
test -s err)
'
+test_expect_success 'git pull --no-write-fetch-head fails' '
+ mkdir clonedwfh &&
+ (cd clonedwfh && git init &&
+ test_expect_code 129 git pull --no-write-fetch-head "../parent" >out 2>err &&
+ test_must_be_empty out &&
+ test_i18ngrep "no-write-fetch-head" err)
+'
test_expect_success 'git pull --force' '
mkdir clonedoldstyle &&
diff --git a/t/t6000-rev-list-misc.sh b/t/t6000-rev-list-misc.sh
index 3bb0e4ff8f..fc4d55dcb2 100755
--- a/t/t6000-rev-list-misc.sh
+++ b/t/t6000-rev-list-misc.sh
@@ -128,8 +128,8 @@ test_expect_success 'rev-list can negate index objects' '
test_cmp expect actual
'
-test_expect_success '--bisect and --first-parent can not be combined' '
- test_must_fail git rev-list --bisect --first-parent HEAD
+test_expect_success '--bisect and --first-parent can be combined' '
+ git rev-list --bisect --first-parent HEAD
'
test_expect_success '--header shows a NUL after each commit' '
diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh
index a661408038..b95a0212ad 100755
--- a/t/t6002-rev-list-bisect.sh
+++ b/t/t6002-rev-list-bisect.sh
@@ -263,4 +263,49 @@ test_expect_success 'rev-parse --bisect can default to good/bad refs' '
test_cmp expect.sorted actual.sorted
'
+test_output_expect_success '--bisect --first-parent' 'git rev-list --bisect --first-parent E ^F' <<EOF
+e4
+EOF
+
+test_output_expect_success '--first-parent' 'git rev-list --first-parent E ^F' <<EOF
+E
+e1
+e2
+e3
+e4
+e5
+e6
+e7
+e8
+EOF
+
+test_output_expect_success '--bisect-vars --first-parent' 'git rev-list --bisect-vars --first-parent E ^F' <<EOF
+bisect_rev='e5'
+bisect_nr=4
+bisect_good=4
+bisect_bad=3
+bisect_all=9
+bisect_steps=2
+EOF
+
+test_expect_success '--bisect-all --first-parent' '
+ cat >expect.unsorted <<-EOF &&
+ $(git rev-parse E) (tag: E, dist=0)
+ $(git rev-parse e1) (tag: e1, dist=1)
+ $(git rev-parse e2) (tag: e2, dist=2)
+ $(git rev-parse e3) (tag: e3, dist=3)
+ $(git rev-parse e4) (tag: e4, dist=4)
+ $(git rev-parse e5) (tag: e5, dist=4)
+ $(git rev-parse e6) (tag: e6, dist=3)
+ $(git rev-parse e7) (tag: e7, dist=2)
+ $(git rev-parse e8) (tag: e8, dist=1)
+ EOF
+
+ # expect results to be ordered by distance (descending),
+ # commit hash (ascending)
+ sort -k4,4r -k1,1 expect.unsorted >expect &&
+ git rev-list --bisect-all --first-parent E ^F >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 36d9b2b2e4..b886529e59 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -243,32 +243,30 @@ test_expect_success 'bisect skip: with commit both bad and skipped' '
'
# We want to automatically find the commit that
-# introduced "Another" into hello.
-test_expect_success \
- '"git bisect run" simple case' \
- 'echo "#"\!"/bin/sh" > test_script.sh &&
- echo "grep Another hello > /dev/null" >> test_script.sh &&
- echo "test \$? -ne 0" >> test_script.sh &&
- chmod +x test_script.sh &&
- git bisect start &&
- git bisect good $HASH1 &&
- git bisect bad $HASH4 &&
- git bisect run ./test_script.sh > my_bisect_log.txt &&
- grep "$HASH3 is the first bad commit" my_bisect_log.txt &&
- git bisect reset'
+# added "Another" into hello.
+test_expect_success '"git bisect run" simple case' '
+ write_script test_script.sh <<-\EOF &&
+ ! grep Another hello >/dev/null
+ EOF
+ git bisect start &&
+ git bisect good $HASH1 &&
+ git bisect bad $HASH4 &&
+ git bisect run ./test_script.sh >my_bisect_log.txt &&
+ grep "$HASH3 is the first bad commit" my_bisect_log.txt &&
+ git bisect reset
+'
# We want to automatically find the commit that
-# introduced "Ciao" into hello.
-test_expect_success \
- '"git bisect run" with more complex "git bisect start"' \
- 'echo "#"\!"/bin/sh" > test_script.sh &&
- echo "grep Ciao hello > /dev/null" >> test_script.sh &&
- echo "test \$? -ne 0" >> test_script.sh &&
- chmod +x test_script.sh &&
- git bisect start $HASH4 $HASH1 &&
- git bisect run ./test_script.sh > my_bisect_log.txt &&
- grep "$HASH4 is the first bad commit" my_bisect_log.txt &&
- git bisect reset'
+# added "Ciao" into hello.
+test_expect_success '"git bisect run" with more complex "git bisect start"' '
+ write_script test_script.sh <<-\EOF &&
+ ! grep Ciao hello >/dev/null
+ EOF
+ git bisect start $HASH4 $HASH1 &&
+ git bisect run ./test_script.sh >my_bisect_log.txt &&
+ grep "$HASH4 is the first bad commit" my_bisect_log.txt &&
+ git bisect reset
+'
# $HASH1 is good, $HASH5 is bad, we skip $HASH3
# but $HASH4 is good,
@@ -295,24 +293,17 @@ HASH6=
test_expect_success 'bisect run & skip: cannot tell between 2' '
add_line_into_file "6: Yet a line." hello &&
HASH6=$(git rev-parse --verify HEAD) &&
- echo "#"\!"/bin/sh" > test_script.sh &&
- echo "sed -ne \\\$p hello | grep Ciao > /dev/null && exit 125" >> test_script.sh &&
- echo "grep line hello > /dev/null" >> test_script.sh &&
- echo "test \$? -ne 0" >> test_script.sh &&
- chmod +x test_script.sh &&
+ write_script test_script.sh <<-\EOF &&
+ sed -ne \$p hello | grep Ciao >/dev/null && exit 125
+ ! grep line hello >/dev/null
+ EOF
git bisect start $HASH6 $HASH1 &&
- if git bisect run ./test_script.sh > my_bisect_log.txt
- then
- echo Oops, should have failed.
- false
- else
- test $? -eq 2 &&
- grep "first bad commit could be any of" my_bisect_log.txt &&
- ! grep $HASH3 my_bisect_log.txt &&
- ! grep $HASH6 my_bisect_log.txt &&
- grep $HASH4 my_bisect_log.txt &&
- grep $HASH5 my_bisect_log.txt
- fi
+ test_expect_code 2 git bisect run ./test_script.sh >my_bisect_log.txt &&
+ grep "first bad commit could be any of" my_bisect_log.txt &&
+ ! grep $HASH3 my_bisect_log.txt &&
+ ! grep $HASH6 my_bisect_log.txt &&
+ grep $HASH4 my_bisect_log.txt &&
+ grep $HASH5 my_bisect_log.txt
'
HASH7=
@@ -320,14 +311,13 @@ test_expect_success 'bisect run & skip: find first bad' '
git bisect reset &&
add_line_into_file "7: Should be the last line." hello &&
HASH7=$(git rev-parse --verify HEAD) &&
- echo "#"\!"/bin/sh" > test_script.sh &&
- echo "sed -ne \\\$p hello | grep Ciao > /dev/null && exit 125" >> test_script.sh &&
- echo "sed -ne \\\$p hello | grep day > /dev/null && exit 125" >> test_script.sh &&
- echo "grep Yet hello > /dev/null" >> test_script.sh &&
- echo "test \$? -ne 0" >> test_script.sh &&
- chmod +x test_script.sh &&
+ write_script test_script.sh <<-\EOF &&
+ sed -ne \$p hello | grep Ciao >/dev/null && exit 125
+ sed -ne \$p hello | grep day >/dev/null && exit 125
+ ! grep Yet hello >/dev/null
+ EOF
git bisect start $HASH7 $HASH1 &&
- git bisect run ./test_script.sh > my_bisect_log.txt &&
+ git bisect run ./test_script.sh >my_bisect_log.txt &&
grep "$HASH6 is the first bad commit" my_bisect_log.txt
'
@@ -458,6 +448,24 @@ test_expect_success 'many merge bases creation' '
grep "$SIDE_HASH5" merge_bases.txt
'
+# We want to automatically find the merge that
+# added "line" into hello.
+test_expect_success '"git bisect run --first-parent" simple case' '
+ git rev-list --first-parent $B_HASH ^$HASH4 >first_parent_chain.txt &&
+ write_script test_script.sh <<-\EOF &&
+ grep $(git rev-parse HEAD) first_parent_chain.txt || exit -1
+ ! grep line hello >/dev/null
+ EOF
+ git bisect start --first-parent &&
+ test_path_is_file ".git/BISECT_FIRST_PARENT" &&
+ git bisect good $HASH4 &&
+ git bisect bad $B_HASH &&
+ git bisect run ./test_script.sh >my_bisect_log.txt &&
+ grep "$B_HASH is the first bad commit" my_bisect_log.txt &&
+ git bisect reset &&
+ test_path_is_missing .git/BISECT_FIRST_PARENT
+'
+
test_expect_success 'good merge bases when good and bad are siblings' '
git bisect start "$B_HASH" "$A_HASH" > my_bisect_log.txt &&
test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
diff --git a/t/t6020-merge-df.sh b/t/t6400-merge-df.sh
index 400a4cd139..400a4cd139 100755
--- a/t/t6020-merge-df.sh
+++ b/t/t6400-merge-df.sh
diff --git a/t/t6021-merge-criss-cross.sh b/t/t6401-merge-criss-cross.sh
index 9d5e992878..9d5e992878 100755
--- a/t/t6021-merge-criss-cross.sh
+++ b/t/t6401-merge-criss-cross.sh
diff --git a/t/t6022-merge-rename.sh b/t/t6402-merge-rename.sh
index bbbba3dcbf..bbbba3dcbf 100755
--- a/t/t6022-merge-rename.sh
+++ b/t/t6402-merge-rename.sh
diff --git a/t/t6023-merge-file.sh b/t/t6403-merge-file.sh
index 2f421d967a..2f421d967a 100755
--- a/t/t6023-merge-file.sh
+++ b/t/t6403-merge-file.sh
diff --git a/t/t6024-recursive-merge.sh b/t/t6404-recursive-merge.sh
index 332cfc53fd..332cfc53fd 100755
--- a/t/t6024-recursive-merge.sh
+++ b/t/t6404-recursive-merge.sh
diff --git a/t/t6025-merge-symlinks.sh b/t/t6405-merge-symlinks.sh
index 6c0a90d044..6c0a90d044 100755
--- a/t/t6025-merge-symlinks.sh
+++ b/t/t6405-merge-symlinks.sh
diff --git a/t/t6026-merge-attr.sh b/t/t6406-merge-attr.sh
index 76a55f838c..76a55f838c 100755
--- a/t/t6026-merge-attr.sh
+++ b/t/t6406-merge-attr.sh
diff --git a/t/t6027-merge-binary.sh b/t/t6407-merge-binary.sh
index 4e6c7cb77e..4e6c7cb77e 100755
--- a/t/t6027-merge-binary.sh
+++ b/t/t6407-merge-binary.sh
diff --git a/t/t6028-merge-up-to-date.sh b/t/t6408-merge-up-to-date.sh
index 7763c1ba98..7763c1ba98 100755
--- a/t/t6028-merge-up-to-date.sh
+++ b/t/t6408-merge-up-to-date.sh
diff --git a/t/t6029-merge-subtree.sh b/t/t6409-merge-subtree.sh
index 793f0c8bf3..793f0c8bf3 100755
--- a/t/t6029-merge-subtree.sh
+++ b/t/t6409-merge-subtree.sh
diff --git a/t/t6031-merge-filemode.sh b/t/t6411-merge-filemode.sh
index 87741efad3..87741efad3 100755
--- a/t/t6031-merge-filemode.sh
+++ b/t/t6411-merge-filemode.sh
diff --git a/t/t6032-merge-large-rename.sh b/t/t6412-merge-large-rename.sh
index 80777386dc..80777386dc 100755
--- a/t/t6032-merge-large-rename.sh
+++ b/t/t6412-merge-large-rename.sh
diff --git a/t/t6033-merge-crlf.sh b/t/t6413-merge-crlf.sh
index e8d65eefb5..e8d65eefb5 100755
--- a/t/t6033-merge-crlf.sh
+++ b/t/t6413-merge-crlf.sh
diff --git a/t/t6034-merge-rename-nocruft.sh b/t/t6414-merge-rename-nocruft.sh
index a25e730460..a25e730460 100755
--- a/t/t6034-merge-rename-nocruft.sh
+++ b/t/t6414-merge-rename-nocruft.sh
diff --git a/t/t6035-merge-dir-to-symlink.sh b/t/t6415-merge-dir-to-symlink.sh
index 2eddcc7664..2eddcc7664 100755
--- a/t/t6035-merge-dir-to-symlink.sh
+++ b/t/t6415-merge-dir-to-symlink.sh
diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6416-recursive-corner-cases.sh
index b3bf462617..fd98989b14 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6416-recursive-corner-cases.sh
@@ -452,7 +452,7 @@ test_expect_success 'git detects conflict merging criss-cross+modify/delete, rev
#
# So choice 5 at least provides some kind of conflict for the original case,
# and can merge cleanly as expected with D1 and E3. It also made things just
-# slightly funny for merging D1 and e$, where E4 is defined as:
+# slightly funny for merging D1 and E4, where E4 is defined as:
# Commit E4: Merge B & C, modifying 'a' and renaming to 'a2', and deleting 'a/'
# in this case, we'll get a rename/rename(1to2) conflict because a~$UNIQUE
# gets renamed to 'a' in D1 and to 'a2' in E4. But that's better than having
@@ -1144,7 +1144,7 @@ test_expect_failure 'check symlink add/add' '
test_must_fail git merge -s recursive E^0 &&
git ls-files -s >out &&
- test_line_count = 2 out &&
+ test_line_count = 3 out &&
git ls-files -u >out &&
test_line_count = 2 out &&
git ls-files -o >out &&
diff --git a/t/t6037-merge-ours-theirs.sh b/t/t6417-merge-ours-theirs.sh
index 0aebc6c028..0aebc6c028 100755
--- a/t/t6037-merge-ours-theirs.sh
+++ b/t/t6417-merge-ours-theirs.sh
diff --git a/t/t6038-merge-text-auto.sh b/t/t6418-merge-text-auto.sh
index 89c86d4e56..30983d18b1 100755
--- a/t/t6038-merge-text-auto.sh
+++ b/t/t6418-merge-text-auto.sh
@@ -197,7 +197,8 @@ test_expect_success 'Test delete/normalize conflict' '
git commit -m "remove file" &&
git checkout master &&
git reset --hard a^ &&
- git merge side
+ git merge side &&
+ test_path_is_missing file
'
test_done
diff --git a/t/t6039-merge-ignorecase.sh b/t/t6419-merge-ignorecase.sh
index 531850d834..531850d834 100755
--- a/t/t6039-merge-ignorecase.sh
+++ b/t/t6419-merge-ignorecase.sh
diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6422-merge-rename-corner-cases.sh
index f163893ff9..3375eaf4e7 100755
--- a/t/t6042-merge-rename-corner-cases.sh
+++ b/t/t6422-merge-rename-corner-cases.sh
@@ -457,7 +457,7 @@ test_expect_success 'handle rename-with-content-merge vs. add' '
git checkout A^0 &&
test_must_fail git merge -s recursive B^0 >out &&
- test_i18ngrep "CONFLICT (rename/add)" out &&
+ test_i18ngrep "CONFLICT (.*/add)" out &&
git ls-files -s >out &&
test_line_count = 2 out &&
@@ -503,7 +503,7 @@ test_expect_success 'handle rename-with-content-merge vs. add, merge other way'
git checkout B^0 &&
test_must_fail git merge -s recursive A^0 >out &&
- test_i18ngrep "CONFLICT (rename/add)" out &&
+ test_i18ngrep "CONFLICT (.*/add)" out &&
git ls-files -s >out &&
test_line_count = 2 out &&
@@ -583,7 +583,7 @@ test_expect_success 'handle rename/rename (2to1) conflict correctly' '
git checkout B^0 &&
test_must_fail git merge -s recursive C^0 >out &&
- test_i18ngrep "CONFLICT (rename/rename)" out &&
+ test_i18ngrep "CONFLICT (\(.*\)/\1)" out &&
git ls-files -s >out &&
test_line_count = 2 out &&
@@ -886,12 +886,17 @@ test_expect_failure 'rad-check: rename/add/delete conflict' '
git checkout B^0 &&
test_must_fail git merge -s recursive A^0 >out 2>err &&
- # Not sure whether the output should contain just one
- # "CONFLICT (rename/add/delete)" line, or if it should break
- # it into a pair of "CONFLICT (rename/delete)" and
- # "CONFLICT (rename/add)"; allow for either.
- test_i18ngrep "CONFLICT (rename.*add)" out &&
- test_i18ngrep "CONFLICT (rename.*delete)" out &&
+ # Instead of requiring the output to contain one combined line
+ # CONFLICT (rename/add/delete)
+ # or perhaps two lines:
+ # CONFLICT (rename/add): new file collides with rename target
+ # CONFLICT (rename/delete): rename source removed on other side
+ # and instead of requiring "rename/add" instead of "add/add",
+ # be flexible in the type of console output message(s) reported
+ # for this particular case; we will be more stringent about the
+ # contents of the index and working directory.
+ test_i18ngrep "CONFLICT (.*/add)" out &&
+ test_i18ngrep "CONFLICT (rename.*/delete)" out &&
test_must_be_empty err &&
git ls-files -s >file_count &&
@@ -899,14 +904,14 @@ test_expect_failure 'rad-check: rename/add/delete conflict' '
git ls-files -u >file_count &&
test_line_count = 2 file_count &&
git ls-files -o >file_count &&
- test_line_count = 2 file_count &&
+ test_line_count = 3 file_count &&
git rev-parse >actual \
:2:bar :3:bar &&
git rev-parse >expect \
B:bar A:bar &&
- test_cmp file_is_missing foo &&
+ test_path_is_missing foo &&
# bar should have two-way merged contents of the different
# versions of bar; check that content from both sides is
# present.
@@ -954,11 +959,17 @@ test_expect_failure 'rrdd-check: rename/rename(2to1)/delete/delete conflict' '
git checkout A^0 &&
test_must_fail git merge -s recursive B^0 >out 2>err &&
- # Not sure whether the output should contain just one
- # "CONFLICT (rename/rename/delete/delete)" line, or if it
- # should break it into three: "CONFLICT (rename/rename)" and
- # two "CONFLICT (rename/delete)" lines; allow for either.
- test_i18ngrep "CONFLICT (rename/rename)" out &&
+ # Instead of requiring the output to contain one combined line
+ # CONFLICT (rename/rename/delete/delete)
+ # or perhaps two lines:
+ # CONFLICT (rename/rename): ...
+ # CONFLICT (rename/delete): info about pair 1
+ # CONFLICT (rename/delete): info about pair 2
+ # and instead of requiring "rename/rename" instead of "add/add",
+ # be flexible in the type of console output message(s) reported
+ # for this particular case; we will be more stringent about the
+ # contents of the index and working directory.
+ test_i18ngrep "CONFLICT (\(.*\)/\1)" out &&
test_i18ngrep "CONFLICT (rename.*delete)" out &&
test_must_be_empty err &&
@@ -967,15 +978,15 @@ test_expect_failure 'rrdd-check: rename/rename(2to1)/delete/delete conflict' '
git ls-files -u >file_count &&
test_line_count = 2 file_count &&
git ls-files -o >file_count &&
- test_line_count = 2 file_count &&
+ test_line_count = 3 file_count &&
git rev-parse >actual \
:2:baz :3:baz &&
git rev-parse >expect \
O:foo O:bar &&
- test_cmp file_is_missing foo &&
- test_cmp file_is_missing bar &&
+ test_path_is_missing foo &&
+ test_path_is_missing bar &&
# baz should have two-way merged contents of the original
# contents of foo and bar; check that content from both sides
# is present.
@@ -1042,25 +1053,25 @@ test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename
test_must_be_empty err &&
git ls-files -s >file_count &&
- test_line_count = 6 file_count &&
+ test_line_count = 9 file_count &&
git ls-files -u >file_count &&
- test_line_count = 6 file_count &&
+ test_line_count = 9 file_count &&
git ls-files -o >file_count &&
test_line_count = 3 file_count &&
test_seq 10 20 >merged-one &&
test_seq 51 60 >merged-five &&
# Determine what the merge of three would give us.
- test_seq 30 40 >three-side-A &&
+ test_seq 31 39 >three-base &&
+ test_seq 31 40 >three-side-A &&
test_seq 31 39 >three-side-B &&
- echo forty >three-side-B &&
- >empty &&
+ echo forty >>three-side-B &&
test_must_fail git merge-file \
- -L "HEAD" \
+ -L "HEAD:four" \
-L "" \
- -L "B^0" \
- three-side-A empty three-side-B &&
- sed -e "s/^\([<=>]\)/\1\1\1/" three-side-A >merged-three &&
+ -L "B^0:two" \
+ three-side-A three-base three-side-B &&
+ sed -e "s/^\([<=>]\)/\1\1/" three-side-A >merged-three &&
# Verify the index is as expected
git rev-parse >actual \
@@ -1075,6 +1086,7 @@ test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename
git cat-file -p :2:two >expect &&
git cat-file -p :3:two >other &&
+ >empty &&
test_must_fail git merge-file \
-L "HEAD" -L "" -L "B^0" \
expect empty other &&
diff --git a/t/t6043-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh
index 83792c5ef1..f7ecbb886d 100755
--- a/t/t6043-merge-rename-directories.sh
+++ b/t/t6423-merge-rename-directories.sh
@@ -275,7 +275,7 @@ test_expect_success '1d: Directory renames cause a rename/rename(2to1) conflict'
git checkout A^0 &&
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
- test_i18ngrep "CONFLICT (rename/rename)" out &&
+ test_i18ngrep "CONFLICT (\(.*\)/\1)" out &&
git ls-files -s >out &&
test_line_count = 8 out &&
@@ -1686,7 +1686,7 @@ test_expect_success '7b: rename/rename(2to1), but only due to transitive rename'
git checkout A^0 &&
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
- test_i18ngrep "CONFLICT (rename/rename)" out &&
+ test_i18ngrep "CONFLICT (\(.*\)/\1)" out &&
git ls-files -s >out &&
test_line_count = 4 out &&
@@ -2260,24 +2260,23 @@ test_expect_success '8d: rename/delete...or not?' '
# Commit B: w/{b,c}, z/d
#
# Possible Resolutions:
-# w/o dir-rename detection: z/d, CONFLICT(z/b -> y/b vs. w/b),
-# CONFLICT(z/c -> y/c vs. w/c)
-# Currently expected: y/d, CONFLICT(z/b -> y/b vs. w/b),
-# CONFLICT(z/c -> y/c vs. w/c)
-# Optimal: ??
+# if z not considered renamed: z/d, CONFLICT(z/b -> y/b vs. w/b),
+# CONFLICT(z/c -> y/c vs. w/c)
+# if z->y rename considered: y/d, CONFLICT(z/b -> y/b vs. w/b),
+# CONFLICT(z/c -> y/c vs. w/c)
+# Optimal: ??
#
# Notes: In commit A, directory z got renamed to y. In commit B, directory z
# did NOT get renamed; the directory is still present; instead it is
# considered to have just renamed a subset of paths in directory z
-# elsewhere. Therefore, the directory rename done in commit A to z/
-# applies to z/d and maps it to y/d.
+# elsewhere. However, this is much like testcase 6b (where commit B
+# moves all the original paths out of z/ but opted to keep d
+# within z/). This makes it hard to judge where d should end up.
#
# It's possible that users would get confused about this, but what
-# should we do instead? Silently leaving at z/d seems just as bad or
-# maybe even worse. Perhaps we could print a big warning about z/d
-# and how we're moving to y/d in this case, but when I started thinking
-# about the ramifications of doing that, I didn't know how to rule out
-# that opening other weird edge and corner cases so I just punted.
+# should we do instead? It's not at all clear to me whether z/d or
+# y/d or something else is a better resolution here, and other cases
+# start getting really tricky, so I just picked one.
test_setup_8e () {
test_create_repo 8e &&
@@ -2844,6 +2843,14 @@ test_expect_success '9f: Renamed directory that only contained immediate subdirs
# Commit A: priority/{alpha,bravo}/$more_files
# Commit B: goal/{a,b}/$more_files, goal/c
# Expected: priority/{alpha,bravo}/$more_files, priority/c
+# We currently fail this test because the directory renames we detect are
+# goal/a/ -> priority/alpha/
+# goal/b/ -> priority/bravo/
+# We do not detect
+# goal/ -> priority/
+# because of no files found within goal/, and the fact that "a" != "alpha"
+# and "b" != "bravo". But I'm not sure it's really a failure given that
+# viewpoint...
test_setup_9g () {
test_create_repo 9g &&
@@ -2880,6 +2887,7 @@ test_setup_9g () {
}
test_expect_failure '9g: Renamed directory that only contained immediate subdirs, immediate subdirs renamed' '
+ test_setup_9g &&
(
cd 9g &&
@@ -3362,6 +3370,7 @@ test_setup_10e () {
}
test_expect_failure '10e: Does git complain about untracked file that is not really in the way?' '
+ test_setup_10e &&
(
cd 10e &&
@@ -4403,7 +4412,7 @@ test_expect_success '13b(info): messages for transitive rename with conflicted c
# Commit O: z/{b,c}, x/{d,e}
# Commit A: y/{b,c,d}, x/e
# Commit B: z/{b,c,d}, x/e
-# Expected: y/{b,c,d}, with info or conflict messages for d (
+# Expected: y/{b,c,d}, x/e, with info or conflict messages for d
# A: renamed x/d -> z/d; B: renamed z/ -> y/ AND renamed x/d to y/d
# One could argue A had partial knowledge of what was done with
# d and B had full knowledge, but that's a slippery slope as
diff --git a/t/t6044-merge-unrelated-index-changes.sh b/t/t6424-merge-unrelated-index-changes.sh
index 5e3779ebc9..5e3779ebc9 100755
--- a/t/t6044-merge-unrelated-index-changes.sh
+++ b/t/t6424-merge-unrelated-index-changes.sh
diff --git a/t/t6045-merge-rename-delete.sh b/t/t6425-merge-rename-delete.sh
index 5d33577d2f..f79d021590 100755
--- a/t/t6045-merge-rename-delete.sh
+++ b/t/t6425-merge-rename-delete.sh
@@ -17,7 +17,8 @@ test_expect_success 'rename/delete' '
git commit -m "delete" &&
test_must_fail git merge --strategy=recursive rename >output &&
- test_i18ngrep "CONFLICT (rename/delete): A deleted in HEAD and renamed to B in rename. Version rename of B left in tree." output
+ test_i18ngrep "CONFLICT (rename/delete): A.* renamed .*to B.* in rename" output &&
+ test_i18ngrep "CONFLICT (rename/delete): A.*deleted in HEAD." output
'
test_done
diff --git a/t/t6046-merge-skip-unneeded-updates.sh b/t/t6426-merge-skip-unneeded-updates.sh
index 5a2d07e516..699813671c 100755
--- a/t/t6046-merge-skip-unneeded-updates.sh
+++ b/t/t6426-merge-skip-unneeded-updates.sh
@@ -374,7 +374,7 @@ test_expect_success '2c: Modify b & add c VS rename b->c' '
export GIT_MERGE_VERBOSITY &&
test_must_fail git merge -s recursive B^0 >out 2>err &&
- test_i18ngrep "CONFLICT (rename/add): Rename b->c" out &&
+ test_i18ngrep "CONFLICT (.*/add):" out &&
test_must_be_empty err &&
# Make sure c WAS updated
diff --git a/t/t6047-diff3-conflict-markers.sh b/t/t6427-diff3-conflict-markers.sh
index f4655bb358..f4655bb358 100755
--- a/t/t6047-diff3-conflict-markers.sh
+++ b/t/t6427-diff3-conflict-markers.sh
diff --git a/t/t3030-merge-recursive.sh b/t/t6430-merge-recursive.sh
index d48d211a95..d48d211a95 100755
--- a/t/t3030-merge-recursive.sh
+++ b/t/t6430-merge-recursive.sh
diff --git a/t/t3031-merge-criscross.sh b/t/t6431-merge-criscross.sh
index 3824756a02..3824756a02 100755
--- a/t/t3031-merge-criscross.sh
+++ b/t/t6431-merge-criscross.sh
diff --git a/t/t3032-merge-recursive-space-options.sh b/t/t6432-merge-recursive-space-options.sh
index b56180ee4a..b56180ee4a 100755
--- a/t/t3032-merge-recursive-space-options.sh
+++ b/t/t6432-merge-recursive-space-options.sh
diff --git a/t/t3033-merge-toplevel.sh b/t/t6433-merge-toplevel.sh
index e29c284b9b..e29c284b9b 100755
--- a/t/t3033-merge-toplevel.sh
+++ b/t/t6433-merge-toplevel.sh
diff --git a/t/t3034-merge-recursive-rename-options.sh b/t/t6434-merge-recursive-rename-options.sh
index 3d9fae68c4..3d9fae68c4 100755
--- a/t/t3034-merge-recursive-rename-options.sh
+++ b/t/t6434-merge-recursive-rename-options.sh
diff --git a/t/t3035-merge-sparse.sh b/t/t6435-merge-sparse.sh
index 74562e1235..74562e1235 100755
--- a/t/t3035-merge-sparse.sh
+++ b/t/t6435-merge-sparse.sh
diff --git a/t/t7607-merge-overwrite.sh b/t/t6436-merge-overwrite.sh
index dd8ab7ede1..dd8ab7ede1 100755
--- a/t/t7607-merge-overwrite.sh
+++ b/t/t6436-merge-overwrite.sh
diff --git a/t/t7405-submodule-merge.sh b/t/t6437-submodule-merge.sh
index 6a1e5f8232..6a1e5f8232 100755
--- a/t/t7405-submodule-merge.sh
+++ b/t/t6437-submodule-merge.sh
diff --git a/t/t7613-merge-submodule.sh b/t/t6438-submodule-directory-file-conflicts.sh
index 04bf4be7d7..04bf4be7d7 100755
--- a/t/t7613-merge-submodule.sh
+++ b/t/t6438-submodule-directory-file-conflicts.sh
diff --git a/t/t7609-merge-co-error-msgs.sh b/t/t6439-merge-co-error-msgs.sh
index 5c8894d94f..5c8894d94f 100755
--- a/t/t7609-merge-co-error-msgs.sh
+++ b/t/t6439-merge-co-error-msgs.sh
diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh
index b871dd4f86..ba8013b002 100755
--- a/t/t8003-blame-corner-cases.sh
+++ b/t/t8003-blame-corner-cases.sh
@@ -273,18 +273,14 @@ test_expect_success 'blame file with CRLF core.autocrlf=true' '
grep "A U Thor" actual
'
-# Tests the splitting and merging of blame entries in blame_coalesce().
-# The output of blame is the same, regardless of whether blame_coalesce() runs
-# or not, so we'd likely only notice a problem if blame crashes or assigned
-# blame to the "splitting" commit ('SPLIT' below).
-test_expect_success 'blame coalesce' '
+test_expect_success 'setup coalesce tests' '
cat >giraffe <<-\EOF &&
ABC
DEF
EOF
git add giraffe &&
git commit -m "original file" &&
- oid=$(git rev-parse HEAD) &&
+ orig=$(git rev-parse HEAD) &&
cat >giraffe <<-\EOF &&
ABC
@@ -293,6 +289,7 @@ test_expect_success 'blame coalesce' '
EOF
git add giraffe &&
git commit -m "interior SPLIT line" &&
+ split=$(git rev-parse HEAD) &&
cat >giraffe <<-\EOF &&
ABC
@@ -300,12 +297,25 @@ test_expect_success 'blame coalesce' '
EOF
git add giraffe &&
git commit -m "same contents as original" &&
+ final=$(git rev-parse HEAD)
+'
+
+test_expect_success 'blame coalesce' '
+ cat >expect <<-EOF &&
+ $orig 1 1 2
+ $orig 2 2
+ EOF
+ git blame --porcelain $final giraffe >actual.raw &&
+ grep "^$orig" actual.raw >actual &&
+ test_cmp expect actual
+'
+test_expect_success 'blame does not coalesce non-adjacent result lines' '
cat >expect <<-EOF &&
- $oid 1) ABC
- $oid 2) DEF
+ $orig 1) ABC
+ $orig 3) DEF
EOF
- git -c core.abbrev=$(test_oid hexsz) blame -s giraffe >actual &&
+ git blame --no-abbrev -s -L1,1 -L3,3 $split giraffe >actual &&
test_cmp expect actual
'
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 3d68570450..a08f72596a 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -2142,4 +2142,33 @@ test_expect_success $PREREQ 'test that send-email works outside a repo' '
"$(pwd)/0001-add-master.patch"
'
+test_expect_success $PREREQ 'test that sendmail config is rejected' '
+ test_config sendmail.program sendmail &&
+ test_must_fail git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ HEAD^ 2>err &&
+ test_i18ngrep "found configuration options for '"'"sendmail"'"'" err
+'
+
+test_expect_success $PREREQ 'test that sendmail config rejection is specific' '
+ test_config resendmail.program sendmail &&
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ HEAD^
+'
+
+test_expect_success $PREREQ 'test forbidSendmailVariables behavior override' '
+ test_config sendmail.program sendmail &&
+ test_config sendemail.forbidSendmailVariables false &&
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ HEAD^
+'
+
test_done
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 596c549cdd..6a8e194a99 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -952,7 +952,13 @@ test_expect_code () {
# - not all diff versions understand "-u"
test_cmp() {
- eval "$GIT_TEST_CMP" '"$@"'
+ test $# -eq 2 || BUG "test_cmp requires two arguments"
+ if ! eval "$GIT_TEST_CMP" '"$@"'
+ then
+ test "x$1" = x- || test -e "$1" || BUG "test_cmp '$1' missing"
+ test "x$2" = x- || test -e "$2" || BUG "test_cmp '$2' missing"
+ return 1
+ fi
}
# Check that the given config key has the expected value.
@@ -981,7 +987,13 @@ test_cmp_config() {
# test_cmp_bin - helper to compare binary files
test_cmp_bin() {
- cmp "$@"
+ test $# -eq 2 || BUG "test_cmp_bin requires two arguments"
+ if ! cmp "$@"
+ then
+ test "x$1" = x- || test -e "$1" || BUG "test_cmp_bin '$1' missing"
+ test "x$2" = x- || test -e "$2" || BUG "test_cmp_bin '$2' missing"
+ return 1
+ fi
}
# Use this instead of test_cmp to compare files that contain expected and