2007-11-11 18:35:41 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2007 Johannes E. Schindelin
|
|
|
|
#
|
|
|
|
|
2008-09-03 10:59:33 +02:00
|
|
|
test_description='git status'
|
2007-11-11 18:35:41 +01:00
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
2010-10-22 08:45:47 +02:00
|
|
|
test_expect_success 'status -h in broken repository' '
|
|
|
|
mkdir broken &&
|
|
|
|
test_when_finished "rm -fr broken" &&
|
|
|
|
(
|
|
|
|
cd broken &&
|
|
|
|
git init &&
|
|
|
|
echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
|
|
|
|
test_expect_code 129 git status -h >usage 2>&1
|
|
|
|
) &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ngrep "[Uu]sage" broken/usage
|
2010-10-22 08:45:47 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'commit -h in broken repository' '
|
|
|
|
mkdir broken &&
|
|
|
|
test_when_finished "rm -fr broken" &&
|
|
|
|
(
|
|
|
|
cd broken &&
|
|
|
|
git init &&
|
|
|
|
echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
|
|
|
|
test_expect_code 129 git commit -h >usage 2>&1
|
|
|
|
) &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ngrep "[Uu]sage" broken/usage
|
2010-10-22 08:45:47 +02:00
|
|
|
'
|
|
|
|
|
2007-11-11 18:35:41 +01:00
|
|
|
test_expect_success 'setup' '
|
2009-12-08 11:12:02 +01:00
|
|
|
: >tracked &&
|
|
|
|
: >modified &&
|
2007-11-11 18:35:41 +01:00
|
|
|
mkdir dir1 &&
|
2009-12-08 11:12:02 +01:00
|
|
|
: >dir1/tracked &&
|
|
|
|
: >dir1/modified &&
|
2007-11-11 18:35:41 +01:00
|
|
|
mkdir dir2 &&
|
2009-12-08 11:12:02 +01:00
|
|
|
: >dir1/tracked &&
|
|
|
|
: >dir1/modified &&
|
2007-11-11 18:35:41 +01:00
|
|
|
git add . &&
|
2008-02-12 06:45:18 +01:00
|
|
|
|
|
|
|
git status >output &&
|
|
|
|
|
2007-11-11 18:35:41 +01:00
|
|
|
test_tick &&
|
|
|
|
git commit -m initial &&
|
2009-12-08 11:12:02 +01:00
|
|
|
: >untracked &&
|
|
|
|
: >dir1/untracked &&
|
|
|
|
: >dir2/untracked &&
|
|
|
|
echo 1 >dir1/modified &&
|
|
|
|
echo 2 >dir2/modified &&
|
|
|
|
echo 3 >dir2/added &&
|
2007-11-11 18:35:41 +01:00
|
|
|
git add dir2/added
|
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status (1)' '
|
|
|
|
test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output
|
2008-02-12 06:45:18 +01:00
|
|
|
'
|
|
|
|
|
2012-04-13 12:54:39 +02:00
|
|
|
test_expect_success 'status --column' '
|
|
|
|
COLUMNS=50 git status --column="column dense" >output &&
|
|
|
|
cat >expect <<\EOF &&
|
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# new file: dir2/added
|
|
|
|
#
|
|
|
|
# Changes not staged for commit:
|
|
|
|
# (use "git add <file>..." to update what will be committed)
|
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
|
|
|
# dir1/untracked dir2/untracked untracked
|
|
|
|
# dir2/modified output
|
|
|
|
EOF
|
2012-08-27 07:36:51 +02:00
|
|
|
test_i18ncmp expect output
|
2012-04-13 12:54:39 +02:00
|
|
|
'
|
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
cat >expect <<\EOF
|
2007-11-11 18:35:41 +01:00
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# new file: dir2/added
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2007-11-11 18:35:41 +01:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
2008-09-08 00:05:03 +02:00
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
2007-11-11 18:35:41 +01:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status (2)' '
|
2009-12-08 11:12:02 +01:00
|
|
|
git status >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2007-11-11 18:35:41 +01:00
|
|
|
'
|
|
|
|
|
2010-04-22 22:30:19 +02:00
|
|
|
cat >expect <<\EOF
|
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# new file: dir2/added
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2010-04-22 22:30:19 +02:00
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
|
|
|
# Untracked files:
|
|
|
|
# dir1/untracked
|
|
|
|
# dir2/modified
|
|
|
|
# dir2/untracked
|
|
|
|
# expect
|
|
|
|
# output
|
|
|
|
# untracked
|
|
|
|
EOF
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status (advice.statusHints false)' '
|
|
|
|
test_when_finished "git config --unset advice.statusHints" &&
|
|
|
|
git config advice.statusHints false &&
|
2010-04-22 22:30:19 +02:00
|
|
|
git status >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2010-04-22 22:30:19 +02:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
cat >expect <<\EOF
|
2009-11-27 22:29:30 +01:00
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
?? dir1/untracked
|
|
|
|
?? dir2/modified
|
|
|
|
?? dir2/untracked
|
|
|
|
?? expect
|
|
|
|
?? output
|
|
|
|
?? untracked
|
|
|
|
EOF
|
|
|
|
|
2010-05-25 16:52:03 +02:00
|
|
|
test_expect_success 'status -s' '
|
2009-11-27 22:29:30 +01:00
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
git status -s >output &&
|
2009-11-27 22:29:30 +01:00
|
|
|
test_cmp expect output
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2011-06-02 18:07:11 +02:00
|
|
|
test_expect_success 'status with gitignore' '
|
|
|
|
{
|
|
|
|
echo ".gitignore" &&
|
|
|
|
echo "expect" &&
|
|
|
|
echo "output" &&
|
|
|
|
echo "untracked"
|
|
|
|
} >.gitignore &&
|
|
|
|
|
|
|
|
cat >expect <<-\EOF &&
|
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
?? dir2/modified
|
|
|
|
EOF
|
|
|
|
git status -s >output &&
|
|
|
|
test_cmp expect output &&
|
|
|
|
|
|
|
|
cat >expect <<-\EOF &&
|
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
?? dir2/modified
|
|
|
|
!! .gitignore
|
|
|
|
!! dir1/untracked
|
|
|
|
!! dir2/untracked
|
|
|
|
!! expect
|
|
|
|
!! output
|
|
|
|
!! untracked
|
|
|
|
EOF
|
|
|
|
git status -s --ignored >output &&
|
|
|
|
test_cmp expect output &&
|
|
|
|
|
|
|
|
cat >expect <<-\EOF &&
|
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# new file: dir2/added
|
|
|
|
#
|
2011-06-30 02:03:12 +02:00
|
|
|
# Changes not staged for commit:
|
2011-06-02 18:07:11 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
|
|
|
# dir2/modified
|
|
|
|
# Ignored files:
|
|
|
|
# (use "git add -f <file>..." to include in what will be committed)
|
|
|
|
#
|
|
|
|
# .gitignore
|
|
|
|
# dir1/untracked
|
|
|
|
# dir2/untracked
|
|
|
|
# expect
|
|
|
|
# output
|
|
|
|
# untracked
|
|
|
|
EOF
|
|
|
|
git status --ignored >output &&
|
2011-11-05 18:28:43 +01:00
|
|
|
test_i18ncmp expect output
|
2011-06-02 18:07:11 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'status with gitignore (nothing untracked)' '
|
|
|
|
{
|
|
|
|
echo ".gitignore" &&
|
|
|
|
echo "expect" &&
|
|
|
|
echo "dir2/modified" &&
|
|
|
|
echo "output" &&
|
|
|
|
echo "untracked"
|
|
|
|
} >.gitignore &&
|
|
|
|
|
|
|
|
cat >expect <<-\EOF &&
|
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
EOF
|
|
|
|
git status -s >output &&
|
|
|
|
test_cmp expect output &&
|
|
|
|
|
|
|
|
cat >expect <<-\EOF &&
|
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
!! .gitignore
|
|
|
|
!! dir1/untracked
|
|
|
|
!! dir2/modified
|
|
|
|
!! dir2/untracked
|
|
|
|
!! expect
|
|
|
|
!! output
|
|
|
|
!! untracked
|
|
|
|
EOF
|
|
|
|
git status -s --ignored >output &&
|
|
|
|
test_cmp expect output &&
|
|
|
|
|
|
|
|
cat >expect <<-\EOF &&
|
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# new file: dir2/added
|
|
|
|
#
|
2011-06-30 02:03:12 +02:00
|
|
|
# Changes not staged for commit:
|
2011-06-02 18:07:11 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
|
|
|
# Ignored files:
|
|
|
|
# (use "git add -f <file>..." to include in what will be committed)
|
|
|
|
#
|
|
|
|
# .gitignore
|
|
|
|
# dir1/untracked
|
|
|
|
# dir2/modified
|
|
|
|
# dir2/untracked
|
|
|
|
# expect
|
|
|
|
# output
|
|
|
|
# untracked
|
|
|
|
EOF
|
|
|
|
git status --ignored >output &&
|
2011-11-05 18:28:43 +01:00
|
|
|
test_i18ncmp expect output
|
2011-06-02 18:07:11 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
rm -f .gitignore
|
|
|
|
|
2010-05-25 16:52:03 +02:00
|
|
|
cat >expect <<\EOF
|
|
|
|
## master
|
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
?? dir1/untracked
|
|
|
|
?? dir2/modified
|
|
|
|
?? dir2/untracked
|
|
|
|
?? expect
|
|
|
|
?? output
|
|
|
|
?? untracked
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status -s -b' '
|
|
|
|
|
|
|
|
git status -s -b >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2012-05-07 23:02:18 +02:00
|
|
|
test_expect_success 'status -s -z -b' '
|
|
|
|
tr "\\n" Q <expect >expect.q &&
|
|
|
|
mv expect.q expect &&
|
|
|
|
git status -s -z -b >output &&
|
|
|
|
nul_to_q <output >output.q &&
|
|
|
|
mv output.q output &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
|
|
|
|
2011-02-23 00:42:13 +01:00
|
|
|
test_expect_success 'setup dir3' '
|
|
|
|
mkdir dir3 &&
|
|
|
|
: >dir3/untracked1 &&
|
|
|
|
: >dir3/untracked2
|
|
|
|
'
|
|
|
|
|
2008-06-05 14:22:56 +02:00
|
|
|
cat >expect <<EOF
|
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# new file: dir2/added
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2008-06-05 14:22:56 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
2008-09-08 00:05:03 +02:00
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
2008-06-05 14:22:56 +02:00
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
|
|
|
# Untracked files not listed (use -u option to show untracked files)
|
|
|
|
EOF
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status -uno' '
|
2008-06-05 14:22:56 +02:00
|
|
|
git status -uno >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2008-06-05 14:22:56 +02:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status (status.showUntrackedFiles no)' '
|
2008-06-05 14:47:50 +02:00
|
|
|
git config status.showuntrackedfiles no
|
2011-02-23 00:42:13 +01:00
|
|
|
test_when_finished "git config --unset status.showuntrackedfiles" &&
|
2008-06-05 14:47:50 +02:00
|
|
|
git status >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2008-06-05 14:47:50 +02:00
|
|
|
'
|
|
|
|
|
2010-04-22 22:30:19 +02:00
|
|
|
cat >expect <<EOF
|
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# new file: dir2/added
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2010-04-22 22:30:19 +02:00
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
2010-04-22 22:30:20 +02:00
|
|
|
# Untracked files not listed
|
2010-04-22 22:30:19 +02:00
|
|
|
EOF
|
|
|
|
git config advice.statusHints false
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status -uno (advice.statusHints false)' '
|
2010-04-22 22:30:19 +02:00
|
|
|
git status -uno >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2010-04-22 22:30:19 +02:00
|
|
|
'
|
|
|
|
git config --unset advice.statusHints
|
|
|
|
|
2009-11-27 22:29:30 +01:00
|
|
|
cat >expect << EOF
|
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
EOF
|
|
|
|
test_expect_success 'status -s -uno' '
|
|
|
|
git status -s -uno >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'status -s (status.showUntrackedFiles no)' '
|
|
|
|
git config status.showuntrackedfiles no
|
|
|
|
git status -s >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
|
|
|
|
2008-06-05 10:31:19 +02:00
|
|
|
cat >expect <<EOF
|
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# new file: dir2/added
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2008-06-05 10:31:19 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
2008-09-08 00:05:03 +02:00
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
2008-06-05 10:31:19 +02:00
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
|
|
|
# dir1/untracked
|
|
|
|
# dir2/modified
|
|
|
|
# dir2/untracked
|
|
|
|
# dir3/
|
|
|
|
# expect
|
|
|
|
# output
|
|
|
|
# untracked
|
|
|
|
EOF
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status -unormal' '
|
2008-06-05 10:31:19 +02:00
|
|
|
git status -unormal >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2008-06-05 10:31:19 +02:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status (status.showUntrackedFiles normal)' '
|
2008-06-05 14:47:50 +02:00
|
|
|
git config status.showuntrackedfiles normal
|
2011-02-23 00:42:13 +01:00
|
|
|
test_when_finished "git config --unset status.showuntrackedfiles" &&
|
2008-06-05 14:47:50 +02:00
|
|
|
git status >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2008-06-05 14:47:50 +02:00
|
|
|
'
|
|
|
|
|
2009-11-27 22:29:30 +01:00
|
|
|
cat >expect <<EOF
|
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
?? dir1/untracked
|
|
|
|
?? dir2/modified
|
|
|
|
?? dir2/untracked
|
|
|
|
?? dir3/
|
|
|
|
?? expect
|
|
|
|
?? output
|
|
|
|
?? untracked
|
|
|
|
EOF
|
|
|
|
test_expect_success 'status -s -unormal' '
|
|
|
|
git status -s -unormal >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'status -s (status.showUntrackedFiles normal)' '
|
|
|
|
git config status.showuntrackedfiles normal
|
|
|
|
git status -s >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
|
|
|
|
2008-06-05 10:31:19 +02:00
|
|
|
cat >expect <<EOF
|
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# new file: dir2/added
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2008-06-05 10:31:19 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
2008-09-08 00:05:03 +02:00
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
2008-06-05 10:31:19 +02:00
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
|
|
|
# dir1/untracked
|
|
|
|
# dir2/modified
|
|
|
|
# dir2/untracked
|
|
|
|
# dir3/untracked1
|
|
|
|
# dir3/untracked2
|
|
|
|
# expect
|
|
|
|
# output
|
|
|
|
# untracked
|
|
|
|
EOF
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status -uall' '
|
2008-06-05 10:31:19 +02:00
|
|
|
git status -uall >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2008-06-05 14:47:50 +02:00
|
|
|
'
|
2011-04-14 22:56:14 +02:00
|
|
|
|
|
|
|
test_expect_success 'status (status.showUntrackedFiles all)' '
|
2008-06-05 14:47:50 +02:00
|
|
|
git config status.showuntrackedfiles all
|
2011-02-23 00:42:13 +01:00
|
|
|
test_when_finished "git config --unset status.showuntrackedfiles" &&
|
2008-06-05 14:47:50 +02:00
|
|
|
git status >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2008-06-05 10:31:19 +02:00
|
|
|
'
|
|
|
|
|
2011-02-23 00:42:13 +01:00
|
|
|
test_expect_success 'teardown dir3' '
|
|
|
|
rm -rf dir3
|
|
|
|
'
|
|
|
|
|
2009-11-27 22:29:30 +01:00
|
|
|
cat >expect <<EOF
|
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
?? dir1/untracked
|
|
|
|
?? dir2/modified
|
|
|
|
?? dir2/untracked
|
|
|
|
?? expect
|
|
|
|
?? output
|
|
|
|
?? untracked
|
|
|
|
EOF
|
|
|
|
test_expect_success 'status -s -uall' '
|
|
|
|
git config --unset status.showuntrackedfiles
|
|
|
|
git status -s -uall >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
|
|
|
test_expect_success 'status -s (status.showUntrackedFiles all)' '
|
|
|
|
git config status.showuntrackedfiles all
|
|
|
|
git status -s >output &&
|
|
|
|
rm -rf dir3 &&
|
|
|
|
git config --unset status.showuntrackedfiles &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
cat >expect <<\EOF
|
2007-11-11 18:35:41 +01:00
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# new file: ../dir2/added
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2007-11-11 18:35:41 +01:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
2008-09-08 00:05:03 +02:00
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
2007-11-11 18:35:41 +01:00
|
|
|
#
|
2007-12-03 06:30:01 +01:00
|
|
|
# modified: modified
|
2007-11-11 18:35:41 +01:00
|
|
|
#
|
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
|
|
|
# untracked
|
|
|
|
# ../dir2/modified
|
|
|
|
# ../dir2/untracked
|
|
|
|
# ../expect
|
|
|
|
# ../output
|
|
|
|
# ../untracked
|
|
|
|
EOF
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status with relative paths' '
|
2009-12-08 11:12:02 +01:00
|
|
|
(cd dir1 && git status) >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2007-11-11 18:35:41 +01:00
|
|
|
'
|
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
cat >expect <<\EOF
|
2009-11-27 22:29:30 +01:00
|
|
|
M modified
|
|
|
|
A ../dir2/added
|
|
|
|
?? untracked
|
|
|
|
?? ../dir2/modified
|
|
|
|
?? ../dir2/untracked
|
|
|
|
?? ../expect
|
|
|
|
?? ../output
|
|
|
|
?? ../untracked
|
|
|
|
EOF
|
|
|
|
test_expect_success 'status -s with relative paths' '
|
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
(cd dir1 && git status -s) >output &&
|
2009-11-27 22:29:30 +01:00
|
|
|
test_cmp expect output
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
cat >expect <<\EOF
|
2009-12-08 11:12:01 +01:00
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
?? dir1/untracked
|
|
|
|
?? dir2/modified
|
|
|
|
?? dir2/untracked
|
|
|
|
?? expect
|
|
|
|
?? output
|
|
|
|
?? untracked
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status --porcelain ignores relative paths setting' '
|
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
(cd dir1 && git status --porcelain) >output &&
|
2009-12-08 11:12:01 +01:00
|
|
|
test_cmp expect output
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
test_expect_success 'setup unique colors' '
|
|
|
|
|
2010-11-18 00:40:05 +01:00
|
|
|
git config status.color.untracked blue &&
|
|
|
|
git config status.color.branch green
|
2009-12-08 11:12:02 +01:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
cat >expect <<\EOF
|
2010-11-18 00:40:05 +01:00
|
|
|
# On branch <GREEN>master<RESET>
|
2009-12-08 11:12:02 +01:00
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# <GREEN>new file: dir2/added<RESET>
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2009-12-08 11:12:02 +01:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
|
|
|
#
|
|
|
|
# <RED>modified: dir1/modified<RESET>
|
|
|
|
#
|
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
|
|
|
# <BLUE>dir1/untracked<RESET>
|
|
|
|
# <BLUE>dir2/modified<RESET>
|
|
|
|
# <BLUE>dir2/untracked<RESET>
|
|
|
|
# <BLUE>expect<RESET>
|
|
|
|
# <BLUE>output<RESET>
|
|
|
|
# <BLUE>untracked<RESET>
|
|
|
|
EOF
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status with color.ui' '
|
2009-12-08 11:12:02 +01:00
|
|
|
git config color.ui always &&
|
2011-02-23 00:42:13 +01:00
|
|
|
test_when_finished "git config --unset color.ui" &&
|
2009-12-08 11:12:02 +01:00
|
|
|
git status | test_decode_color >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2009-12-08 11:12:02 +01:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status with color.status' '
|
2009-12-08 11:12:02 +01:00
|
|
|
git config color.status always &&
|
2011-02-23 00:42:13 +01:00
|
|
|
test_when_finished "git config --unset color.status" &&
|
2009-12-08 11:12:02 +01:00
|
|
|
git status | test_decode_color >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2009-12-08 11:12:02 +01:00
|
|
|
'
|
|
|
|
|
|
|
|
cat >expect <<\EOF
|
|
|
|
<RED>M<RESET> dir1/modified
|
|
|
|
<GREEN>A<RESET> dir2/added
|
|
|
|
<BLUE>??<RESET> dir1/untracked
|
|
|
|
<BLUE>??<RESET> dir2/modified
|
|
|
|
<BLUE>??<RESET> dir2/untracked
|
|
|
|
<BLUE>??<RESET> expect
|
|
|
|
<BLUE>??<RESET> output
|
|
|
|
<BLUE>??<RESET> untracked
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status -s with color.ui' '
|
|
|
|
|
|
|
|
git config color.ui always &&
|
|
|
|
git status -s | test_decode_color >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'status -s with color.status' '
|
|
|
|
|
|
|
|
git config --unset color.ui &&
|
|
|
|
git config color.status always &&
|
|
|
|
git status -s | test_decode_color >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2010-05-25 16:52:03 +02:00
|
|
|
cat >expect <<\EOF
|
|
|
|
## <GREEN>master<RESET>
|
|
|
|
<RED>M<RESET> dir1/modified
|
|
|
|
<GREEN>A<RESET> dir2/added
|
|
|
|
<BLUE>??<RESET> dir1/untracked
|
|
|
|
<BLUE>??<RESET> dir2/modified
|
|
|
|
<BLUE>??<RESET> dir2/untracked
|
|
|
|
<BLUE>??<RESET> expect
|
|
|
|
<BLUE>??<RESET> output
|
|
|
|
<BLUE>??<RESET> untracked
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status -s -b with color.status' '
|
|
|
|
|
|
|
|
git status -s -b | test_decode_color >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
cat >expect <<\EOF
|
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
?? dir1/untracked
|
|
|
|
?? dir2/modified
|
|
|
|
?? dir2/untracked
|
|
|
|
?? expect
|
|
|
|
?? output
|
|
|
|
?? untracked
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status --porcelain ignores color.ui' '
|
|
|
|
|
|
|
|
git config --unset color.status &&
|
|
|
|
git config color.ui always &&
|
|
|
|
git status --porcelain | test_decode_color >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'status --porcelain ignores color.status' '
|
|
|
|
|
|
|
|
git config --unset color.ui &&
|
|
|
|
git config color.status always &&
|
|
|
|
git status --porcelain | test_decode_color >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
# recover unconditionally from color tests
|
|
|
|
git config --unset color.status
|
|
|
|
git config --unset color.ui
|
|
|
|
|
2012-05-07 23:09:04 +02:00
|
|
|
test_expect_success 'status --porcelain respects -b' '
|
2010-05-25 16:52:03 +02:00
|
|
|
|
|
|
|
git status --porcelain -b >output &&
|
2012-05-07 23:09:04 +02:00
|
|
|
{
|
|
|
|
echo "## master" &&
|
|
|
|
cat expect
|
|
|
|
} >tmp &&
|
|
|
|
mv tmp expect &&
|
2010-05-25 16:52:03 +02:00
|
|
|
test_cmp expect output
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
cat >expect <<\EOF
|
2007-12-07 22:26:07 +01:00
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# new file: dir2/added
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2007-12-07 22:26:07 +01:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
2008-09-08 00:05:03 +02:00
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
2007-12-07 22:26:07 +01:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status without relative paths' '
|
2007-12-07 22:26:07 +01:00
|
|
|
|
2011-02-23 00:42:13 +01:00
|
|
|
git config status.relativePaths false &&
|
|
|
|
test_when_finished "git config --unset status.relativePaths" &&
|
2009-12-08 11:12:02 +01:00
|
|
|
(cd dir1 && git status) >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2007-12-07 22:26:07 +01:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2009-12-08 11:12:02 +01:00
|
|
|
cat >expect <<\EOF
|
2009-11-27 22:29:30 +01:00
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
?? dir1/untracked
|
|
|
|
?? dir2/modified
|
|
|
|
?? dir2/untracked
|
|
|
|
?? expect
|
|
|
|
?? output
|
|
|
|
?? untracked
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'status -s without relative paths' '
|
|
|
|
|
2011-02-23 00:42:13 +01:00
|
|
|
git config status.relativePaths false &&
|
|
|
|
test_when_finished "git config --unset status.relativePaths" &&
|
2009-12-08 11:12:02 +01:00
|
|
|
(cd dir1 && git status -s) >output &&
|
2009-11-27 22:29:30 +01:00
|
|
|
test_cmp expect output
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2008-02-14 18:18:23 +01:00
|
|
|
cat <<EOF >expect
|
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
|
|
|
# dir1/untracked
|
|
|
|
# dir2/
|
|
|
|
# expect
|
|
|
|
# output
|
|
|
|
# untracked
|
|
|
|
EOF
|
2009-08-15 11:27:39 +02:00
|
|
|
test_expect_success 'dry-run of partial commit excluding new file in index' '
|
2011-04-14 22:56:14 +02:00
|
|
|
git commit --dry-run dir1/modified >output &&
|
|
|
|
test_i18ncmp expect output
|
2008-02-14 18:18:23 +01:00
|
|
|
'
|
|
|
|
|
2010-04-02 14:27:20 +02:00
|
|
|
cat >expect <<EOF
|
|
|
|
:100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
|
|
|
|
EOF
|
2010-04-02 23:44:21 +02:00
|
|
|
test_expect_success 'status refreshes the index' '
|
2010-04-02 14:27:20 +02:00
|
|
|
touch dir2/added &&
|
|
|
|
git status &&
|
|
|
|
git diff-files >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
|
|
|
|
2008-04-12 17:05:33 +02:00
|
|
|
test_expect_success 'setup status submodule summary' '
|
|
|
|
test_create_repo sm && (
|
|
|
|
cd sm &&
|
|
|
|
>foo &&
|
|
|
|
git add foo &&
|
|
|
|
git commit -m "Add foo"
|
|
|
|
) &&
|
|
|
|
git add sm
|
|
|
|
'
|
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# new file: dir2/added
|
|
|
|
# new file: sm
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2008-04-12 17:05:33 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
2008-09-08 00:05:03 +02:00
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
2008-04-12 17:05:33 +02:00
|
|
|
#
|
|
|
|
# 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
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status submodule summary is disabled by default' '
|
2008-04-12 17:05:33 +02:00
|
|
|
git status >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2008-04-12 17:05:33 +02:00
|
|
|
'
|
|
|
|
|
2008-10-16 17:07:26 +02:00
|
|
|
# we expect the same as the previous test
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status --untracked-files=all does not show submodule' '
|
2008-10-16 17:07:26 +02:00
|
|
|
git status --untracked-files=all >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2008-04-12 17:05:33 +02:00
|
|
|
'
|
|
|
|
|
2009-11-27 22:29:30 +01:00
|
|
|
cat >expect <<EOF
|
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
A sm
|
|
|
|
?? dir1/untracked
|
|
|
|
?? dir2/modified
|
|
|
|
?? dir2/untracked
|
|
|
|
?? expect
|
|
|
|
?? output
|
|
|
|
?? untracked
|
|
|
|
EOF
|
|
|
|
test_expect_success 'status -s submodule summary is disabled by default' '
|
|
|
|
git status -s >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
|
|
|
|
|
|
|
# we expect the same as the previous test
|
|
|
|
test_expect_success 'status -s --untracked-files=all does not show submodule' '
|
|
|
|
git status -s --untracked-files=all >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
|
|
|
|
2008-04-12 17:05:33 +02:00
|
|
|
head=$(cd sm && git rev-parse --short=7 --verify HEAD)
|
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# new file: dir2/added
|
|
|
|
# new file: sm
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2008-04-12 17:05:33 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
2008-09-08 00:05:03 +02:00
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
2008-04-12 17:05:33 +02:00
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
2010-01-17 20:42:31 +01:00
|
|
|
# Submodule changes to be committed:
|
2008-04-12 17:05:33 +02:00
|
|
|
#
|
|
|
|
# * sm 0000000...$head (1):
|
|
|
|
# > Add foo
|
|
|
|
#
|
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
|
|
|
# dir1/untracked
|
|
|
|
# dir2/modified
|
|
|
|
# dir2/untracked
|
|
|
|
# expect
|
|
|
|
# output
|
|
|
|
# untracked
|
|
|
|
EOF
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'status submodule summary' '
|
2008-04-12 17:05:33 +02:00
|
|
|
git config status.submodulesummary 10 &&
|
|
|
|
git status >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2008-04-12 17:05:33 +02:00
|
|
|
'
|
|
|
|
|
2009-11-27 22:29:30 +01:00
|
|
|
cat >expect <<EOF
|
|
|
|
M dir1/modified
|
|
|
|
A dir2/added
|
|
|
|
A sm
|
|
|
|
?? dir1/untracked
|
|
|
|
?? dir2/modified
|
|
|
|
?? dir2/untracked
|
|
|
|
?? expect
|
|
|
|
?? output
|
|
|
|
?? untracked
|
|
|
|
EOF
|
|
|
|
test_expect_success 'status -s submodule summary' '
|
|
|
|
git status -s >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
2008-04-12 17:05:33 +02:00
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
# On branch master
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2008-04-12 17:05:33 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
2008-09-08 00:05:03 +02:00
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
2008-04-12 17:05:33 +02:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
no changes added to commit (use "git add" and/or "git commit -a")
|
|
|
|
EOF
|
2011-02-23 00:42:13 +01:00
|
|
|
test_expect_success 'status submodule summary (clean submodule): commit' '
|
2011-04-14 22:56:14 +02:00
|
|
|
git commit -m "commit submodule" &&
|
2008-04-12 17:05:33 +02:00
|
|
|
git config status.submodulesummary 10 &&
|
2009-08-15 11:27:39 +02:00
|
|
|
test_must_fail git commit --dry-run >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output &&
|
2009-08-15 11:27:39 +02:00
|
|
|
git status >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2008-04-12 17:05:33 +02:00
|
|
|
'
|
|
|
|
|
2009-11-27 22:29:30 +01:00
|
|
|
cat >expect <<EOF
|
|
|
|
M dir1/modified
|
|
|
|
?? dir1/untracked
|
|
|
|
?? dir2/modified
|
|
|
|
?? dir2/untracked
|
|
|
|
?? expect
|
|
|
|
?? output
|
|
|
|
?? untracked
|
|
|
|
EOF
|
|
|
|
test_expect_success 'status -s submodule summary (clean submodule)' '
|
|
|
|
git status -s >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
|
|
|
|
2011-05-26 22:43:21 +02:00
|
|
|
test_expect_success 'status -z implies porcelain' '
|
2011-05-26 22:43:20 +02:00
|
|
|
git status --porcelain |
|
2012-06-12 18:49:59 +02:00
|
|
|
"$PERL_PATH" -pe "s/\012/\000/g" >expect &&
|
2011-05-26 22:43:20 +02:00
|
|
|
git status -z >output &&
|
|
|
|
test_cmp expect output
|
|
|
|
'
|
|
|
|
|
2008-04-12 17:05:33 +02:00
|
|
|
cat >expect <<EOF
|
|
|
|
# On branch master
|
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD^1 <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# new file: dir2/added
|
|
|
|
# new file: sm
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2008-04-12 17:05:33 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
2008-09-08 00:05:03 +02:00
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
2008-04-12 17:05:33 +02:00
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
2010-01-17 20:42:31 +01:00
|
|
|
# Submodule changes to be committed:
|
2008-04-12 17:05:33 +02:00
|
|
|
#
|
|
|
|
# * sm 0000000...$head (1):
|
|
|
|
# > Add foo
|
|
|
|
#
|
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
|
|
|
# dir1/untracked
|
|
|
|
# dir2/modified
|
|
|
|
# dir2/untracked
|
|
|
|
# expect
|
|
|
|
# output
|
|
|
|
# untracked
|
|
|
|
EOF
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success 'commit --dry-run submodule summary (--amend)' '
|
2008-04-12 17:05:33 +02:00
|
|
|
git config status.submodulesummary 10 &&
|
2009-08-15 11:27:39 +02:00
|
|
|
git commit --dry-run --amend >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2008-04-12 17:05:33 +02:00
|
|
|
'
|
|
|
|
|
2010-08-07 00:09:09 +02:00
|
|
|
test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
|
2010-04-03 12:11:57 +02:00
|
|
|
(
|
|
|
|
chmod a-w .git &&
|
|
|
|
# make dir1/tracked stat-dirty
|
|
|
|
>dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
|
|
|
|
git status -s >output &&
|
|
|
|
! grep dir1/tracked output &&
|
|
|
|
# make sure "status" succeeded without writing index out
|
|
|
|
git diff-files | grep dir1/tracked
|
|
|
|
)
|
|
|
|
status=$?
|
|
|
|
chmod 775 .git
|
|
|
|
(exit $status)
|
|
|
|
'
|
|
|
|
|
2010-09-06 20:41:06 +02:00
|
|
|
(cd sm && echo > bar && git add bar && git commit -q -m 'Add bar') && git add sm
|
2010-08-06 00:39:25 +02:00
|
|
|
new_head=$(cd sm && git rev-parse --short=7 --verify HEAD)
|
|
|
|
touch .gitmodules
|
|
|
|
|
2010-06-25 16:56:47 +02:00
|
|
|
cat > expect << EOF
|
|
|
|
# On branch master
|
2010-08-06 00:39:25 +02:00
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# modified: sm
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2010-06-25 16:56:47 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
2010-08-06 00:39:25 +02:00
|
|
|
# Submodule changes to be committed:
|
|
|
|
#
|
|
|
|
# * sm $head...$new_head (1):
|
|
|
|
# > Add bar
|
|
|
|
#
|
2010-06-25 16:56:47 +02:00
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
2010-08-06 00:39:25 +02:00
|
|
|
# .gitmodules
|
2010-06-25 16:56:47 +02:00
|
|
|
# dir1/untracked
|
|
|
|
# dir2/modified
|
|
|
|
# dir2/untracked
|
|
|
|
# expect
|
|
|
|
# output
|
|
|
|
# untracked
|
|
|
|
EOF
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
|
|
|
|
echo modified sm/untracked &&
|
|
|
|
git status --ignore-submodules=untracked >output &&
|
|
|
|
test_i18ncmp expect output
|
2010-06-25 16:56:47 +02:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
|
2010-08-06 01:27:15 +02:00
|
|
|
git config diff.ignoreSubmodules dirty &&
|
|
|
|
git status >output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore untracked &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2011-04-14 22:56:14 +02:00
|
|
|
git status >output &&
|
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 01:27:15 +02:00
|
|
|
git config -f .gitmodules --remove-section submodule.subname &&
|
|
|
|
git config --unset diff.ignoreSubmodules
|
2010-08-06 00:40:48 +02:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore none &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2010-08-06 00:39:25 +02:00
|
|
|
git config --add submodule.subname.ignore untracked &&
|
|
|
|
git config --add submodule.subname.path sm &&
|
2011-04-14 22:56:14 +02:00
|
|
|
git status >output &&
|
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --remove-section submodule.subname &&
|
|
|
|
git config --remove-section -f .gitmodules submodule.subname
|
2010-08-06 00:39:25 +02:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
|
|
|
|
git status --ignore-submodules=dirty >output &&
|
|
|
|
test_i18ncmp expect output
|
2010-06-25 16:56:47 +02:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
|
2010-08-06 01:27:15 +02:00
|
|
|
git config diff.ignoreSubmodules dirty &&
|
|
|
|
git status >output &&
|
|
|
|
! test -s actual &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore dirty &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2011-04-14 22:56:14 +02:00
|
|
|
git status >output &&
|
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 01:27:15 +02:00
|
|
|
git config -f .gitmodules --remove-section submodule.subname &&
|
|
|
|
git config --unset diff.ignoreSubmodules
|
2010-08-06 00:40:48 +02:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore none &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2010-08-06 00:39:25 +02:00
|
|
|
git config --add submodule.subname.ignore dirty &&
|
|
|
|
git config --add submodule.subname.path sm &&
|
2011-04-14 22:56:14 +02:00
|
|
|
git status >output &&
|
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --remove-section submodule.subname &&
|
|
|
|
git config -f .gitmodules --remove-section submodule.subname
|
2010-08-06 00:39:25 +02:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
|
|
|
|
echo modified >sm/foo &&
|
|
|
|
git status --ignore-submodules=dirty >output &&
|
|
|
|
test_i18ncmp expect output
|
2010-06-25 16:56:47 +02:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore dirty &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2011-04-14 22:56:14 +02:00
|
|
|
git status >output &&
|
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config -f .gitmodules --remove-section submodule.subname
|
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore none &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2010-08-06 00:39:25 +02:00
|
|
|
git config --add submodule.subname.ignore dirty &&
|
|
|
|
git config --add submodule.subname.path sm &&
|
2011-04-14 22:56:14 +02:00
|
|
|
git status >output &&
|
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --remove-section submodule.subname &&
|
|
|
|
git config -f .gitmodules --remove-section submodule.subname
|
2010-08-06 00:39:25 +02:00
|
|
|
'
|
|
|
|
|
2010-06-25 16:56:47 +02:00
|
|
|
cat > expect << EOF
|
|
|
|
# On branch master
|
2010-08-06 00:39:25 +02:00
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# modified: sm
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2010-06-25 16:56:47 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
|
|
|
# (commit or discard the untracked or modified content in submodules)
|
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
# modified: sm (modified content)
|
|
|
|
#
|
2010-08-06 00:39:25 +02:00
|
|
|
# Submodule changes to be committed:
|
|
|
|
#
|
|
|
|
# * sm $head...$new_head (1):
|
|
|
|
# > Add bar
|
|
|
|
#
|
2010-06-25 16:56:47 +02:00
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
2010-08-06 00:39:25 +02:00
|
|
|
# .gitmodules
|
2010-06-25 16:56:47 +02:00
|
|
|
# dir1/untracked
|
|
|
|
# dir2/modified
|
|
|
|
# dir2/untracked
|
|
|
|
# expect
|
|
|
|
# output
|
|
|
|
# untracked
|
|
|
|
EOF
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
|
2010-06-25 16:56:47 +02:00
|
|
|
git status --ignore-submodules=untracked > output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2010-06-25 16:56:47 +02:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore untracked &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2011-04-14 22:56:14 +02:00
|
|
|
git status >output &&
|
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config -f .gitmodules --remove-section submodule.subname
|
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore none &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2010-08-06 00:39:25 +02:00
|
|
|
git config --add submodule.subname.ignore untracked &&
|
|
|
|
git config --add submodule.subname.path sm &&
|
2011-04-14 22:56:14 +02:00
|
|
|
git status >output &&
|
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --remove-section submodule.subname &&
|
|
|
|
git config -f .gitmodules --remove-section submodule.subname
|
2010-08-06 00:39:25 +02:00
|
|
|
'
|
|
|
|
|
2010-06-25 16:56:47 +02:00
|
|
|
head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
|
|
|
|
|
|
|
|
cat > expect << EOF
|
|
|
|
# On branch master
|
2010-08-06 00:39:25 +02:00
|
|
|
# Changes to be committed:
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
#
|
|
|
|
# modified: sm
|
|
|
|
#
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2010-06-25 16:56:47 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
# modified: sm (new commits)
|
|
|
|
#
|
2010-08-06 00:39:25 +02:00
|
|
|
# Submodule changes to be committed:
|
|
|
|
#
|
|
|
|
# * sm $head...$new_head (1):
|
|
|
|
# > Add bar
|
|
|
|
#
|
2010-06-25 16:56:47 +02:00
|
|
|
# Submodules changed but not updated:
|
|
|
|
#
|
2010-08-06 00:39:25 +02:00
|
|
|
# * sm $new_head...$head2 (1):
|
2010-06-25 16:56:47 +02:00
|
|
|
# > 2nd commit
|
|
|
|
#
|
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
2010-08-06 00:39:25 +02:00
|
|
|
# .gitmodules
|
2010-06-25 16:56:47 +02:00
|
|
|
# dir1/untracked
|
|
|
|
# dir2/modified
|
|
|
|
# dir2/untracked
|
|
|
|
# expect
|
|
|
|
# output
|
|
|
|
# untracked
|
|
|
|
EOF
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
|
2010-06-25 16:56:47 +02:00
|
|
|
git status --ignore-submodules=untracked > output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2010-06-25 16:56:47 +02:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore untracked &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2011-04-14 22:56:14 +02:00
|
|
|
git status >output &&
|
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config -f .gitmodules --remove-section submodule.subname
|
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore none &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2010-08-06 00:39:25 +02:00
|
|
|
git config --add submodule.subname.ignore untracked &&
|
|
|
|
git config --add submodule.subname.path sm &&
|
2011-04-14 22:56:14 +02:00
|
|
|
git status >output &&
|
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --remove-section submodule.subname &&
|
|
|
|
git config -f .gitmodules --remove-section submodule.subname
|
2010-08-06 00:39:25 +02:00
|
|
|
'
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
|
2010-06-25 16:56:47 +02:00
|
|
|
git status --ignore-submodules=dirty > output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2010-06-25 16:56:47 +02:00
|
|
|
'
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore dirty &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2011-04-14 22:56:14 +02:00
|
|
|
git status >output &&
|
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config -f .gitmodules --remove-section submodule.subname
|
|
|
|
'
|
2010-06-25 16:56:47 +02:00
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore none &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2010-08-06 00:39:25 +02:00
|
|
|
git config --add submodule.subname.ignore dirty &&
|
|
|
|
git config --add submodule.subname.path sm &&
|
2011-04-14 22:56:14 +02:00
|
|
|
git status >output &&
|
|
|
|
test_i18ncmp expect output &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --remove-section submodule.subname &&
|
|
|
|
git config -f .gitmodules --remove-section submodule.subname
|
2010-08-06 00:39:25 +02:00
|
|
|
'
|
|
|
|
|
2010-06-25 16:56:47 +02:00
|
|
|
cat > expect << EOF
|
|
|
|
# On branch master
|
2010-11-02 16:31:19 +01:00
|
|
|
# Changes not staged for commit:
|
2010-06-25 16:56:47 +02:00
|
|
|
# (use "git add <file>..." to update what will be committed)
|
|
|
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
|
|
|
#
|
|
|
|
# modified: dir1/modified
|
|
|
|
#
|
|
|
|
# Untracked files:
|
|
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
|
|
#
|
2010-08-06 00:39:25 +02:00
|
|
|
# .gitmodules
|
2010-06-25 16:56:47 +02:00
|
|
|
# dir1/untracked
|
|
|
|
# dir2/modified
|
|
|
|
# dir2/untracked
|
|
|
|
# expect
|
|
|
|
# output
|
|
|
|
# untracked
|
|
|
|
no changes added to commit (use "git add" and/or "git commit -a")
|
|
|
|
EOF
|
|
|
|
|
2011-04-14 22:56:14 +02:00
|
|
|
test_expect_success "--ignore-submodules=all suppresses submodule summary" '
|
2010-06-25 16:56:47 +02:00
|
|
|
git status --ignore-submodules=all > output &&
|
2011-04-14 22:56:14 +02:00
|
|
|
test_i18ncmp expect output
|
2010-06-25 16:56:47 +02:00
|
|
|
'
|
|
|
|
|
2010-08-06 00:40:48 +02:00
|
|
|
test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '
|
|
|
|
git config --add -f .gitmodules submodule.subname.ignore all &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
|
|
|
git status > output &&
|
|
|
|
test_cmp expect output &&
|
|
|
|
git config -f .gitmodules --remove-section submodule.subname
|
|
|
|
'
|
|
|
|
|
2010-08-06 00:39:25 +02:00
|
|
|
test_expect_failure '.git/config ignore=all suppresses submodule summary' '
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --add -f .gitmodules submodule.subname.ignore none &&
|
|
|
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
2010-08-06 00:39:25 +02:00
|
|
|
git config --add submodule.subname.ignore all &&
|
|
|
|
git config --add submodule.subname.path sm &&
|
|
|
|
git status > output &&
|
|
|
|
test_cmp expect output &&
|
2010-08-06 00:40:48 +02:00
|
|
|
git config --remove-section submodule.subname &&
|
|
|
|
git config -f .gitmodules --remove-section submodule.subname
|
2010-08-06 00:39:25 +02:00
|
|
|
'
|
|
|
|
|
2007-11-11 18:35:41 +01:00
|
|
|
test_done
|