summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rwxr-xr-xt/t3001-ls-files-others-exclude.sh2
-rwxr-xr-xt/t4001-diff-rename.sh4
-rwxr-xr-xt/t7500-commit.sh13
-rwxr-xr-xt/t7501-commit.sh27
-rwxr-xr-xt/t7502-commit.sh92
-rwxr-xr-xt/t7502-status.sh91
6 files changed, 226 insertions, 3 deletions
diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh
index ae0639d8f3..e25b255683 100755
--- a/t/t3001-ls-files-others-exclude.sh
+++ b/t/t3001-ls-files-others-exclude.sh
@@ -86,7 +86,7 @@ EOF
git config core.excludesFile excludes-file
-git runstatus | grep "^# " > output
+git status | grep "^# " > output
cat > expect << EOF
# .gitignore
diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh
index 2fe50bc7ce..a32692417d 100755
--- a/t/t4001-diff-rename.sh
+++ b/t/t4001-diff-rename.sh
@@ -71,10 +71,10 @@ test_expect_success 'favour same basenames over different ones' '
git rm path1 &&
mkdir subdir &&
git mv another-path subdir/path1 &&
- git runstatus | grep "renamed: .*path1 -> subdir/path1"'
+ git status | grep "renamed: .*path1 -> subdir/path1"'
test_expect_success 'favour same basenames even with minor differences' '
git show HEAD:path1 | sed "s/15/16/" > subdir/path1 &&
- git runstatus | grep "renamed: .*path1 -> subdir/path1"'
+ git status | grep "renamed: .*path1 -> subdir/path1"'
test_done
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index cf389b81da..baed6ce96b 100755
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
@@ -122,7 +122,20 @@ test_expect_success 'using alternate GIT_INDEX_FILE (2)' '
) &&
cmp .git/index saved-index >/dev/null
+'
+
+cat > expect << EOF
+zort
+
+Signed-off-by: C O Mitter <committer@example.com>
+EOF
+test_expect_success '--signoff' '
+ echo "yet another content *narf*" >> foo &&
+ echo "zort" |
+ GIT_EDITOR=../t7500/add-content git commit -s -F - foo &&
+ git cat-file commit HEAD | sed "1,/^$/d" > output &&
+ diff expect output
'
test_done
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index 0316ecf5a1..19c4b2c556 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -244,8 +244,35 @@ test_expect_success 'multiple -m' '
'
+author="The Real Author <someguy@his.email.org>"
+test_expect_success 'amend commit to fix author' '
+
+ oldtick=$GIT_AUTHOR_DATE &&
+ test_tick &&
+ git reset --hard &&
+ git cat-file -p HEAD |
+ sed -e "s/author.*/author $author $oldtick/" \
+ -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \
+ expected &&
+ git commit --amend --author="$author" &&
+ git cat-file -p HEAD > current &&
+ diff expected current
+
+'
+
+test_expect_success 'git commit <file> with dirty index' '
+ echo tacocat > elif &&
+ echo tehlulz > chz &&
+ git add chz &&
+ git commit elif -m "tacocat is a palindrome" &&
+ git show --stat | grep elif &&
+ git diff --cached | grep chz
+'
+
test_expect_success 'same tree (single parent)' '
+ git reset --hard
+
if git commit -m empty
then
echo oops -- should have complained
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
new file mode 100755
index 0000000000..21ac785e3d
--- /dev/null
+++ b/t/t7502-commit.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+test_description='git commit porcelain-ish'
+
+. ./test-lib.sh
+
+test_expect_success 'the basics' '
+
+ echo doing partial >"commit is" &&
+ mkdir not &&
+ echo very much encouraged but we should >not/forbid &&
+ git add "commit is" not &&
+ echo update added "commit is" file >"commit is" &&
+ echo also update another >not/forbid &&
+ test_tick &&
+ git commit -a -m "initial with -a" &&
+
+ git cat-file blob HEAD:"commit is" >current.1 &&
+ git cat-file blob HEAD:not/forbid >current.2 &&
+
+ cmp current.1 "commit is" &&
+ cmp current.2 not/forbid
+
+'
+
+test_expect_success 'partial' '
+
+ echo another >"commit is" &&
+ echo another >not/forbid &&
+ test_tick &&
+ git commit -m "partial commit to handle a file" "commit is" &&
+
+ changed=$(git diff-tree --name-only HEAD^ HEAD) &&
+ test "$changed" = "commit is"
+
+'
+
+test_expect_success 'partial modification in a subdirecotry' '
+
+ test_tick &&
+ git commit -m "partial commit to subdirectory" not &&
+
+ changed=$(git diff-tree -r --name-only HEAD^ HEAD) &&
+ test "$changed" = "not/forbid"
+
+'
+
+test_expect_success 'partial removal' '
+
+ git rm not/forbid &&
+ git commit -m "partial commit to remove not/forbid" not &&
+
+ changed=$(git diff-tree -r --name-only HEAD^ HEAD) &&
+ test "$changed" = "not/forbid" &&
+ remain=$(git ls-tree -r --name-only HEAD) &&
+ test "$remain" = "commit is"
+
+'
+
+test_expect_success 'sign off' '
+
+ >positive &&
+ git add positive &&
+ git commit -s -m "thank you" &&
+ actual=$(git cat-file commit HEAD | sed -ne "s/Signed-off-by: //p") &&
+ expected=$(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/") &&
+ test "z$actual" = "z$expected"
+
+'
+
+test_expect_success 'multiple -m' '
+
+ >negative &&
+ git add negative &&
+ git commit -m "one" -m "two" -m "three" &&
+ actual=$(git cat-file commit HEAD | sed -e "1,/^\$/d") &&
+ expected=$(echo one; echo; echo two; echo; echo three) &&
+ test "z$actual" = "z$expected"
+
+'
+
+test_expect_success 'verbose' '
+
+ echo minus >negative &&
+ git add negative &&
+ git status -v | sed -ne "/^diff --git /p" >actual &&
+ echo "diff --git a/negative b/negative" >expect &&
+ diff -u expect actual
+
+'
+
+test_done
diff --git a/t/t7502-status.sh b/t/t7502-status.sh
new file mode 100755
index 0000000000..d6ae69d46e
--- /dev/null
+++ b/t/t7502-status.sh
@@ -0,0 +1,91 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Johannes E. Schindelin
+#
+
+test_description='git-status'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ : > tracked &&
+ : > modified &&
+ mkdir dir1 &&
+ : > dir1/tracked &&
+ : > dir1/modified &&
+ mkdir dir2 &&
+ : > dir1/tracked &&
+ : > dir1/modified &&
+ git add . &&
+ test_tick &&
+ git commit -m initial &&
+ : > untracked &&
+ : > dir1/untracked &&
+ : > dir2/untracked &&
+ echo 1 > dir1/modified &&
+ echo 2 > dir2/modified &&
+ echo 3 > dir2/added &&
+ git add dir2/added
+'
+
+cat > expect << \EOF
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD <file>..." to unstage)
+#
+# new file: dir2/added
+#
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: dir1/modified
+#
+# Untracked files:
+# (use "git add <file>..." to include in what will be committed)
+#
+# dir1/untracked
+# dir2/modified
+# dir2/untracked
+# expect
+# output
+# untracked
+EOF
+
+test_expect_success 'status' '
+
+ git status > output &&
+ git diff expect output
+
+'
+
+cat > expect << \EOF
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD <file>..." to unstage)
+#
+# new file: ../dir2/added
+#
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: modified
+#
+# Untracked files:
+# (use "git add <file>..." to include in what will be committed)
+#
+# untracked
+# ../dir2/modified
+# ../dir2/untracked
+# ../expect
+# ../output
+# ../untracked
+EOF
+
+test_expect_success 'status with relative paths' '
+
+ (cd dir1 && git status) > output &&
+ git diff expect output
+
+'
+
+test_done