summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/annotate-tests.sh5
-rwxr-xr-xt/t2014-switch.sh28
-rwxr-xr-xt/t4014-format-patch.sh11
-rwxr-xr-xt/t4018-diff-funcname.sh2
-rwxr-xr-xt/t4021-format-patch-numbered.sh6
-rwxr-xr-xt/t4029-diff-trailing-space.sh2
-rwxr-xr-xt/t4118-apply-empty-context.sh4
-rwxr-xr-xt/t4200-rerere.sh4
-rwxr-xr-xt/t7201-co.sh8
-rwxr-xr-xt/t8005-blame-i18n.sh8
10 files changed, 66 insertions, 12 deletions
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index cacb273aff..396b9653a3 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -114,7 +114,10 @@ test_expect_success \
test_expect_success \
'some edit' \
'mv file file.orig &&
- sed -e "s/^3A/99/" -e "/^1A/d" -e "/^incomplete/d" < file.orig > file &&
+ {
+ cat file.orig &&
+ echo
+ } | sed -e "s/^3A/99/" -e "/^1A/d" -e "/^incomplete/d" > file &&
echo "incomplete" | tr -d "\\012" >>file &&
GIT_AUTHOR_NAME="D" git commit -a -m "edit"'
diff --git a/t/t2014-switch.sh b/t/t2014-switch.sh
new file mode 100755
index 0000000000..ccfb147113
--- /dev/null
+++ b/t/t2014-switch.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+test_description='Peter MacMillan'
+. ./test-lib.sh
+
+test_expect_success setup '
+ echo Hello >file &&
+ git add file &&
+ test_tick &&
+ git commit -m V1 &&
+ echo Hello world >file &&
+ git add file &&
+ git checkout -b other
+'
+
+test_expect_success 'check all changes are staged' '
+ git diff --exit-code
+'
+
+test_expect_success 'second commit' '
+ git commit -m V2
+'
+
+test_expect_success 'check' '
+ git diff --cached --exit-code
+'
+
+test_done
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 11061ddd5b..922a8941ed 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -505,4 +505,15 @@ test_expect_success 'format-patch from a subdirectory (3)' '
test -f "$basename"
'
+test_expect_success 'format-patch --in-reply-to' '
+ git format-patch -1 --stdout --in-reply-to "baz@foo.bar" > patch8 &&
+ grep "^In-Reply-To: <baz@foo.bar>" patch8 &&
+ grep "^References: <baz@foo.bar>" patch8
+'
+
+test_expect_success 'format-patch --signoff' '
+ git format-patch -1 --signoff --stdout |
+ grep "^Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
+'
+
test_done
diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
index be541348c6..5b10e976a3 100755
--- a/t/t4018-diff-funcname.sh
+++ b/t/t4018-diff-funcname.sh
@@ -32,7 +32,7 @@ EOF
sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java
-builtin_patterns="bibtex html java objc pascal php python ruby tex"
+builtin_patterns="bibtex cpp html java objc pascal php python ruby tex"
for p in $builtin_patterns
do
test_expect_success "builtin $p pattern compiles" '
diff --git a/t/t4021-format-patch-numbered.sh b/t/t4021-format-patch-numbered.sh
index 390af2389f..3c27f0dc19 100755
--- a/t/t4021-format-patch-numbered.sh
+++ b/t/t4021-format-patch-numbered.sh
@@ -108,4 +108,10 @@ test_expect_success 'format.numbered = auto && --no-numbered' '
'
+test_expect_success '--start-number && --numbered' '
+
+ git format-patch --start-number 3 --numbered --stdout HEAD~1 > patch8 &&
+ grep "^Subject: \[PATCH 3/3\]" patch8
+'
+
test_done
diff --git a/t/t4029-diff-trailing-space.sh b/t/t4029-diff-trailing-space.sh
index 9ddbbcde57..3ccc237a8d 100755
--- a/t/t4029-diff-trailing-space.sh
+++ b/t/t4029-diff-trailing-space.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Jim Meyering
#
diff --git a/t/t4118-apply-empty-context.sh b/t/t4118-apply-empty-context.sh
index f92e259cc6..65f2e4c3ef 100755
--- a/t/t4118-apply-empty-context.sh
+++ b/t/t4118-apply-empty-context.sh
@@ -20,10 +20,10 @@ test_expect_success setup '
cat file1 &&
echo Q | tr -d "\\012"
} >file2 &&
- cat file2 >file2.orig
+ cat file2 >file2.orig &&
git add file1 file2 &&
sed -e "/^B/d" <file1.orig >file1 &&
- sed -e "/^[BQ]/d" <file2.orig >file2 &&
+ cat file1 > file2 &&
echo Q | tr -d "\\012" >>file2 &&
cat file1 >file1.mods &&
cat file2 >file2.mods &&
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index b68ab11f29..a6bc028a57 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -57,7 +57,7 @@ test_expect_success 'conflicting merge' '
test_must_fail git merge first
'
-sha1=$(sed -e 's/ .*//' .git/MERGE_RR)
+sha1=$(perl -pe 's/ .*//' .git/MERGE_RR)
rr=.git/rr-cache/$sha1
test_expect_success 'recorded preimage' "grep ^=======$ $rr/preimage"
@@ -190,8 +190,6 @@ test_expect_success 'file2 added differently in two branches' '
git add file2 &&
git commit -m version2 &&
test_must_fail git merge fourth &&
- sha1=$(sed -e "s/ .*//" .git/MERGE_RR) &&
- rr=.git/rr-cache/$sha1 &&
echo Cello > file2 &&
git add file2 &&
git commit -m resolution
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index bdb808af1a..ebfd34df36 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -534,4 +534,12 @@ test_expect_success 'failing checkout -b should not break working tree' '
'
+test_expect_success 'switch out of non-branch' '
+ git reset --hard master &&
+ git checkout master^0 &&
+ echo modified >one &&
+ test_must_fail git checkout renamer 2>error.log &&
+ ! grep "^Previous HEAD" error.log
+'
+
test_done
diff --git a/t/t8005-blame-i18n.sh b/t/t8005-blame-i18n.sh
index 4470a92bb2..fcd5c26675 100755
--- a/t/t8005-blame-i18n.sh
+++ b/t/t8005-blame-i18n.sh
@@ -36,7 +36,7 @@ EOF
test_expect_success \
'blame respects i18n.commitencoding' '
git blame --incremental file | \
- grep "^\(author\|summary\) " > actual &&
+ egrep "^(author|summary) " > actual &&
test_cmp actual expected
'
@@ -53,7 +53,7 @@ test_expect_success \
'blame respects i18n.logoutputencoding' '
git config i18n.logoutputencoding cp1251 &&
git blame --incremental file | \
- grep "^\(author\|summary\) " > actual &&
+ egrep "^(author|summary) " > actual &&
test_cmp actual expected
'
@@ -69,7 +69,7 @@ EOF
test_expect_success \
'blame respects --encoding=utf-8' '
git blame --incremental --encoding=utf-8 file | \
- grep "^\(author\|summary\) " > actual &&
+ egrep "^(author|summary) " > actual &&
test_cmp actual expected
'
@@ -85,7 +85,7 @@ EOF
test_expect_success \
'blame respects --encoding=none' '
git blame --incremental --encoding=none file | \
- grep "^\(author\|summary\) " > actual &&
+ egrep "^(author|summary) " > actual &&
test_cmp actual expected
'