summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/Makefile6
-rw-r--r--t/helper/test-string-list.c25
-rwxr-xr-xt/perf/p0071-sort.sh26
-rwxr-xr-xt/t0001-init.sh3
-rwxr-xr-xt/t1000-read-tree-m-3way.sh648
-rwxr-xr-xt/t1001-read-tree-m-2way.sh649
-rwxr-xr-xt/t1403-show-ref.sh42
-rwxr-xr-xt/t1450-fsck.sh160
-rwxr-xr-xt/t3404-rebase-interactive.sh16
-rwxr-xr-xt/t3701-add-interactive.sh14
-rwxr-xr-xt/t4026-color.sh7
-rwxr-xr-xt/t4202-log.sh22
-rwxr-xr-xt/t5505-remote.sh7
-rwxr-xr-xt/t5531-deep-submodule-push.sh21
-rwxr-xr-xt/t7004-tag.sh16
-rwxr-xr-xt/t7030-verify-tag.sh16
-rwxr-xr-xt/t7400-submodule-basic.sh14
-rwxr-xr-xt/t7406-submodule-update.sh12
-rwxr-xr-xt/t7412-submodule-absorbgitdirs.sh27
-rwxr-xr-xt/t7512-status-help.sh19
-rwxr-xr-xt/t7800-difftool.sh92
-rw-r--r--t/test-lib.sh4
22 files changed, 1130 insertions, 716 deletions
diff --git a/t/Makefile b/t/Makefile
index d613935..1bb06c3 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -35,6 +35,12 @@ all: $(DEFAULT_TEST_TARGET)
test: pre-clean $(TEST_LINT)
$(MAKE) aggregate-results-and-cleanup
+failed:
+ @failed=$$(cd '$(TEST_RESULTS_DIRECTORY_SQ)' && \
+ grep -l '^failed [1-9]' *.counts | \
+ sed -n 's/\.counts$$/.sh/p') && \
+ test -z "$$failed" || $(MAKE) $$failed
+
prove: pre-clean $(TEST_LINT)
@echo "*** prove ***"; $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
$(MAKE) clean-except-prove-cache
diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c
index 4a68967..c502fa1 100644
--- a/t/helper/test-string-list.c
+++ b/t/helper/test-string-list.c
@@ -97,6 +97,31 @@ int cmd_main(int argc, const char **argv)
return 0;
}
+ if (argc == 2 && !strcmp(argv[1], "sort")) {
+ struct string_list list = STRING_LIST_INIT_NODUP;
+ struct strbuf sb = STRBUF_INIT;
+ struct string_list_item *item;
+
+ strbuf_read(&sb, 0, 0);
+
+ /*
+ * Split by newline, but don't create a string_list item
+ * for the empty string after the last separator.
+ */
+ if (sb.buf[sb.len - 1] == '\n')
+ strbuf_setlen(&sb, sb.len - 1);
+ string_list_split_in_place(&list, sb.buf, '\n', -1);
+
+ string_list_sort(&list);
+
+ for_each_string_list_item(item, &list)
+ puts(item->string);
+
+ string_list_clear(&list, 0);
+ strbuf_release(&sb);
+ return 0;
+ }
+
fprintf(stderr, "%s: unknown function name: %s\n", argv[0],
argv[1] ? argv[1] : "(there was none)");
return 1;
diff --git a/t/perf/p0071-sort.sh b/t/perf/p0071-sort.sh
new file mode 100755
index 0000000..7c9a35a
--- /dev/null
+++ b/t/perf/p0071-sort.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+test_description='Basic sort performance tests'
+. ./perf-lib.sh
+
+test_perf_default_repo
+
+test_expect_success 'setup' '
+ git ls-files --stage "*.[ch]" "*.sh" |
+ cut -f2 -d" " |
+ git cat-file --batch >unsorted
+'
+
+test_perf 'sort(1)' '
+ sort <unsorted >expect
+'
+
+test_perf 'string_list_sort()' '
+ test-string-list sort <unsorted >actual
+'
+
+test_expect_success 'string_list_sort() sorts like sort(1)' '
+ test_cmp_bin expect actual
+'
+
+test_done
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index b8fc588..e424de5 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -258,6 +258,9 @@ test_expect_success POSIXPERM 'init creates a new deep directory (umask vs. shar
(
# Leading directories should honor umask while
# the repository itself should follow "shared"
+ mkdir newdir &&
+ # Remove a default ACL if possible.
+ (setfacl -k newdir 2>/dev/null || true) &&
umask 002 &&
git init --bare --shared=0660 newdir/a/b/c &&
test_path_is_dir newdir/a/b/c/refs &&
diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh
index a0b79b4..3c4d2d6 100755
--- a/t/t1000-read-tree-m-3way.sh
+++ b/t/t1000-read-tree-m-3way.sh
@@ -128,29 +128,29 @@ cat >expected <<\EOF
EOF
check_result () {
- git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current &&
- test_cmp expected current
+ git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current &&
+ test_cmp expected current
}
# This is done on an empty work directory, which is the normal
# merge person behaviour.
-test_expect_success \
- '3-way merge with git read-tree -m, empty cache' \
- "rm -fr [NDMALTS][NDMALTSF] Z &&
- rm .git/index &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
+test_expect_success '3-way merge with git read-tree -m, empty cache' '
+ rm -fr [NDMALTS][NDMALTSF] Z &&
+ rm .git/index &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
# This starts out with the first head, which is the normal
# patch submitter behaviour.
-test_expect_success \
- '3-way merge with git read-tree -m, match H' \
- "rm -fr [NDMALTS][NDMALTSF] Z &&
- rm .git/index &&
- read_tree_must_succeed $tree_A &&
- git checkout-index -f -u -a &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
+test_expect_success '3-way merge with git read-tree -m, match H' '
+ rm -fr [NDMALTS][NDMALTSF] Z &&
+ rm .git/index &&
+ read_tree_must_succeed $tree_A &&
+ git checkout-index -f -u -a &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
: <<\END_OF_CASE_TABLE
@@ -208,322 +208,304 @@ DF (file) when tree B require DF to be a directory by having DF/DF
END_OF_CASE_TABLE
-test_expect_success '1 - must not have an entry not in A.' "
- rm -f .git/index XX &&
- echo XX >XX &&
- git update-index --add XX &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '2 - must match B in !O && !A && B case.' \
- "rm -f .git/index NA &&
- cp .orig-B/NA NA &&
- git update-index --add NA &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B"
-
-test_expect_success \
- '2 - matching B alone is OK in !O && !A && B case.' \
- "rm -f .git/index NA &&
- cp .orig-B/NA NA &&
- git update-index --add NA &&
- echo extra >>NA &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B"
-
-test_expect_success \
- '3 - must match A in !O && A && !B case.' \
- "rm -f .git/index AN &&
- cp .orig-A/AN AN &&
- git update-index --add AN &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '3 - matching A alone is OK in !O && A && !B case.' \
- "rm -f .git/index AN &&
- cp .orig-A/AN AN &&
- git update-index --add AN &&
- echo extra >>AN &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B"
-
-test_expect_success \
- '3 (fail) - must match A in !O && A && !B case.' "
- rm -f .git/index AN &&
- cp .orig-A/AN AN &&
- echo extra >>AN &&
- git update-index --add AN &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '4 - must match and be up-to-date in !O && A && B && A!=B case.' \
- "rm -f .git/index AA &&
- cp .orig-A/AA AA &&
- git update-index --add AA &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' "
- rm -f .git/index AA &&
- cp .orig-A/AA AA &&
- git update-index --add AA &&
- echo extra >>AA &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' "
- rm -f .git/index AA &&
- cp .orig-A/AA AA &&
- echo extra >>AA &&
- git update-index --add AA &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '5 - must match in !O && A && B && A==B case.' \
- "rm -f .git/index LL &&
- cp .orig-A/LL LL &&
- git update-index --add LL &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '5 - must match in !O && A && B && A==B case.' \
- "rm -f .git/index LL &&
- cp .orig-A/LL LL &&
- git update-index --add LL &&
- echo extra >>LL &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '5 (fail) - must match A in !O && A && B && A==B case.' "
- rm -f .git/index LL &&
- cp .orig-A/LL LL &&
- echo extra >>LL &&
- git update-index --add LL &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '6 - must not exist in O && !A && !B case' "
- rm -f .git/index DD &&
- echo DD >DD &&
- git update-index --add DD &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '7 - must not exist in O && !A && B && O!=B case' "
- rm -f .git/index DM &&
- cp .orig-B/DM DM &&
- git update-index --add DM &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '8 - must not exist in O && !A && B && O==B case' "
- rm -f .git/index DN &&
- cp .orig-B/DN DN &&
- git update-index --add DN &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '9 - must match and be up-to-date in O && A && !B && O!=A case' \
- "rm -f .git/index MD &&
- cp .orig-A/MD MD &&
- git update-index --add MD &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' "
- rm -f .git/index MD &&
- cp .orig-A/MD MD &&
- git update-index --add MD &&
- echo extra >>MD &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' "
- rm -f .git/index MD &&
- cp .orig-A/MD MD &&
- echo extra >>MD &&
- git update-index --add MD &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '10 - must match and be up-to-date in O && A && !B && O==A case' \
- "rm -f .git/index ND &&
- cp .orig-A/ND ND &&
- git update-index --add ND &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' "
- rm -f .git/index ND &&
- cp .orig-A/ND ND &&
- git update-index --add ND &&
- echo extra >>ND &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' "
- rm -f .git/index ND &&
- cp .orig-A/ND ND &&
- echo extra >>ND &&
- git update-index --add ND &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '11 - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
- "rm -f .git/index MM &&
- cp .orig-A/MM MM &&
- git update-index --add MM &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' "
- rm -f .git/index MM &&
- cp .orig-A/MM MM &&
- git update-index --add MM &&
- echo extra >>MM &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' "
- rm -f .git/index MM &&
- cp .orig-A/MM MM &&
- echo extra >>MM &&
- git update-index --add MM &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '12 - must match A in O && A && B && O!=A && A==B case' \
- "rm -f .git/index SS &&
- cp .orig-A/SS SS &&
- git update-index --add SS &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '12 - must match A in O && A && B && O!=A && A==B case' \
- "rm -f .git/index SS &&
- cp .orig-A/SS SS &&
- git update-index --add SS &&
- echo extra >>SS &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '12 (fail) - must match A in O && A && B && O!=A && A==B case' "
- rm -f .git/index SS &&
- cp .orig-A/SS SS &&
- echo extra >>SS &&
- git update-index --add SS &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '13 - must match A in O && A && B && O!=A && O==B case' \
- "rm -f .git/index MN &&
- cp .orig-A/MN MN &&
- git update-index --add MN &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '13 - must match A in O && A && B && O!=A && O==B case' \
- "rm -f .git/index MN &&
- cp .orig-A/MN MN &&
- git update-index --add MN &&
- echo extra >>MN &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '14 - must match and be up-to-date in O && A && B && O==A && O!=B case' \
- "rm -f .git/index NM &&
- cp .orig-A/NM NM &&
- git update-index --add NM &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '14 - may match B in O && A && B && O==A && O!=B case' \
- "rm -f .git/index NM &&
- cp .orig-B/NM NM &&
- git update-index --add NM &&
- echo extra >>NM &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' "
- rm -f .git/index NM &&
- cp .orig-A/NM NM &&
- git update-index --add NM &&
- echo extra >>NM &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' "
- rm -f .git/index NM &&
- cp .orig-A/NM NM &&
- echo extra >>NM &&
- git update-index --add NM &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-test_expect_success \
- '15 - must match A in O && A && B && O==A && O==B case' \
- "rm -f .git/index NN &&
- cp .orig-A/NN NN &&
- git update-index --add NN &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '15 - must match A in O && A && B && O==A && O==B case' \
- "rm -f .git/index NN &&
- cp .orig-A/NN NN &&
- git update-index --add NN &&
- echo extra >>NN &&
- read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
- check_result"
-
-test_expect_success \
- '15 (fail) - must match A in O && A && B && O==A && O==B case' "
- rm -f .git/index NN &&
- cp .orig-A/NN NN &&
- echo extra >>NN &&
- git update-index --add NN &&
- read_tree_must_fail -m $tree_O $tree_A $tree_B
-"
-
-# #16
-test_expect_success \
- '16 - A matches in one and B matches in another.' \
- 'rm -f .git/index F16 &&
- echo F16 >F16 &&
- git update-index --add F16 &&
- tree0=$(git write-tree) &&
- echo E16 >F16 &&
- git update-index F16 &&
- tree1=$(git write-tree) &&
- read_tree_must_succeed -m $tree0 $tree1 $tree1 $tree0 &&
- git ls-files --stage'
+test_expect_success '1 - must not have an entry not in A.' '
+ rm -f .git/index XX &&
+ echo XX >XX &&
+ git update-index --add XX &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '2 - must match B in !O && !A && B case.' '
+ rm -f .git/index NA &&
+ cp .orig-B/NA NA &&
+ git update-index --add NA &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '2 - matching B alone is OK in !O && !A && B case.' '
+ rm -f .git/index NA &&
+ cp .orig-B/NA NA &&
+ git update-index --add NA &&
+ echo extra >>NA &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '3 - must match A in !O && A && !B case.' '
+ rm -f .git/index AN &&
+ cp .orig-A/AN AN &&
+ git update-index --add AN &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '3 - matching A alone is OK in !O && A && !B case.' '
+ rm -f .git/index AN &&
+ cp .orig-A/AN AN &&
+ git update-index --add AN &&
+ echo extra >>AN &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '3 (fail) - must match A in !O && A && !B case.' '
+ rm -f .git/index AN &&
+ cp .orig-A/AN AN &&
+ echo extra >>AN &&
+ git update-index --add AN &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '4 - must match and be up-to-date in !O && A && B && A!=B case.' '
+ rm -f .git/index AA &&
+ cp .orig-A/AA AA &&
+ git update-index --add AA &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' '
+ rm -f .git/index AA &&
+ cp .orig-A/AA AA &&
+ git update-index --add AA &&
+ echo extra >>AA &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' '
+ rm -f .git/index AA &&
+ cp .orig-A/AA AA &&
+ echo extra >>AA &&
+ git update-index --add AA &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '5 - must match in !O && A && B && A==B case.' '
+ rm -f .git/index LL &&
+ cp .orig-A/LL LL &&
+ git update-index --add LL &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '5 - must match in !O && A && B && A==B case.' '
+ rm -f .git/index LL &&
+ cp .orig-A/LL LL &&
+ git update-index --add LL &&
+ echo extra >>LL &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '5 (fail) - must match A in !O && A && B && A==B case.' '
+ rm -f .git/index LL &&
+ cp .orig-A/LL LL &&
+ echo extra >>LL &&
+ git update-index --add LL &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '6 - must not exist in O && !A && !B case' '
+ rm -f .git/index DD &&
+ echo DD >DD &&
+ git update-index --add DD &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '7 - must not exist in O && !A && B && O!=B case' '
+ rm -f .git/index DM &&
+ cp .orig-B/DM DM &&
+ git update-index --add DM &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '8 - must not exist in O && !A && B && O==B case' '
+ rm -f .git/index DN &&
+ cp .orig-B/DN DN &&
+ git update-index --add DN &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '9 - must match and be up-to-date in O && A && !B && O!=A case' '
+ rm -f .git/index MD &&
+ cp .orig-A/MD MD &&
+ git update-index --add MD &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' '
+ rm -f .git/index MD &&
+ cp .orig-A/MD MD &&
+ git update-index --add MD &&
+ echo extra >>MD &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' '
+ rm -f .git/index MD &&
+ cp .orig-A/MD MD &&
+ echo extra >>MD &&
+ git update-index --add MD &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '10 - must match and be up-to-date in O && A && !B && O==A case' '
+ rm -f .git/index ND &&
+ cp .orig-A/ND ND &&
+ git update-index --add ND &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' '
+ rm -f .git/index ND &&
+ cp .orig-A/ND ND &&
+ git update-index --add ND &&
+ echo extra >>ND &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' '
+ rm -f .git/index ND &&
+ cp .orig-A/ND ND &&
+ echo extra >>ND &&
+ git update-index --add ND &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '11 - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' '
+ rm -f .git/index MM &&
+ cp .orig-A/MM MM &&
+ git update-index --add MM &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' '
+ rm -f .git/index MM &&
+ cp .orig-A/MM MM &&
+ git update-index --add MM &&
+ echo extra >>MM &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' '
+ rm -f .git/index MM &&
+ cp .orig-A/MM MM &&
+ echo extra >>MM &&
+ git update-index --add MM &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '12 - must match A in O && A && B && O!=A && A==B case' '
+ rm -f .git/index SS &&
+ cp .orig-A/SS SS &&
+ git update-index --add SS &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '12 - must match A in O && A && B && O!=A && A==B case' '
+ rm -f .git/index SS &&
+ cp .orig-A/SS SS &&
+ git update-index --add SS &&
+ echo extra >>SS &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '12 (fail) - must match A in O && A && B && O!=A && A==B case' '
+ rm -f .git/index SS &&
+ cp .orig-A/SS SS &&
+ echo extra >>SS &&
+ git update-index --add SS &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '13 - must match A in O && A && B && O!=A && O==B case' '
+ rm -f .git/index MN &&
+ cp .orig-A/MN MN &&
+ git update-index --add MN &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '13 - must match A in O && A && B && O!=A && O==B case' '
+ rm -f .git/index MN &&
+ cp .orig-A/MN MN &&
+ git update-index --add MN &&
+ echo extra >>MN &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '14 - must match and be up-to-date in O && A && B && O==A && O!=B case' '
+ rm -f .git/index NM &&
+ cp .orig-A/NM NM &&
+ git update-index --add NM &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '14 - may match B in O && A && B && O==A && O!=B case' '
+ rm -f .git/index NM &&
+ cp .orig-B/NM NM &&
+ git update-index --add NM &&
+ echo extra >>NM &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' '
+ rm -f .git/index NM &&
+ cp .orig-A/NM NM &&
+ git update-index --add NM &&
+ echo extra >>NM &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' '
+ rm -f .git/index NM &&
+ cp .orig-A/NM NM &&
+ echo extra >>NM &&
+ git update-index --add NM &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '15 - must match A in O && A && B && O==A && O==B case' '
+ rm -f .git/index NN &&
+ cp .orig-A/NN NN &&
+ git update-index --add NN &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '15 - must match A in O && A && B && O==A && O==B case' '
+ rm -f .git/index NN &&
+ cp .orig-A/NN NN &&
+ git update-index --add NN &&
+ echo extra >>NN &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
+ check_result
+'
+
+test_expect_success '15 (fail) - must match A in O && A && B && O==A && O==B case' '
+ rm -f .git/index NN &&
+ cp .orig-A/NN NN &&
+ echo extra >>NN &&
+ git update-index --add NN &&
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
+'
+
+test_expect_success '16 - A matches in one and B matches in another.' '
+ rm -f .git/index F16 &&
+ echo F16 >F16 &&
+ git update-index --add F16 &&
+ tree0=$(git write-tree) &&
+ echo E16 >F16 &&
+ git update-index F16 &&
+ tree1=$(git write-tree) &&
+ read_tree_must_succeed -m $tree0 $tree1 $tree1 $tree0 &&
+ git ls-files --stage
+'
test_done
diff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh
index db1b6f5..5ededd8 100755
--- a/t/t1001-read-tree-m-2way.sh
+++ b/t/t1001-read-tree-m-2way.sh
@@ -14,10 +14,10 @@ all the combinations described in the two-tree merge "carry forward"
rules, found in <Documentation/git read-tree.txt>.
In the test, these paths are used:
- bozbar - in H, stays in M, modified from bozbar to gnusto
- frotz - not in H added in M
- nitfol - in H, stays in M unmodified
- rezrov - in H, deleted in M
+ bozbar - in H, stays in M, modified from bozbar to gnusto
+ frotz - not in H added in M
+ nitfol - in H, stays in M unmodified
+ rezrov - in H, deleted in M
yomin - not in H or M
'
. ./test-lib.sh
@@ -60,336 +60,343 @@ EOF
sed -e 's/bozbar/gnusto (earlier bozbar)/' bozbar-old >bozbar-new
-test_expect_success \
- setup \
- 'echo frotz >frotz &&
- echo nitfol >nitfol &&
- cat bozbar-old >bozbar &&
- echo rezrov >rezrov &&
- echo yomin >yomin &&
- git update-index --add nitfol bozbar rezrov &&
- treeH=$(git write-tree) &&
- echo treeH $treeH &&
- git ls-tree $treeH &&
-
- cat bozbar-new >bozbar &&
- git update-index --add frotz bozbar --force-remove rezrov &&
- git ls-files --stage >M.out &&
- treeM=$(git write-tree) &&
- echo treeM $treeM &&
- git ls-tree $treeM &&
- git diff-tree $treeH $treeM'
-
-test_expect_success \
- '1, 2, 3 - no carry forward' \
- 'rm -f .git/index &&
- read_tree_twoway $treeH $treeM &&
- git ls-files --stage >1-3.out &&
- test_cmp M.out 1-3.out &&
- check_cache_at bozbar dirty &&
- check_cache_at frotz dirty &&
- check_cache_at nitfol dirty'
+test_expect_success 'setup' '
+ echo frotz >frotz &&
+ echo nitfol >nitfol &&
+ cat bozbar-old >bozbar &&
+ echo rezrov >rezrov &&
+ echo yomin >yomin &&
+ git update-index --add nitfol bozbar rezrov &&
+ treeH=$(git write-tree) &&
+ echo treeH $treeH &&
+ git ls-tree $treeH &&
+
+ cat bozbar-new >bozbar &&
+ git update-index --add frotz bozbar --force-remove rezrov &&
+ git ls-files --stage >M.out &&
+ treeM=$(git write-tree) &&
+ echo treeM $treeM &&
+ git ls-tree $treeM &&
+ git diff-tree $treeH $treeM
+'
+test_expect_success '1, 2, 3 - no carry forward' '
+ rm -f .git/index &&
+ read_tree_twoway $treeH $treeM &&
+ git ls-files --stage >1-3.out &&
+ test_cmp M.out 1-3.out &&
+ check_cache_at bozbar dirty &&
+ check_cache_at frotz dirty &&
+ check_cache_at nitfol dirty
+'
echo '+100644 X 0 yomin' >expected
-test_expect_success \
- '4 - carry forward local addition.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- git update-index --add yomin &&
- read_tree_twoway $treeH $treeM &&
- git ls-files --stage >4.out &&
- test_must_fail git diff --no-index M.out 4.out >4diff.out &&
- compare_change 4diff.out expected &&
- check_cache_at yomin clean'
-
-test_expect_success \
- '5 - carry forward local addition.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- echo yomin >yomin &&
- git update-index --add yomin &&
- echo yomin yomin >yomin &&
- read_tree_twoway $treeH $treeM &&
- git ls-files --stage >5.out &&
- test_must_fail git diff --no-index M.out 5.out >5diff.out &&
- compare_change 5diff.out expected &&
- check_cache_at yomin dirty'
-
-test_expect_success \
- '6 - local addition already has the same.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- git update-index --add frotz &&
- read_tree_twoway $treeH $treeM &&
- git ls-files --stage >6.out &&
- test_cmp M.out 6.out &&
- check_cache_at frotz clean'
-
-test_expect_success \
- '7 - local addition already has the same.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- echo frotz >frotz &&
- git update-index --add frotz &&
- echo frotz frotz >frotz &&
- read_tree_twoway $treeH $treeM &&
- git ls-files --stage >7.out &&
- test_cmp M.out 7.out &&
- check_cache_at frotz dirty'
-
-test_expect_success \
- '8 - conflicting addition.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- echo frotz frotz >frotz &&
- git update-index --add frotz &&
- if read_tree_twoway $treeH $treeM; then false; else :; fi'
-
-test_expect_success \
- '9 - conflicting addition.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- echo frotz frotz >frotz &&
- git update-index --add frotz &&
- echo frotz >frotz &&
- if read_tree_twoway $treeH $treeM; then false; else :; fi'
-
-test_expect_success \
- '10 - path removed.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- echo rezrov >rezrov &&
- git update-index --add rezrov &&
- read_tree_twoway $treeH $treeM &&
- git ls-files --stage >10.out &&
- test_cmp M.out 10.out'
-
-test_expect_success \
- '11 - dirty path removed.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- echo rezrov >rezrov &&
- git update-index --add rezrov &&
- echo rezrov rezrov >rezrov &&
- if read_tree_twoway $treeH $treeM; then false; else :; fi'
-
-test_expect_success \
- '12 - unmatching local changes being removed.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- echo rezrov rezrov >rezrov &&
- git update-index --add rezrov &&
- if read_tree_twoway $treeH $treeM; then false; else :; fi'
-
-test_expect_success \
- '13 - unmatching local changes being removed.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- echo rezrov rezrov >rezrov &&
- git update-index --add rezrov &&
- echo rezrov >rezrov &&
- if read_tree_twoway $treeH $treeM; then false; else :; fi'
+test_expect_success '4 - carry forward local addition.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ git update-index --add yomin &&
+ read_tree_twoway $treeH $treeM &&
+ git ls-files --stage >4.out &&
+ test_must_fail git diff --no-index M.out 4.out >4diff.out &&
+ compare_change 4diff.out expected &&
+ check_cache_at yomin clean
+'
+
+test_expect_success '5 - carry forward local addition.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ echo yomin >yomin &&
+ git update-index --add yomin &&
+ echo yomin yomin >yomin &&
+ read_tree_twoway $treeH $treeM &&
+ git ls-files --stage >5.out &&
+ test_must_fail git diff --no-index M.out 5.out >5diff.out &&
+ compare_change 5diff.out expected &&
+ check_cache_at yomin dirty
+'
+
+test_expect_success '6 - local addition already has the same.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ git update-index --add frotz &&
+ read_tree_twoway $treeH $treeM &&
+ git ls-files --stage >6.out &&
+ test_cmp M.out 6.out &&
+ check_cache_at frotz clean
+'
+
+test_expect_success '7 - local addition already has the same.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ echo frotz >frotz &&
+ git update-index --add frotz &&
+ echo frotz frotz >frotz &&
+ read_tree_twoway $treeH $treeM &&
+ git ls-files --stage >7.out &&
+ test_cmp M.out 7.out &&
+ check_cache_at frotz dirty
+'
+
+test_expect_success '8 - conflicting addition.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ echo frotz frotz >frotz &&
+ git update-index --add frotz &&
+ if read_tree_twoway $treeH $treeM; then false; else :; fi
+'
+
+test_expect_success '9 - conflicting addition.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ echo frotz frotz >frotz &&
+ git update-index --add frotz &&
+ echo frotz >frotz &&
+ if read_tree_twoway $treeH $treeM; then false; else :; fi
+'
+
+test_expect_success '10 - path removed.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ echo rezrov >rezrov &&
+ git update-index --add rezrov &&
+ read_tree_twoway $treeH $treeM &&
+ git ls-files --stage >10.out &&
+ test_cmp M.out 10.out
+'
+
+test_expect_success '11 - dirty path removed.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ echo rezrov >rezrov &&
+ git update-index --add rezrov &&
+ echo rezrov rezrov >rezrov &&
+ if read_tree_twoway $treeH $treeM; then false; else :; fi
+'
+
+test_expect_success '12 - unmatching local changes being removed.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ echo rezrov rezrov >rezrov &&
+ git update-index --add rezrov &&
+ if read_tree_twoway $treeH $treeM; then false; else :; fi
+'
+
+test_expect_success '13 - unmatching local changes being removed.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ echo rezrov rezrov >rezrov &&
+ git update-index --add rezrov &&
+ echo rezrov >rezrov &&
+ if read_tree_twoway $treeH $treeM; then false; else :; fi
+'
cat >expected <<EOF
-100644 X 0 nitfol
+100644 X 0 nitfol
EOF
-test_expect_success \
- '14 - unchanged in two heads.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- echo nitfol nitfol >nitfol &&
- git update-index --add nitfol &&
- read_tree_twoway $treeH $treeM &&
- git ls-files --stage >14.out &&
- test_must_fail git diff --no-index M.out 14.out >14diff.out &&
- compare_change 14diff.out expected &&
- check_cache_at nitfol clean'
-
-test_expect_success \
- '15 - unchanged in two heads.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- echo nitfol nitfol >nitfol &&
- git update-index --add nitfol &&
- echo nitfol nitfol nitfol >nitfol &&
- read_tree_twoway $treeH $treeM &&
- git ls-files --stage >15.out &&
- test_must_fail git diff --no-index M.out 15.out >15diff.out &&
- compare_change 15diff.out expected &&
- check_cache_at nitfol dirty'
-
-test_expect_success \
- '16 - conflicting local change.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- echo bozbar bozbar >bozbar &&
- git update-index --add bozbar &&
- if read_tree_twoway $treeH $treeM; then false; else :; fi'
-
-test_expect_success \
- '17 - conflicting local change.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- echo bozbar bozbar >bozbar &&
- git update-index --add bozbar &&
- echo bozbar bozbar bozbar >bozbar &&
- if read_tree_twoway $treeH $treeM; then false; else :; fi'
-
-test_expect_success \
- '18 - local change already having a good result.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- cat bozbar-new >bozbar &&
- git update-index --add bozbar &&
- read_tree_twoway $treeH $treeM &&
- git ls-files --stage >18.out &&
- test_cmp M.out 18.out &&
- check_cache_at bozbar clean'
-
-test_expect_success \
- '19 - local change already having a good result, further modified.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- cat bozbar-new >bozbar &&
- git update-index --add bozbar &&
- echo gnusto gnusto >bozbar &&
- read_tree_twoway $treeH $treeM &&
- git ls-files --stage >19.out &&
- test_cmp M.out 19.out &&
- check_cache_at bozbar dirty'
-
-test_expect_success \
- '20 - no local change, use new tree.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- cat bozbar-old >bozbar &&
- git update-index --add bozbar &&
- read_tree_twoway $treeH $treeM &&
- git ls-files --stage >20.out &&
- test_cmp M.out 20.out &&
- check_cache_at bozbar dirty'
-
-test_expect_success \
- '21 - no local change, dirty cache.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- cat bozbar-old >bozbar &&
- git update-index --add bozbar &&
- echo gnusto gnusto >bozbar &&
- if read_tree_twoway $treeH $treeM; then false; else :; fi'
+test_expect_success '14 - unchanged in two heads.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ echo nitfol nitfol >nitfol &&
+ git update-index --add nitfol &&
+ read_tree_twoway $treeH $treeM &&
+ git ls-files --stage >14.out &&
+ test_must_fail git diff --no-index M.out 14.out >14diff.out &&
+ compare_change 14diff.out expected &&
+ check_cache_at nitfol clean
+'
+
+test_expect_success '15 - unchanged in two heads.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ echo nitfol nitfol >nitfol &&
+ git update-index --add nitfol &&
+ echo nitfol nitfol nitfol >nitfol &&
+ read_tree_twoway $treeH $treeM &&
+ git ls-files --stage >15.out &&
+ test_must_fail git diff --no-index M.out 15.out >15diff.out &&
+ compare_change 15diff.out expected &&
+ check_cache_at nitfol dirty
+'
+
+test_expect_success '16 - conflicting local change.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ echo bozbar bozbar >bozbar &&
+ git update-index --add bozbar &&
+ if read_tree_twoway $treeH $treeM; then false; else :; fi
+'
+
+test_expect_success '17 - conflicting local change.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ echo bozbar bozbar >bozbar &&
+ git update-index --add bozbar &&
+ echo bozbar bozbar bozbar >bozbar &&
+ if read_tree_twoway $treeH $treeM; then false; else :; fi
+'
+
+test_expect_success '18 - local change already having a good result.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ cat bozbar-new >bozbar &&
+ git update-index --add bozbar &&
+ read_tree_twoway $treeH $treeM &&
+ git ls-files --stage >18.out &&
+ test_cmp M.out 18.out &&
+ check_cache_at bozbar clean
+'
+
+test_expect_success '19 - local change already having a good result, further modified.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ cat bozbar-new >bozbar &&
+ git update-index --add bozbar &&
+ echo gnusto gnusto >bozbar &&
+ read_tree_twoway $treeH $treeM &&
+ git ls-files --stage >19.out &&
+ test_cmp M.out 19.out &&
+ check_cache_at bozbar dirty
+'
+
+test_expect_success '20 - no local change, use new tree.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ cat bozbar-old >bozbar &&
+ git update-index --add bozbar &&
+ read_tree_twoway $treeH $treeM &&
+ git ls-files --stage >20.out &&
+ test_cmp M.out 20.out &&
+ check_cache_at bozbar dirty
+'
+
+test_expect_success '21 - no local change, dirty cache.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ cat bozbar-old >bozbar &&
+ git update-index --add bozbar &&
+ echo gnusto gnusto >bozbar &&
+ if read_tree_twoway $treeH $treeM; then false; else :; fi
+'
# This fails with straight two-way fast-forward.
-test_expect_success \
- '22 - local change cache updated.' \
- 'rm -f .git/index &&
- read_tree_must_succeed $treeH &&
- git checkout-index -u -f -q -a &&
- sed -e "s/such as/SUCH AS/" bozbar-old >bozbar &&
- git update-index --add bozbar &&
- if read_tree_twoway $treeH $treeM; then false; else :; fi'
+test_expect_success '22 - local change cache updated.' '
+ rm -f .git/index &&
+ read_tree_must_succeed $treeH &&
+ git checkout-index -u -f -q -a &&
+ sed -e "s/such as/SUCH AS/" bozbar-old >bozbar &&
+ git update-index --add bozbar &&
+ if read_tree_twoway $treeH $treeM; then false; else :; fi
+'
# Also make sure we did not break DF vs DF/DF case.
-test_expect_success \
- 'DF vs DF/DF case setup.' \
- 'rm -f .git/index &&
- echo DF >DF &&
- git update-index --add DF &&
- treeDF=$(git write-tree) &&
- echo treeDF $treeDF &&
- git ls-tree $treeDF &&
-
- rm -f DF &&
- mkdir DF &&
- echo DF/DF >DF/DF &&
- git update-index --add --remove DF DF/DF &&
- treeDFDF=$(git write-tree) &&
- echo treeDFDF $treeDFDF &&
- git ls-tree $treeDFDF &&
- git ls-files --stage >DFDF.out'
-
-test_expect_success \
- 'DF vs DF/DF case test.' \
- 'rm -f .git/index &&
- rm -fr DF &&
- echo DF >DF &&
- git update-index --add DF &&
- read_tree_twoway $treeDF $treeDFDF &&
- git ls-files --stage >DFDFcheck.out &&
- test_cmp DFDF.out DFDFcheck.out &&
- check_cache_at DF/DF dirty &&
- :'
-
-test_expect_success \
- 'a/b (untracked) vs a case setup.' \
- 'rm -f .git/index &&
- : >a &&
- git update-index --add a &&
- treeM=$(git write-tree) &&
- echo treeM $treeM &&
- git ls-tree $treeM &&
- git ls-files --stage >treeM.out &&
-
- rm -f a &&
- git update-index --remove a &&
- mkdir a &&
- : >a/b &&
- treeH=$(git write-tree) &&
- echo treeH $treeH &&
- git ls-tree $treeH'
-
-test_expect_success \
- 'a/b (untracked) vs a, plus c/d case test.' \
- 'read_tree_u_must_fail -u -m "$treeH" "$treeM" &&
- git ls-files --stage &&
- test -f a/b'
-
-test_expect_success \
- 'a/b vs a, plus c/d case setup.' \
- 'rm -f .git/index &&
- rm -fr a &&
- : >a &&
- mkdir c &&
- : >c/d &&
- git update-index --add a c/d &&
- treeM=$(git write-tree) &&
- echo treeM $treeM &&
- git ls-tree $treeM &&
- git ls-files --stage >treeM.out &&
-
- rm -f a &&
- mkdir a &&
- : >a/b &&
- git update-index --add --remove a a/b &&
- treeH=$(git write-tree) &&
- echo treeH $treeH &&
- git ls-tree $treeH'
-
-test_expect_success \
- 'a/b vs a, plus c/d case test.' \
- 'read_tree_u_must_succeed -u -m "$treeH" "$treeM" &&
- git ls-files --stage | tee >treeMcheck.out &&
- test_cmp treeM.out treeMcheck.out'
+test_expect_success 'DF vs DF/DF case setup.' '
+ rm -f .git/index &&
+ echo DF >DF &&
+ git update-index --add DF &&
+ treeDF=$(git write-tree) &&
+ echo treeDF $treeDF &&
+ git ls-tree $treeDF &&
+
+ rm -f DF &&
+ mkdir DF &&
+ echo DF/DF >DF/DF &&
+ git update-index --add --remove DF DF/DF &&
+ treeDFDF=$(git write-tree) &&
+ echo treeDFDF $treeDFDF &&
+ git ls-tree $treeDFDF &&
+ git ls-files --stage >DFDF.out
+'
+
+test_expect_success 'DF vs DF/DF case test.' '
+ rm -f .git/index &&
+ rm -fr DF &&
+ echo DF >DF &&
+ git update-index --add DF &&
+ read_tree_twoway $treeDF $treeDFDF &&
+ git ls-files --stage >DFDFcheck.out &&
+ test_cmp DFDF.out DFDFcheck.out &&
+ check_cache_at DF/DF dirty &&
+ :
+'
+
+test_expect_success 'a/b (untracked) vs a case setup.' '
+ rm -f .git/index &&
+ : >a &&
+ git update-index --add a &&
+ treeM=$(git write-tree) &&
+ echo treeM $treeM &&
+ git ls-tree $treeM &&
+ git ls-files --stage >treeM.out &&
+
+ rm -f a &&
+ git update-index --remove a &&
+ mkdir a &&
+ : >a/b &&
+ treeH=$(git write-tree) &&
+ echo treeH $treeH &&
+ git ls-tree $treeH
+'
+
+test_expect_success 'a/b (untracked) vs a, plus c/d case test.' '
+ read_tree_u_must_fail -u -m "$treeH" "$treeM" &&
+ git ls-files --stage &&
+ test -f a/b
+'
+
+test_expect_success 'read-tree supports the super-prefix' '
+ cat <<-EOF >expect &&
+ error: Updating '\''fictional/a'\'' would lose untracked files in it
+ EOF
+ test_must_fail git --super-prefix fictional/ read-tree -u -m "$treeH" "$treeM" 2>actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'a/b vs a, plus c/d case setup.' '
+ rm -f .git/index &&
+ rm -fr a &&
+ : >a &&
+ mkdir c &&
+ : >c/d &&
+ git update-index --add a c/d &&
+ treeM=$(git write-tree) &&
+ echo treeM $treeM &&
+ git ls-tree $treeM &&
+ git ls-files --stage >treeM.out &&
+
+ rm -f a &&
+ mkdir a &&
+ : >a/b &&
+ git update-index --add --remove a a/b &&
+ treeH=$(git write-tree) &&
+ echo treeH $treeH &&
+ git ls-tree $treeH
+'
+
+test_expect_success 'a/b vs a, plus c/d case test.' '
+ read_tree_u_must_succeed -u -m "$treeH" "$treeM" &&
+ git ls-files --stage | tee >treeMcheck.out &&
+ test_cmp treeM.out treeMcheck.out
+'
test_expect_success '-m references the correct modified tree' '
echo >file-a &&
diff --git a/t/t1403-show-ref.sh b/t/t1403-show-ref.sh
index 7e10bcf..30354fd 100755
--- a/t/t1403-show-ref.sh
+++ b/t/t1403-show-ref.sh
@@ -97,6 +97,9 @@ test_expect_success 'show-ref -d' '
git show-ref -d refs/tags/A refs/tags/C >actual &&
test_cmp expect actual &&
+ git show-ref --verify -d refs/tags/A refs/tags/C >actual &&
+ test_cmp expect actual &&
+
echo $(git rev-parse refs/heads/master) refs/heads/master >expect &&
git show-ref -d master >actual &&
test_cmp expect actual &&
@@ -116,6 +119,12 @@ test_expect_success 'show-ref -d' '
test_cmp expect actual &&
test_must_fail git show-ref -d --verify heads/master >actual &&
+ test_cmp expect actual &&
+
+ test_must_fail git show-ref --verify -d A C >actual &&
+ test_cmp expect actual &&
+
+ test_must_fail git show-ref --verify -d tags/A tags/C >actual &&
test_cmp expect actual
'
@@ -164,4 +173,37 @@ test_expect_success 'show-ref --heads, --tags, --head, pattern' '
test_cmp expect actual
'
+test_expect_success 'show-ref --verify HEAD' '
+ echo $(git rev-parse HEAD) HEAD >expect &&
+ git show-ref --verify HEAD >actual &&
+ test_cmp expect actual &&
+
+ >expect &&
+
+ git show-ref --verify -q HEAD >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'show-ref --verify with dangling ref' '
+ sha1_file() {
+ echo "$*" | sed "s#..#.git/objects/&/#"
+ } &&
+
+ remove_object() {
+ file=$(sha1_file "$*") &&
+ test -e "$file" &&
+ rm -f "$file"
+ } &&
+
+ test_when_finished "rm -rf dangling" &&
+ (
+ git init dangling &&
+ cd dangling &&
+ test_commit dangling &&
+ sha=$(git rev-parse refs/tags/dangling) &&
+ remove_object $sha &&
+ test_must_fail git show-ref --verify refs/tags/dangling
+ )
+'
+
test_done
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index ee7d473..33a51c9 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -43,13 +43,13 @@ test_expect_success 'HEAD is part of refs, valid objects appear valid' '
test_expect_success 'setup: helpers for corruption tests' '
sha1_file() {
- echo "$*" | sed "s#..#.git/objects/&/#"
+ remainder=${1#??} &&
+ firsttwo=${1%$remainder} &&
+ echo ".git/objects/$firsttwo/$remainder"
} &&
remove_object() {
- file=$(sha1_file "$*") &&
- test -e "$file" &&
- rm -f "$file"
+ rm "$(sha1_file "$1")"
}
'
@@ -189,14 +189,16 @@ test_expect_success 'commit with NUL in header' '
'
test_expect_success 'tree object with duplicate entries' '
- test_when_finished "remove_object \$T" &&
+ test_when_finished "for i in \$T; do remove_object \$i; done" &&
T=$(
GIT_INDEX_FILE=test-index &&
export GIT_INDEX_FILE &&
rm -f test-index &&
>x &&
git add x &&
+ git rev-parse :x &&
T=$(git write-tree) &&
+ echo $T &&
(
git cat-file tree $T &&
git cat-file tree $T
@@ -521,9 +523,21 @@ test_expect_success 'fsck --connectivity-only' '
touch empty &&
git add empty &&
test_commit empty &&
+
+ # Drop the index now; we want to be sure that we
+ # recursively notice the broken objects
+ # because they are reachable from refs, not because
+ # they are in the index.
+ rm -f .git/index &&
+
+ # corrupt the blob, but in a way that we can still identify
+ # its type. That lets us see that --connectivity-only is
+ # not actually looking at the contents, but leaves it
+ # free to examine the type if it chooses.
empty=.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 &&
- rm -f $empty &&
- echo invalid >$empty &&
+ blob=$(echo unrelated | git hash-object -w --stdin) &&
+ mv -f $(sha1_file $blob) $empty &&
+
test_must_fail git fsck --strict &&
git fsck --strict --connectivity-only &&
tree=$(git rev-parse HEAD:) &&
@@ -535,12 +549,18 @@ test_expect_success 'fsck --connectivity-only' '
)
'
-remove_loose_object () {
- sha1="$(git rev-parse "$1")" &&
- remainder=${sha1#??} &&
- firsttwo=${sha1%$remainder} &&
- rm .git/objects/$firsttwo/$remainder
-}
+test_expect_success 'fsck --connectivity-only with explicit head' '
+ rm -rf connectivity-only &&
+ git init connectivity-only &&
+ (
+ cd connectivity-only &&
+ test_commit foo &&
+ rm -f .git/index &&
+ tree=$(git rev-parse HEAD^{tree}) &&
+ remove_object $(git rev-parse HEAD:foo.t) &&
+ test_must_fail git fsck --connectivity-only $tree
+ )
+'
test_expect_success 'fsck --name-objects' '
rm -rf name-objects &&
@@ -550,11 +570,123 @@ test_expect_success 'fsck --name-objects' '
test_commit julius caesar.t &&
test_commit augustus &&
test_commit caesar &&
- remove_loose_object $(git rev-parse julius:caesar.t) &&
+ remove_object $(git rev-parse julius:caesar.t) &&
test_must_fail git fsck --name-objects >out &&
tree=$(git rev-parse --verify julius:) &&
grep "$tree (\(refs/heads/master\|HEAD\)@{[0-9]*}:" out
)
'
+test_expect_success 'alternate objects are correctly blamed' '
+ test_when_finished "rm -rf alt.git .git/objects/info/alternates" &&
+ git init --bare alt.git &&
+ echo "../../alt.git/objects" >.git/objects/info/alternates &&
+ mkdir alt.git/objects/12 &&
+ >alt.git/objects/12/34567890123456789012345678901234567890 &&
+ test_must_fail git fsck >out 2>&1 &&
+ grep alt.git out
+'
+
+test_expect_success 'fsck errors in packed objects' '
+ git cat-file commit HEAD >basis &&
+ sed "s/</one/" basis >one &&
+ sed "s/</foo/" basis >two &&
+ one=$(git hash-object -t commit -w one) &&
+ two=$(git hash-object -t commit -w two) &&
+ pack=$(
+ {
+ echo $one &&
+ echo $two
+ } | git pack-objects .git/objects/pack/pack
+ ) &&
+ test_when_finished "rm -f .git/objects/pack/pack-$pack.*" &&
+ remove_object $one &&
+ remove_object $two &&
+ test_must_fail git fsck 2>out &&
+ grep "error in commit $one.* - bad name" out &&
+ grep "error in commit $two.* - bad name" out &&
+ ! grep corrupt out
+'
+
+test_expect_success 'fsck finds problems in duplicate loose objects' '
+ rm -rf broken-duplicate &&
+ git init broken-duplicate &&
+ (
+ cd broken-duplicate &&
+ test_commit duplicate &&
+ # no "-d" here, so we end up with duplicates
+ git repack &&
+ # now corrupt the loose copy
+ file=$(sha1_file "$(git rev-parse HEAD)") &&
+ rm "$file" &&
+ echo broken >"$file" &&
+ test_must_fail git fsck
+ )
+'
+
+test_expect_success 'fsck detects trailing loose garbage (commit)' '
+ git cat-file commit HEAD >basis &&
+ echo bump-commit-sha1 >>basis &&
+ commit=$(git hash-object -w -t commit basis) &&
+ file=$(sha1_file $commit) &&
+ test_when_finished "remove_object $commit" &&
+ chmod +w "$file" &&
+ echo garbage >>"$file" &&
+ test_must_fail git fsck 2>out &&
+ test_i18ngrep "garbage.*$commit" out
+'
+
+test_expect_success 'fsck detects trailing loose garbage (blob)' '
+ blob=$(echo trailing | git hash-object -w --stdin) &&
+ file=$(sha1_file $blob) &&
+ test_when_finished "remove_object $blob" &&
+ chmod +w "$file" &&
+ echo garbage >>"$file" &&
+ test_must_fail git fsck 2>out &&
+ test_i18ngrep "garbage.*$blob" out
+'
+
+# for each of type, we have one version which is referenced by another object
+# (and so while unreachable, not dangling), and another variant which really is
+# dangling.
+test_expect_success 'fsck notices dangling objects' '
+ git init dangling &&
+ (
+ cd dangling &&
+ blob=$(echo not-dangling | git hash-object -w --stdin) &&
+ dblob=$(echo dangling | git hash-object -w --stdin) &&
+ tree=$(printf "100644 blob %s\t%s\n" $blob one | git mktree) &&
+ dtree=$(printf "100644 blob %s\t%s\n" $blob two | git mktree) &&
+ commit=$(git commit-tree $tree) &&
+ dcommit=$(git commit-tree -p $commit $tree) &&
+
+ cat >expect <<-EOF &&
+ dangling blob $dblob
+ dangling commit $dcommit
+ dangling tree $dtree
+ EOF
+
+ git fsck >actual &&
+ # the output order is non-deterministic, as it comes from a hash
+ sort <actual >actual.sorted &&
+ test_cmp expect actual.sorted
+ )
+'
+
+test_expect_success 'fsck $name notices bogus $name' '
+ test_must_fail git fsck bogus &&
+ test_must_fail git fsck $_z40
+'
+
+test_expect_success 'bogus head does not fallback to all heads' '
+ # set up a case that will cause a reachability complaint
+ echo to-be-deleted >foo &&
+ git add foo &&
+ blob=$(git rev-parse :foo) &&
+ test_when_finished "git rm --cached foo" &&
+ remove_object $blob &&
+ test_must_fail git fsck $_z40 >out 2>&1 &&
+ ! grep $blob out
+'
+
test_done
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index c896a4c..e2f18d1 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -237,6 +237,22 @@ test_expect_success 'retain authorship' '
git show HEAD | grep "^Author: Twerp Snog"
'
+test_expect_success 'retain authorship w/ conflicts' '
+ git reset --hard twerp &&
+ test_commit a conflict a conflict-a &&
+ git reset --hard twerp &&
+ GIT_AUTHOR_NAME=AttributeMe \
+ test_commit b conflict b conflict-b &&
+ set_fake_editor &&
+ test_must_fail git rebase -i conflict-a &&
+ echo resolved >conflict &&
+ git add conflict &&
+ git rebase --continue &&
+ test $(git rev-parse conflict-a^0) = $(git rev-parse HEAD^) &&
+ git show >out &&
+ grep AttributeMe out
+'
+
test_expect_success 'squash' '
git reset --hard twerp &&
echo B > file7 &&
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index deae948..5ffe78e 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -380,4 +380,18 @@ test_expect_success 'patch mode ignores unmerged entries' '
test_cmp expected diff
'
+test_expect_success 'diffs can be colorized' '
+ git reset --hard &&
+
+ # force color even though the test script has no terminal
+ test_config color.ui always &&
+
+ echo content >test &&
+ printf y | git add -p >output 2>&1 &&
+
+ # We do not want to depend on the exact coloring scheme
+ # git uses for diffs, so just check that we saw some kind of color.
+ grep "$(printf "\\033")" output
+'
+
test_done
diff --git a/t/t4026-color.sh b/t/t4026-color.sh
index ec78c5e..671e951 100755
--- a/t/t4026-color.sh
+++ b/t/t4026-color.sh
@@ -6,10 +6,11 @@
test_description='Test diff/status color escape codes'
. ./test-lib.sh
+ESC=$(printf '\033')
color()
{
actual=$(git config --get-color no.such.slot "$1") &&
- test "$actual" = "$2"
+ test "$actual" = "${2:+$ESC}$2"
}
invalid_color()
@@ -21,6 +22,10 @@ test_expect_success 'reset' '
color "reset" "[m"
'
+test_expect_success 'empty color is empty' '
+ color "" ""
+'
+
test_expect_success 'attribute before color name' '
color "bold red" "[1;31m"
'
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 1ccbd59..08ea725 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -359,6 +359,28 @@ test_expect_success 'log --graph --line-prefix="| | | " with merge' '
test_cmp expect actual
'
+cat > expect.colors <<\EOF
+* Merge branch 'side'
+<BLUE>|<RESET><CYAN>\<RESET>
+<BLUE>|<RESET> * side-2
+<BLUE>|<RESET> * side-1
+* <CYAN>|<RESET> Second
+* <CYAN>|<RESET> sixth
+* <CYAN>|<RESET> fifth
+* <CYAN>|<RESET> fourth
+<CYAN>|<RESET><CYAN>/<RESET>
+* third
+* second
+* initial
+EOF
+
+test_expect_success 'log --graph with merge with log.graphColors' '
+ test_config log.graphColors " blue,invalid-color, cyan, red , " &&
+ git log --color=always --graph --date-order --pretty=tformat:%s |
+ test_decode_color | sed "s/ *\$//" >actual &&
+ test_cmp expect.colors actual
+'
+
test_expect_success 'log --raw --graph -m with merge' '
git log --raw --graph --oneline -m master | head -n 500 >actual &&
grep "initial" actual
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 8198d8e..ba46e86 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -764,6 +764,13 @@ test_expect_success 'rename a remote with name prefix of other remote' '
)
'
+test_expect_success 'rename succeeds with existing remote.<target>.prune' '
+ git clone one four.four &&
+ test_when_finished git config --global --unset remote.upstream.prune &&
+ git config --global remote.upstream.prune true &&
+ git -C four.four remote rename origin upstream
+'
+
cat >remotes_origin <<EOF
URL: $(pwd)/one
Push: refs/heads/master:refs/heads/upstream
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index 1524ff5..f55137f 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -454,4 +454,25 @@ test_expect_success 'push --dry-run does not recursively update submodules' '
test_cmp expected_submodule actual_submodule
'
+test_expect_success 'push --dry-run does not recursively update submodules' '
+ git -C work push --dry-run --recurse-submodules=only ../pub.git master &&
+
+ git -C submodule.git rev-parse master >actual_submodule &&
+ git -C pub.git rev-parse master >actual_pub &&
+ test_cmp expected_pub actual_pub &&
+ test_cmp expected_submodule actual_submodule
+'
+
+test_expect_success 'push only unpushed submodules recursively' '
+ git -C work/gar/bage rev-parse master >expected_submodule &&
+ git -C pub.git rev-parse master >expected_pub &&
+
+ git -C work push --recurse-submodules=only ../pub.git master &&
+
+ git -C submodule.git rev-parse master >actual_submodule &&
+ git -C pub.git rev-parse master >actual_pub &&
+ test_cmp expected_submodule actual_submodule &&
+ test_cmp expected_pub actual_pub
+'
+
test_done
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 1bf622d..072e6c6 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -879,6 +879,22 @@ test_expect_success GPG 'verifying a forged tag should fail' '
test_must_fail git tag -v forged-tag
'
+test_expect_success 'verifying a proper tag with --format pass and format accordingly' '
+ cat >expect <<-\EOF
+ tagname : signed-tag
+ EOF &&
+ git tag -v --format="tagname : %(tag)" "signed-tag" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'verifying a forged tag with --format fail and format accordingly' '
+ cat >expect <<-\EOF
+ tagname : forged-tag
+ EOF &&
+ test_must_fail git tag -v --format="tagname : %(tag)" "forged-tag" >actual &&
+ test_cmp expect actual
+'
+
# blank and empty messages for signed tags:
get_tag_header empty-signed-tag $commit commit $time >expect
diff --git a/t/t7030-verify-tag.sh b/t/t7030-verify-tag.sh
index 07079a4..d62ccbb 100755
--- a/t/t7030-verify-tag.sh
+++ b/t/t7030-verify-tag.sh
@@ -125,4 +125,20 @@ test_expect_success GPG 'verify multiple tags' '
test_cmp expect.stderr actual.stderr
'
+test_expect_success 'verifying tag with --format' '
+ cat >expect <<-\EOF
+ tagname : fourth-signed
+ EOF &&
+ git verify-tag --format="tagname : %(tag)" "fourth-signed" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'verifying a forged tag with --format fail and format accordingly' '
+ cat >expect <<-\EOF
+ tagname : 7th forged-signed
+ EOF &&
+ test_must_fail git verify-tag --format="tagname : %(tag)" $(cat forged1.tag) >actual-forged &&
+ test_cmp expect actual-forged
+'
+
test_done
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index b77cce8..c09ce0d 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -152,6 +152,20 @@ test_expect_success 'submodule add to .gitignored path with --force' '
)
'
+test_expect_success 'submodule add to reconfigure existing submodule with --force' '
+ (
+ cd addtest-ignore &&
+ git submodule add --force bogus-url submod &&
+ git submodule add -b initial "$submodurl" submod-branch &&
+ test "bogus-url" = "$(git config -f .gitmodules submodule.submod.url)" &&
+ test "bogus-url" = "$(git config submodule.submod.url)" &&
+ # Restore the url
+ git submodule add --force "$submodurl" submod
+ test "$submodurl" = "$(git config -f .gitmodules submodule.submod.url)" &&
+ test "$submodurl" = "$(git config submodule.submod.url)"
+ )
+'
+
test_expect_success 'submodule add --branch' '
echo "refs/heads/initial" >expect-head &&
cat <<-\EOF >expect-heads &&
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 725bbed..347857f 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -441,6 +441,16 @@ test_expect_success 'submodule update - command in .git/config catches failure -
test_i18ncmp actual expect
'
+test_expect_success 'submodule update - command run for initial population of submodule' '
+ cat <<-\ EOF >expect
+ Execution of '\''false $submodulesha1'\'' failed in submodule path '\''submodule'\''
+ EOF &&
+ rm -rf super/submodule &&
+ test_must_fail git -C super submodule update >../actual &&
+ test_cmp expect actual &&
+ git -C super submodule update --checkout
+'
+
cat << EOF >expect
Execution of 'false $submodulesha1' failed in submodule path '../super/submodule'
Failed to recurse into submodule path '../super'
@@ -493,6 +503,7 @@ test_expect_success 'submodule init picks up merge' '
'
test_expect_success 'submodule update --merge - ignores --merge for new submodules' '
+ test_config -C super submodule.submodule.update checkout &&
(cd super &&
rm -rf submodule &&
git submodule update submodule &&
@@ -505,6 +516,7 @@ test_expect_success 'submodule update --merge - ignores --merge for new submod
'
test_expect_success 'submodule update --rebase - ignores --rebase for new submodules' '
+ test_config -C super submodule.submodule.update checkout &&
(cd super &&
rm -rf submodule &&
git submodule update submodule &&
diff --git a/t/t7412-submodule-absorbgitdirs.sh b/t/t7412-submodule-absorbgitdirs.sh
index 1c47780..e2bbb44 100755
--- a/t/t7412-submodule-absorbgitdirs.sh
+++ b/t/t7412-submodule-absorbgitdirs.sh
@@ -64,6 +64,33 @@ test_expect_success 'absorb the git dir in a nested submodule' '
test_cmp expect.2 actual.2
'
+test_expect_success 're-setup nested submodule' '
+ # un-absorb the direct submodule, to test if the nested submodule
+ # is still correct (needs a rewrite of the gitfile only)
+ rm -rf sub1/.git &&
+ mv .git/modules/sub1 sub1/.git &&
+ GIT_WORK_TREE=. git -C sub1 config --unset core.worktree &&
+ # fixup the nested submodule
+ echo "gitdir: ../.git/modules/nested" >sub1/nested/.git &&
+ GIT_WORK_TREE=../../../nested git -C sub1/.git/modules/nested config \
+ core.worktree "../../../nested" &&
+ # make sure this re-setup is correct
+ git status --ignore-submodules=none
+'
+
+test_expect_success 'absorb the git dir in a nested submodule' '
+ git status >expect.1 &&
+ git -C sub1/nested rev-parse HEAD >expect.2 &&
+ git submodule absorbgitdirs &&
+ test -f sub1/.git &&
+ test -f sub1/nested/.git &&
+ test -d .git/modules/sub1/modules/nested &&
+ git status >actual.1 &&
+ git -C sub1/nested rev-parse HEAD >actual.2 &&
+ test_cmp expect.1 actual.1 &&
+ test_cmp expect.2 actual.2
+'
+
test_expect_success 'setup a gitlink with missing .gitmodules entry' '
git init sub2 &&
test_commit -C sub2 first &&
diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh
index 5c3db65..458608c 100755
--- a/t/t7512-status-help.sh
+++ b/t/t7512-status-help.sh
@@ -944,4 +944,23 @@ EOF
test_i18ncmp expected actual
'
+test_expect_success 'status: handle not-yet-started rebase -i gracefully' '
+ ONTO=$(git rev-parse --short HEAD^) &&
+ COMMIT=$(git rev-parse --short HEAD) &&
+ EDITOR="git status --untracked-files=no >actual" git rebase -i HEAD^ &&
+ cat >expected <<EOF &&
+On branch several_commits
+No commands done.
+Next command to do (1 remaining command):
+ pick $COMMIT four_commit
+ (use "git rebase --edit-todo" to view and edit)
+You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''.
+ (use "git commit --amend" to amend the current commit)
+ (use "git rebase --continue" once you are satisfied with your changes)
+
+nothing to commit (use -u to show untracked files)
+EOF
+ test_i18ncmp expected actual
+'
+
test_done
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 99d4123..aa0ef02 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -24,7 +24,7 @@ prompt_given ()
}
# Create a file on master and change it on branch
-test_expect_success PERL 'setup' '
+test_expect_success 'setup' '
echo master >file &&
git add file &&
git commit -m "added file" &&
@@ -36,7 +36,7 @@ test_expect_success PERL 'setup' '
'
# Configure a custom difftool.<tool>.cmd and use it
-test_expect_success PERL 'custom commands' '
+test_expect_success 'custom commands' '
difftool_test_setup &&
test_config difftool.test-tool.cmd "cat \"\$REMOTE\"" &&
echo master >expect &&
@@ -49,21 +49,21 @@ test_expect_success PERL 'custom commands' '
test_cmp expect actual
'
-test_expect_success PERL 'custom tool commands override built-ins' '
+test_expect_success 'custom tool commands override built-ins' '
test_config difftool.vimdiff.cmd "cat \"\$REMOTE\"" &&
echo master >expect &&
git difftool --tool vimdiff --no-prompt branch >actual &&
test_cmp expect actual
'
-test_expect_success PERL 'difftool ignores bad --tool values' '
+test_expect_success 'difftool ignores bad --tool values' '
: >expect &&
test_must_fail \
git difftool --no-prompt --tool=bad-tool branch >actual &&
test_cmp expect actual
'
-test_expect_success PERL 'difftool forwards arguments to diff' '
+test_expect_success 'difftool forwards arguments to diff' '
difftool_test_setup &&
>for-diff &&
git add for-diff &&
@@ -76,40 +76,40 @@ test_expect_success PERL 'difftool forwards arguments to diff' '
rm for-diff
'
-test_expect_success PERL 'difftool ignores exit code' '
+test_expect_success 'difftool ignores exit code' '
test_config difftool.error.cmd false &&
git difftool -y -t error branch
'
-test_expect_success PERL 'difftool forwards exit code with --trust-exit-code' '
+test_expect_success 'difftool forwards exit code with --trust-exit-code' '
test_config difftool.error.cmd false &&
test_must_fail git difftool -y --trust-exit-code -t error branch
'
-test_expect_success PERL 'difftool forwards exit code with --trust-exit-code for built-ins' '
+test_expect_success 'difftool forwards exit code with --trust-exit-code for built-ins' '
test_config difftool.vimdiff.path false &&
test_must_fail git difftool -y --trust-exit-code -t vimdiff branch
'
-test_expect_success PERL 'difftool honors difftool.trustExitCode = true' '
+test_expect_success 'difftool honors difftool.trustExitCode = true' '
test_config difftool.error.cmd false &&
test_config difftool.trustExitCode true &&
test_must_fail git difftool -y -t error branch
'
-test_expect_success PERL 'difftool honors difftool.trustExitCode = false' '
+test_expect_success 'difftool honors difftool.trustExitCode = false' '
test_config difftool.error.cmd false &&
test_config difftool.trustExitCode false &&
git difftool -y -t error branch
'
-test_expect_success PERL 'difftool ignores exit code with --no-trust-exit-code' '
+test_expect_success 'difftool ignores exit code with --no-trust-exit-code' '
test_config difftool.error.cmd false &&
test_config difftool.trustExitCode true &&
git difftool -y --no-trust-exit-code -t error branch
'
-test_expect_success PERL 'difftool stops on error with --trust-exit-code' '
+test_expect_success 'difftool stops on error with --trust-exit-code' '
test_when_finished "rm -f for-diff .git/fail-right-file" &&
test_when_finished "git reset -- for-diff" &&
write_script .git/fail-right-file <<-\EOF &&
@@ -124,13 +124,13 @@ test_expect_success PERL 'difftool stops on error with --trust-exit-code' '
test_cmp expect actual
'
-test_expect_success PERL 'difftool honors exit status if command not found' '
+test_expect_success 'difftool honors exit status if command not found' '
test_config difftool.nonexistent.cmd i-dont-exist &&
test_config difftool.trustExitCode false &&
test_must_fail git difftool -y -t nonexistent branch
'
-test_expect_success PERL 'difftool honors --gui' '
+test_expect_success 'difftool honors --gui' '
difftool_test_setup &&
test_config merge.tool bogus-tool &&
test_config diff.tool bogus-tool &&
@@ -141,7 +141,7 @@ test_expect_success PERL 'difftool honors --gui' '
test_cmp expect actual
'
-test_expect_success PERL 'difftool --gui last setting wins' '
+test_expect_success 'difftool --gui last setting wins' '
difftool_test_setup &&
: >expect &&
git difftool --no-prompt --gui --no-gui >actual &&
@@ -155,7 +155,7 @@ test_expect_success PERL 'difftool --gui last setting wins' '
test_cmp expect actual
'
-test_expect_success PERL 'difftool --gui works without configured diff.guitool' '
+test_expect_success 'difftool --gui works without configured diff.guitool' '
difftool_test_setup &&
echo branch >expect &&
git difftool --no-prompt --gui branch >actual &&
@@ -163,7 +163,7 @@ test_expect_success PERL 'difftool --gui works without configured diff.guitool'
'
# Specify the diff tool using $GIT_DIFF_TOOL
-test_expect_success PERL 'GIT_DIFF_TOOL variable' '
+test_expect_success 'GIT_DIFF_TOOL variable' '
difftool_test_setup &&
git config --unset diff.tool &&
echo branch >expect &&
@@ -173,7 +173,7 @@ test_expect_success PERL 'GIT_DIFF_TOOL variable' '
# Test the $GIT_*_TOOL variables and ensure
# that $GIT_DIFF_TOOL always wins unless --tool is specified
-test_expect_success PERL 'GIT_DIFF_TOOL overrides' '
+test_expect_success 'GIT_DIFF_TOOL overrides' '
difftool_test_setup &&
test_config diff.tool bogus-tool &&
test_config merge.tool bogus-tool &&
@@ -191,7 +191,7 @@ test_expect_success PERL 'GIT_DIFF_TOOL overrides' '
# Test that we don't have to pass --no-prompt to difftool
# when $GIT_DIFFTOOL_NO_PROMPT is true
-test_expect_success PERL 'GIT_DIFFTOOL_NO_PROMPT variable' '
+test_expect_success 'GIT_DIFFTOOL_NO_PROMPT variable' '
difftool_test_setup &&
echo branch >expect &&
GIT_DIFFTOOL_NO_PROMPT=true git difftool branch >actual &&
@@ -200,7 +200,7 @@ test_expect_success PERL 'GIT_DIFFTOOL_NO_PROMPT variable' '
# git-difftool supports the difftool.prompt variable.
# Test that GIT_DIFFTOOL_PROMPT can override difftool.prompt = false
-test_expect_success PERL 'GIT_DIFFTOOL_PROMPT variable' '
+test_expect_success 'GIT_DIFFTOOL_PROMPT variable' '
difftool_test_setup &&
test_config difftool.prompt false &&
echo >input &&
@@ -210,7 +210,7 @@ test_expect_success PERL 'GIT_DIFFTOOL_PROMPT variable' '
'
# Test that we don't have to pass --no-prompt when difftool.prompt is false
-test_expect_success PERL 'difftool.prompt config variable is false' '
+test_expect_success 'difftool.prompt config variable is false' '
difftool_test_setup &&
test_config difftool.prompt false &&
echo branch >expect &&
@@ -219,7 +219,7 @@ test_expect_success PERL 'difftool.prompt config variable is false' '
'
# Test that we don't have to pass --no-prompt when mergetool.prompt is false
-test_expect_success PERL 'difftool merge.prompt = false' '
+test_expect_success 'difftool merge.prompt = false' '
difftool_test_setup &&
test_might_fail git config --unset difftool.prompt &&
test_config mergetool.prompt false &&
@@ -229,7 +229,7 @@ test_expect_success PERL 'difftool merge.prompt = false' '
'
# Test that the -y flag can override difftool.prompt = true
-test_expect_success PERL 'difftool.prompt can overridden with -y' '
+test_expect_success 'difftool.prompt can overridden with -y' '
difftool_test_setup &&
test_config difftool.prompt true &&
echo branch >expect &&
@@ -238,7 +238,7 @@ test_expect_success PERL 'difftool.prompt can overridden with -y' '
'
# Test that the --prompt flag can override difftool.prompt = false
-test_expect_success PERL 'difftool.prompt can overridden with --prompt' '
+test_expect_success 'difftool.prompt can overridden with --prompt' '
difftool_test_setup &&
test_config difftool.prompt false &&
echo >input &&
@@ -248,7 +248,7 @@ test_expect_success PERL 'difftool.prompt can overridden with --prompt' '
'
# Test that the last flag passed on the command-line wins
-test_expect_success PERL 'difftool last flag wins' '
+test_expect_success 'difftool last flag wins' '
difftool_test_setup &&
echo branch >expect &&
git difftool --prompt --no-prompt branch >actual &&
@@ -261,7 +261,7 @@ test_expect_success PERL 'difftool last flag wins' '
# git-difftool falls back to git-mergetool config variables
# so test that behavior here
-test_expect_success PERL 'difftool + mergetool config variables' '
+test_expect_success 'difftool + mergetool config variables' '
test_config merge.tool test-tool &&
test_config mergetool.test-tool.cmd "cat \$LOCAL" &&
echo branch >expect &&
@@ -275,49 +275,49 @@ test_expect_success PERL 'difftool + mergetool config variables' '
test_cmp expect actual
'
-test_expect_success PERL 'difftool.<tool>.path' '
+test_expect_success 'difftool.<tool>.path' '
test_config difftool.tkdiff.path echo &&
git difftool --tool=tkdiff --no-prompt branch >output &&
lines=$(grep file output | wc -l) &&
test "$lines" -eq 1
'
-test_expect_success PERL 'difftool --extcmd=cat' '
+test_expect_success 'difftool --extcmd=cat' '
echo branch >expect &&
echo master >>expect &&
git difftool --no-prompt --extcmd=cat branch >actual &&
test_cmp expect actual
'
-test_expect_success PERL 'difftool --extcmd cat' '
+test_expect_success 'difftool --extcmd cat' '
echo branch >expect &&
echo master >>expect &&
git difftool --no-prompt --extcmd=cat branch >actual &&
test_cmp expect actual
'
-test_expect_success PERL 'difftool -x cat' '
+test_expect_success 'difftool -x cat' '
echo branch >expect &&
echo master >>expect &&
git difftool --no-prompt -x cat branch >actual &&
test_cmp expect actual
'
-test_expect_success PERL 'difftool --extcmd echo arg1' '
+test_expect_success 'difftool --extcmd echo arg1' '
echo file >expect &&
git difftool --no-prompt \
--extcmd sh\ -c\ \"echo\ \$1\" branch >actual &&
test_cmp expect actual
'
-test_expect_success PERL 'difftool --extcmd cat arg1' '
+test_expect_success 'difftool --extcmd cat arg1' '
echo master >expect &&
git difftool --no-prompt \
--extcmd sh\ -c\ \"cat\ \$1\" branch >actual &&
test_cmp expect actual
'
-test_expect_success PERL 'difftool --extcmd cat arg2' '
+test_expect_success 'difftool --extcmd cat arg2' '
echo branch >expect &&
git difftool --no-prompt \
--extcmd sh\ -c\ \"cat\ \$2\" branch >actual &&
@@ -325,7 +325,7 @@ test_expect_success PERL 'difftool --extcmd cat arg2' '
'
# Create a second file on master and a different version on branch
-test_expect_success PERL 'setup with 2 files different' '
+test_expect_success 'setup with 2 files different' '
echo m2 >file2 &&
git add file2 &&
git commit -m "added file2" &&
@@ -337,7 +337,7 @@ test_expect_success PERL 'setup with 2 files different' '
git checkout master
'
-test_expect_success PERL 'say no to the first file' '
+test_expect_success 'say no to the first file' '
(echo n && echo) >input &&
git difftool -x cat branch <input >output &&
grep m2 output &&
@@ -346,7 +346,7 @@ test_expect_success PERL 'say no to the first file' '
! grep branch output
'
-test_expect_success PERL 'say no to the second file' '
+test_expect_success 'say no to the second file' '
(echo && echo n) >input &&
git difftool -x cat branch <input >output &&
grep master output &&
@@ -355,7 +355,7 @@ test_expect_success PERL 'say no to the second file' '
! grep br2 output
'
-test_expect_success PERL 'ending prompt input with EOF' '
+test_expect_success 'ending prompt input with EOF' '
git difftool -x cat branch </dev/null >output &&
! grep master output &&
! grep branch output &&
@@ -363,12 +363,12 @@ test_expect_success PERL 'ending prompt input with EOF' '
! grep br2 output
'
-test_expect_success PERL 'difftool --tool-help' '
+test_expect_success 'difftool --tool-help' '
git difftool --tool-help >output &&
grep tool output
'
-test_expect_success PERL 'setup change in subdirectory' '
+test_expect_success 'setup change in subdirectory' '
git checkout master &&
mkdir sub &&
echo master >sub/sub &&
@@ -382,11 +382,11 @@ test_expect_success PERL 'setup change in subdirectory' '
'
run_dir_diff_test () {
- test_expect_success PERL "$1 --no-symlinks" "
+ test_expect_success "$1 --no-symlinks" "
symlinks=--no-symlinks &&
$2
"
- test_expect_success PERL,SYMLINKS "$1 --symlinks" "
+ test_expect_success SYMLINKS "$1 --symlinks" "
symlinks=--symlinks &&
$2
"
@@ -508,7 +508,7 @@ do
done >actual
EOF
-test_expect_success PERL,SYMLINKS 'difftool --dir-diff --symlink without unstaged changes' '
+test_expect_success SYMLINKS 'difftool --dir-diff --symlink without unstaged changes' '
cat >expect <<-EOF &&
file
$PWD/file
@@ -545,7 +545,7 @@ write_script modify-file <<\EOF
echo "new content" >file
EOF
-test_expect_success PERL 'difftool --no-symlinks does not overwrite working tree file ' '
+test_expect_success 'difftool --no-symlinks does not overwrite working tree file ' '
echo "orig content" >file &&
git difftool --dir-diff --no-symlinks --extcmd "$PWD/modify-file" branch &&
echo "new content" >expect &&
@@ -558,7 +558,7 @@ echo "tmp content" >"$2/file" &&
echo "$2" >tmpdir
EOF
-test_expect_success PERL 'difftool --no-symlinks detects conflict ' '
+test_expect_success 'difftool --no-symlinks detects conflict ' '
(
TMPDIR=$TRASH_DIRECTORY &&
export TMPDIR &&
@@ -571,7 +571,7 @@ test_expect_success PERL 'difftool --no-symlinks detects conflict ' '
)
'
-test_expect_success PERL 'difftool properly honors gitlink and core.worktree' '
+test_expect_success 'difftool properly honors gitlink and core.worktree' '
git submodule add ./. submod/ule &&
test_config -C submod/ule diff.tool checktrees &&
test_config -C submod/ule difftool.checktrees.cmd '\''
@@ -585,7 +585,7 @@ test_expect_success PERL 'difftool properly honors gitlink and core.worktree' '
)
'
-test_expect_success PERL,SYMLINKS 'difftool --dir-diff symlinked directories' '
+test_expect_success SYMLINKS 'difftool --dir-diff symlinked directories' '
git init dirlinks &&
(
cd dirlinks &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index cde7fc7..86d77c1 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -966,7 +966,8 @@ yes () {
}
# Fix some commands on Windows
-case $(uname -s) in
+uname_s=$(uname -s)
+case $uname_s in
*MINGW*)
# Windows has its own (incompatible) sort and find
sort () {
@@ -1141,6 +1142,7 @@ test_lazy_prereq SANITY '
return $status
'
+test FreeBSD != $uname_s || GIT_UNZIP=${GIT_UNZIP:-/usr/local/bin/unzip}
GIT_UNZIP=${GIT_UNZIP:-unzip}
test_lazy_prereq UNZIP '
"$GIT_UNZIP" -v