2005-06-07 22:36:30 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2005 Junio C Hamano
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='Two way merge with read-tree -m -u $H $M
|
|
|
|
|
|
|
|
This is identical to t1001, but uses -u to update the work tree as well.
|
|
|
|
|
|
|
|
'
|
|
|
|
. ./test-lib.sh
|
2011-05-26 00:10:41 +04:00
|
|
|
. "$TEST_DIRECTORY"/lib-read-tree.sh
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
compare_change () {
|
|
|
|
sed >current \
|
2008-08-19 03:17:53 +04:00
|
|
|
-e '1{/^diff --git /d;}' \
|
|
|
|
-e '2{/^index /d;}' \
|
2005-06-07 22:36:30 +04:00
|
|
|
-e '/^--- /d; /^+++ /d; /^@@ /d;' \
|
2018-05-13 05:24:15 +03:00
|
|
|
-e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$OID_REGEX"' /\1 X /' "$1"
|
2008-05-24 09:28:56 +04:00
|
|
|
test_cmp expected current
|
2005-06-07 22:36:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
check_cache_at () {
|
2014-04-28 16:57:33 +04:00
|
|
|
clean_if_empty=$(git diff-files -- "$1")
|
2005-06-07 22:36:30 +04:00
|
|
|
case "$clean_if_empty" in
|
|
|
|
'') echo "$1: clean" ;;
|
|
|
|
?*) echo "$1: dirty" ;;
|
|
|
|
esac
|
|
|
|
case "$2,$clean_if_empty" in
|
|
|
|
clean,) : ;;
|
|
|
|
clean,?*) false ;;
|
|
|
|
dirty,) false ;;
|
|
|
|
dirty,?*) : ;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
setup \
|
|
|
|
'echo frotz >frotz &&
|
|
|
|
echo nitfol >nitfol &&
|
|
|
|
echo bozbar >bozbar &&
|
|
|
|
echo rezrov >rezrov &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add nitfol bozbar rezrov &&
|
2014-04-28 16:57:33 +04:00
|
|
|
treeH=$(git write-tree) &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo treeH $treeH &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-tree $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
echo gnusto >bozbar &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add frotz bozbar --force-remove rezrov &&
|
|
|
|
git ls-files --stage >M.out &&
|
2014-04-28 16:57:33 +04:00
|
|
|
treeM=$(git write-tree) &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo treeM $treeM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-tree $treeM &&
|
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 23:16:34 +03:00
|
|
|
cp bozbar bozbar.M &&
|
|
|
|
cp frotz frotz.M &&
|
|
|
|
cp nitfol nitfol.M &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git diff-tree $treeH $treeM'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'1, 2, 3 - no carry forward' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
|
|
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-files --stage >1-3.out &&
|
2005-06-07 22:36:30 +04:00
|
|
|
cmp M.out 1-3.out &&
|
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 23:16:34 +03:00
|
|
|
test_cmp bozbar.M bozbar &&
|
|
|
|
test_cmp frotz.M frotz &&
|
|
|
|
test_cmp nitfol.M nitfol &&
|
2005-06-07 22:36:30 +04:00
|
|
|
check_cache_at bozbar clean &&
|
|
|
|
check_cache_at frotz clean &&
|
|
|
|
check_cache_at nitfol clean'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'4 - carry forward local addition.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2006-05-17 12:17:46 +04:00
|
|
|
echo "+100644 X 0 yomin" >expected &&
|
|
|
|
echo yomin >yomin &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add yomin &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
2015-03-20 13:11:32 +03:00
|
|
|
git ls-files --stage >4.out &&
|
|
|
|
test_might_fail git diff -U0 --no-index M.out 4.out >4diff.out &&
|
2005-06-07 22:36:30 +04:00
|
|
|
compare_change 4diff.out expected &&
|
|
|
|
check_cache_at yomin clean &&
|
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 23:16:34 +03:00
|
|
|
test_cmp bozbar.M bozbar &&
|
|
|
|
test_cmp frotz.M frotz &&
|
|
|
|
test_cmp nitfol.M nitfol &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo yomin >yomin1 &&
|
|
|
|
diff yomin yomin1 &&
|
|
|
|
rm -f yomin1'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'5 - carry forward local addition.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
|
|
|
read_tree_u_must_succeed -m -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo yomin >yomin &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add yomin &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo yomin yomin >yomin &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
2015-03-20 13:11:32 +03:00
|
|
|
git ls-files --stage >5.out &&
|
|
|
|
test_might_fail git diff -U0 --no-index M.out 5.out >5diff.out &&
|
2005-06-07 22:36:30 +04:00
|
|
|
compare_change 5diff.out expected &&
|
|
|
|
check_cache_at yomin dirty &&
|
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 23:16:34 +03:00
|
|
|
test_cmp bozbar.M bozbar &&
|
|
|
|
test_cmp frotz.M frotz &&
|
|
|
|
test_cmp nitfol.M nitfol &&
|
2005-06-08 13:08:54 +04:00
|
|
|
: dirty index should have prevented -u from checking it out. &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo yomin yomin >yomin1 &&
|
|
|
|
diff yomin yomin1 &&
|
|
|
|
rm -f yomin1'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'6 - local addition already has the same.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2006-05-17 12:17:46 +04:00
|
|
|
echo frotz >frotz &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-files --stage >6.out &&
|
2008-07-23 01:17:43 +04:00
|
|
|
test_cmp M.out 6.out &&
|
2005-06-07 22:36:30 +04:00
|
|
|
check_cache_at frotz clean &&
|
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 23:16:34 +03:00
|
|
|
test_cmp bozbar.M bozbar &&
|
|
|
|
test_cmp frotz.M frotz &&
|
|
|
|
test_cmp nitfol.M nitfol &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo frotz >frotz1 &&
|
|
|
|
diff frotz frotz1 &&
|
|
|
|
rm -f frotz1'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'7 - local addition already has the same.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo frotz >frotz &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add frotz &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo frotz frotz >frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-files --stage >7.out &&
|
2008-07-23 01:17:43 +04:00
|
|
|
test_cmp M.out 7.out &&
|
2005-06-07 22:36:30 +04:00
|
|
|
check_cache_at frotz dirty &&
|
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 23:16:34 +03:00
|
|
|
test_cmp bozbar.M bozbar &&
|
|
|
|
test_cmp nitfol.M nitfol &&
|
2005-06-08 13:08:54 +04:00
|
|
|
: dirty index should have prevented -u from checking it out. &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo frotz frotz >frotz1 &&
|
|
|
|
diff frotz frotz1 &&
|
|
|
|
rm -f frotz1'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'8 - conflicting addition.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo frotz frotz >frotz &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'9 - conflicting addition.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo frotz frotz >frotz &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add frotz &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo frotz >frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'10 - path removed.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo rezrov >rezrov &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add rezrov &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-files --stage >10.out &&
|
2005-06-07 22:36:30 +04:00
|
|
|
cmp M.out 10.out &&
|
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 23:16:34 +03:00
|
|
|
test_cmp bozbar.M bozbar &&
|
|
|
|
test_cmp frotz.M frotz &&
|
|
|
|
test_cmp nitfol.M nitfol
|
|
|
|
'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'11 - dirty path removed.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo rezrov >rezrov &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add rezrov &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo rezrov rezrov >rezrov &&
|
2011-05-26 00:10:41 +04:00
|
|
|
if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'12 - unmatching local changes being removed.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo rezrov rezrov >rezrov &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add rezrov &&
|
2011-05-26 00:10:41 +04:00
|
|
|
if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'13 - unmatching local changes being removed.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo rezrov rezrov >rezrov &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add rezrov &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo rezrov >rezrov &&
|
2011-05-26 00:10:41 +04:00
|
|
|
if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
cat >expected <<EOF
|
|
|
|
-100644 X 0 nitfol
|
|
|
|
+100644 X 0 nitfol
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'14 - unchanged in two heads.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo nitfol nitfol >nitfol &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add nitfol &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
2010-10-04 00:00:02 +04:00
|
|
|
git ls-files --stage >14.out &&
|
|
|
|
test_must_fail git diff -U0 --no-index M.out 14.out >14diff.out &&
|
2005-06-07 22:36:30 +04:00
|
|
|
compare_change 14diff.out expected &&
|
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 23:16:34 +03:00
|
|
|
test_cmp bozbar.M bozbar &&
|
|
|
|
test_cmp frotz.M frotz &&
|
2005-06-07 22:36:30 +04:00
|
|
|
check_cache_at nitfol clean &&
|
|
|
|
echo nitfol nitfol >nitfol1 &&
|
|
|
|
diff nitfol nitfol1 &&
|
|
|
|
rm -f nitfol1'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'15 - unchanged in two heads.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo nitfol nitfol >nitfol &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add nitfol &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo nitfol nitfol nitfol >nitfol &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
2010-10-04 00:00:02 +04:00
|
|
|
git ls-files --stage >15.out &&
|
|
|
|
test_must_fail git diff -U0 --no-index M.out 15.out >15diff.out &&
|
2005-06-07 22:36:30 +04:00
|
|
|
compare_change 15diff.out expected &&
|
|
|
|
check_cache_at nitfol dirty &&
|
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 23:16:34 +03:00
|
|
|
test_cmp bozbar.M bozbar &&
|
|
|
|
test_cmp frotz.M frotz &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo nitfol nitfol nitfol >nitfol1 &&
|
|
|
|
diff nitfol nitfol1 &&
|
|
|
|
rm -f nitfol1'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'16 - conflicting local change.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo bozbar bozbar >bozbar &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add bozbar &&
|
2011-05-26 00:10:41 +04:00
|
|
|
if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'17 - conflicting local change.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo bozbar bozbar >bozbar &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add bozbar &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo bozbar bozbar bozbar >bozbar &&
|
2011-05-26 00:10:41 +04:00
|
|
|
if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'18 - local change already having a good result.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo gnusto >bozbar &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add bozbar &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-files --stage >18.out &&
|
2008-07-23 01:17:43 +04:00
|
|
|
test_cmp M.out 18.out &&
|
2005-06-07 22:36:30 +04:00
|
|
|
check_cache_at bozbar clean &&
|
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 23:16:34 +03:00
|
|
|
test_cmp bozbar.M bozbar &&
|
|
|
|
test_cmp frotz.M frotz &&
|
|
|
|
test_cmp nitfol.M nitfol
|
|
|
|
'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'19 - local change already having a good result, further modified.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo gnusto >bozbar &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add bozbar &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo gnusto gnusto >bozbar &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-files --stage >19.out &&
|
2008-07-23 01:17:43 +04:00
|
|
|
test_cmp M.out 19.out &&
|
2005-06-07 22:36:30 +04:00
|
|
|
check_cache_at bozbar dirty &&
|
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 23:16:34 +03:00
|
|
|
test_cmp frotz.M frotz &&
|
|
|
|
test_cmp nitfol.M nitfol &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo gnusto gnusto >bozbar1 &&
|
|
|
|
diff bozbar bozbar1 &&
|
|
|
|
rm -f bozbar1'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'20 - no local change, use new tree.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo bozbar >bozbar &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add bozbar &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-files --stage >20.out &&
|
2008-07-23 01:17:43 +04:00
|
|
|
test_cmp M.out 20.out &&
|
2005-06-07 22:36:30 +04:00
|
|
|
check_cache_at bozbar clean &&
|
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 23:16:34 +03:00
|
|
|
test_cmp bozbar.M bozbar &&
|
|
|
|
test_cmp frotz.M frotz &&
|
|
|
|
test_cmp nitfol.M nitfol
|
|
|
|
'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'21 - no local change, dirty cache.' \
|
2006-05-17 12:17:46 +04:00
|
|
|
'rm -f .git/index nitfol bozbar rezrov frotz &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed --reset -u $treeH &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo bozbar >bozbar &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add bozbar &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo gnusto gnusto >bozbar &&
|
2011-05-26 00:10:41 +04:00
|
|
|
if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
# Also make sure we did not break DF vs DF/DF case.
|
|
|
|
test_expect_success \
|
|
|
|
'DF vs DF/DF case setup.' \
|
2010-10-04 00:00:02 +04:00
|
|
|
'rm -f .git/index &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo DF >DF &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add DF &&
|
2014-04-28 16:57:33 +04:00
|
|
|
treeDF=$(git write-tree) &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo treeDF $treeDF &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-tree $treeDF &&
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
rm -f DF &&
|
|
|
|
mkdir DF &&
|
|
|
|
echo DF/DF >DF/DF &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add --remove DF DF/DF &&
|
2014-04-28 16:57:33 +04:00
|
|
|
treeDFDF=$(git write-tree) &&
|
2005-06-07 22:36:30 +04:00
|
|
|
echo treeDFDF $treeDFDF &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-tree $treeDFDF &&
|
|
|
|
git ls-files --stage >DFDF.out'
|
2005-06-07 22:36:30 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'DF vs DF/DF case test.' \
|
|
|
|
'rm -f .git/index &&
|
|
|
|
rm -fr DF &&
|
|
|
|
echo DF >DF &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add DF &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_u_must_succeed -m -u $treeDF $treeDFDF &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-files --stage >DFDFcheck.out &&
|
2008-07-23 01:17:43 +04:00
|
|
|
test_cmp DFDF.out DFDFcheck.out &&
|
2005-06-07 22:36:30 +04:00
|
|
|
check_cache_at DF/DF clean'
|
|
|
|
|
|
|
|
test_done
|