mirror of
https://github.com/git/git.git
synced 2026-04-02 21:10:10 +02:00
This reverts the following commits:abd1fa1test-suite: Log everything to a file in non-verbose mode50f37d1Implement test-stat the prints the modification time.fc7fe85gitk: Swap positions of 'next' and 'prev' buttons in the 'Find' section.f80f1dbNeed diff -u -b in t7401 because some lines end in CRLF.85763c8Implement thread-specific die() routines; use one in start_async().4eb0463Make report() from usage.c public as vreport().ddce705Skip tests that fail due to incomplete implementations, missing tools...a094080Do not issue the warning about the fallback of the PREFIX. These were brought in by the merge commitdc8b641that merged my private work-in-progress branch. Only these two commits remain:1e52e22Windows: Work around intermittent failures in mingw_renameccd3859Windows: Better support PAGER settings with spaces in the path Signed-off-by: Johannes Sixt <j6t@kdbg.org>
213 lines
3.8 KiB
Bash
Executable File
213 lines
3.8 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Copyright (c) 2008 Ping Yin
|
|
#
|
|
|
|
test_description='Summary support for submodules
|
|
|
|
This test tries to verify the sanity of summary subcommand of git submodule.
|
|
'
|
|
|
|
case $(uname -s) in
|
|
*MINGW*) GIT_TEST_CMP="diff -uw";;
|
|
esac
|
|
|
|
. ./test-lib.sh
|
|
|
|
add_file () {
|
|
sm=$1
|
|
shift
|
|
owd=$(pwd)
|
|
cd "$sm"
|
|
for name; do
|
|
echo "$name" > "$name" &&
|
|
git add "$name" &&
|
|
test_tick &&
|
|
git commit -m "Add $name"
|
|
done >/dev/null
|
|
git rev-parse --verify HEAD | cut -c1-7
|
|
cd "$owd"
|
|
}
|
|
commit_file () {
|
|
test_tick &&
|
|
git commit "$@" -m "Commit $*" >/dev/null
|
|
}
|
|
|
|
test_create_repo sm1 &&
|
|
add_file . foo >/dev/null
|
|
|
|
head1=$(add_file sm1 foo1 foo2)
|
|
|
|
test_expect_success 'added submodule' "
|
|
git add sm1 &&
|
|
git submodule summary >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm1 0000000...$head1 (2):
|
|
> Add foo2
|
|
|
|
EOF
|
|
"
|
|
|
|
commit_file sm1 &&
|
|
head2=$(add_file sm1 foo3)
|
|
|
|
test_expect_success 'modified submodule(forward)' "
|
|
git submodule summary >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm1 $head1...$head2 (1):
|
|
> Add foo3
|
|
|
|
EOF
|
|
"
|
|
|
|
commit_file sm1 &&
|
|
cd sm1 &&
|
|
git reset --hard HEAD~2 >/dev/null &&
|
|
head3=$(git rev-parse --verify HEAD | cut -c1-7) &&
|
|
cd ..
|
|
|
|
test_expect_success 'modified submodule(backward)' "
|
|
git submodule summary >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm1 $head2...$head3 (2):
|
|
< Add foo3
|
|
< Add foo2
|
|
|
|
EOF
|
|
"
|
|
|
|
head4=$(add_file sm1 foo4 foo5) &&
|
|
head4_full=$(GIT_DIR=sm1/.git git rev-parse --verify HEAD)
|
|
test_expect_success 'modified submodule(backward and forward)' "
|
|
git submodule summary >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm1 $head2...$head4 (4):
|
|
> Add foo5
|
|
> Add foo4
|
|
< Add foo3
|
|
< Add foo2
|
|
|
|
EOF
|
|
"
|
|
|
|
test_expect_success '--summary-limit' "
|
|
git submodule summary -n 3 >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm1 $head2...$head4 (4):
|
|
> Add foo5
|
|
> Add foo4
|
|
< Add foo3
|
|
|
|
EOF
|
|
"
|
|
|
|
commit_file sm1 &&
|
|
mv sm1 sm1-bak &&
|
|
echo sm1 >sm1 &&
|
|
head5=$(git hash-object sm1 | cut -c1-7) &&
|
|
git add sm1 &&
|
|
rm -f sm1 &&
|
|
mv sm1-bak sm1
|
|
|
|
test_expect_success 'typechanged submodule(submodule->blob), --cached' "
|
|
git submodule summary --cached >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm1 $head4(submodule)->$head5(blob) (3):
|
|
< Add foo5
|
|
|
|
EOF
|
|
"
|
|
|
|
rm -rf sm1 &&
|
|
git checkout-index sm1
|
|
test_expect_success 'typechanged submodule(submodule->blob)' "
|
|
git submodule summary >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm1 $head4(submodule)->$head5(blob):
|
|
|
|
EOF
|
|
"
|
|
|
|
rm -f sm1 &&
|
|
test_create_repo sm1 &&
|
|
head6=$(add_file sm1 foo6 foo7)
|
|
test_expect_success 'nonexistent commit' "
|
|
git submodule summary >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm1 $head4...$head6:
|
|
Warn: sm1 doesn't contain commit $head4_full
|
|
|
|
EOF
|
|
"
|
|
|
|
commit_file
|
|
test_expect_success 'typechanged submodule(blob->submodule)' "
|
|
git submodule summary >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm1 $head5(blob)->$head6(submodule) (2):
|
|
> Add foo7
|
|
|
|
EOF
|
|
"
|
|
|
|
commit_file sm1 &&
|
|
rm -rf sm1
|
|
test_expect_success 'deleted submodule' "
|
|
git submodule summary >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm1 $head6...0000000:
|
|
|
|
EOF
|
|
"
|
|
|
|
test_create_repo sm2 &&
|
|
head7=$(add_file sm2 foo8 foo9) &&
|
|
git add sm2
|
|
|
|
test_expect_success 'multiple submodules' "
|
|
git submodule summary >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm1 $head6...0000000:
|
|
|
|
* sm2 0000000...$head7 (2):
|
|
> Add foo9
|
|
|
|
EOF
|
|
"
|
|
|
|
test_expect_success 'path filter' "
|
|
git submodule summary sm2 >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm2 0000000...$head7 (2):
|
|
> Add foo9
|
|
|
|
EOF
|
|
"
|
|
|
|
commit_file sm2
|
|
test_expect_success 'given commit' "
|
|
git submodule summary HEAD^ >actual &&
|
|
test_cmp actual - <<-EOF
|
|
* sm1 $head6...0000000:
|
|
|
|
* sm2 0000000...$head7 (2):
|
|
> Add foo9
|
|
|
|
EOF
|
|
"
|
|
|
|
test_expect_success '--for-status' "
|
|
git submodule summary --for-status HEAD^ >actual &&
|
|
test_cmp actual - <<EOF
|
|
# Modified submodules:
|
|
#
|
|
# * sm1 $head6...0000000:
|
|
#
|
|
# * sm2 0000000...$head7 (2):
|
|
# > Add foo9
|
|
#
|
|
EOF
|
|
"
|
|
|
|
test_done
|