mirror of
https://github.com/git/git.git
synced 2024-11-17 14:34:49 +01:00
82ebb0b6ec
Many scripts compare actual and expected output using "diff -u". This is nicer than "cmp" because the output shows how the two differ. However, not all versions of diff understand -u, leading to unnecessary test failure. This adds a test_cmp function to the test scripts and switches all "diff -u" invocations to use it. The function uses the contents of "$GIT_TEST_CMP" to compare its arguments; the default is "diff -u". On systems with a less-capable diff, you can do: GIT_TEST_CMP=cmp make test Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
44 lines
652 B
Bash
Executable file
44 lines
652 B
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='messages from rebase operation'
|
|
|
|
. ./test-lib.sh
|
|
|
|
quick_one () {
|
|
echo "$1" >"file$1" &&
|
|
git add "file$1" &&
|
|
test_tick &&
|
|
git commit -m "$1"
|
|
}
|
|
|
|
test_expect_success setup '
|
|
quick_one O &&
|
|
git branch topic &&
|
|
quick_one X &&
|
|
quick_one A &&
|
|
quick_one B &&
|
|
quick_one Y &&
|
|
|
|
git checkout topic &&
|
|
quick_one A &&
|
|
quick_one B &&
|
|
quick_one Z
|
|
|
|
'
|
|
|
|
cat >expect <<\EOF
|
|
Already applied: 0001 A
|
|
Already applied: 0002 B
|
|
Committed: 0003 Z
|
|
EOF
|
|
|
|
test_expect_success 'rebase -m' '
|
|
|
|
git rebase -m master >report &&
|
|
sed -n -e "/^Already applied: /p" \
|
|
-e "/^Committed: /p" report >actual &&
|
|
test_cmp expect actual
|
|
|
|
'
|
|
|
|
test_done
|