|
|
|
@ -32,6 +32,17 @@ test_expect_success 'commit -h in broken repository' '
|
|
|
|
|
test_i18ngrep "[Uu]sage" broken/usage
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success 'create upstream branch' '
|
|
|
|
|
git checkout -b upstream &&
|
|
|
|
|
test_commit upstream1 &&
|
|
|
|
|
test_commit upstream2 &&
|
|
|
|
|
# leave the first commit on master as root because several
|
|
|
|
|
# tests depend on this case; for our upstream we only
|
|
|
|
|
# care about commit counts anyway, so a totally divergent
|
|
|
|
|
# history is OK
|
|
|
|
|
git checkout --orphan master
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success 'setup' '
|
|
|
|
|
: >tracked &&
|
|
|
|
|
: >modified &&
|
|
|
|
@ -53,7 +64,9 @@ test_expect_success 'setup' '
|
|
|
|
|
echo 1 >dir1/modified &&
|
|
|
|
|
echo 2 >dir2/modified &&
|
|
|
|
|
echo 3 >dir2/added &&
|
|
|
|
|
git add dir2/added
|
|
|
|
|
git add dir2/added &&
|
|
|
|
|
|
|
|
|
|
git branch --set-upstream-to=upstream
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success 'status (1)' '
|
|
|
|
@ -75,6 +88,10 @@ EOF
|
|
|
|
|
test_expect_success 'status --column' '
|
|
|
|
|
cat >expect <<\EOF &&
|
|
|
|
|
# On branch master
|
|
|
|
|
# Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
# and have 1 and 2 different commits each, respectively.
|
|
|
|
|
# (use "git pull" to merge the remote branch into yours)
|
|
|
|
|
#
|
|
|
|
|
# Changes to be committed:
|
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
#
|
|
|
|
@ -105,6 +122,10 @@ test_expect_success 'status --column status.displayCommentPrefix=false' '
|
|
|
|
|
|
|
|
|
|
cat >expect <<\EOF
|
|
|
|
|
# On branch master
|
|
|
|
|
# Your branch and 'upstream' have diverged,
|
|
|
|
|
# and have 1 and 2 different commits each, respectively.
|
|
|
|
|
# (use "git pull" to merge the remote branch into yours)
|
|
|
|
|
#
|
|
|
|
|
# Changes to be committed:
|
|
|
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
#
|
|
|
|
@ -178,6 +199,9 @@ test_expect_success 'commit ignores status.displayCommentPrefix=false in COMMIT_
|
|
|
|
|
|
|
|
|
|
cat >expect <<\EOF
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and 'upstream' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
new file: dir2/added
|
|
|
|
|
|
|
|
|
@ -248,6 +272,10 @@ test_expect_success 'status with gitignore' '
|
|
|
|
|
|
|
|
|
|
cat >expect <<\EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -313,6 +341,10 @@ test_expect_success 'status with gitignore (nothing untracked)' '
|
|
|
|
|
|
|
|
|
|
cat >expect <<\EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -348,7 +380,7 @@ output*
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
cat >expect <<\EOF
|
|
|
|
|
## master
|
|
|
|
|
## master...upstream [ahead 1, behind 2]
|
|
|
|
|
M dir1/modified
|
|
|
|
|
A dir2/added
|
|
|
|
|
?? dir1/untracked
|
|
|
|
@ -382,6 +414,10 @@ test_expect_success 'setup dir3' '
|
|
|
|
|
test_expect_success 'status -uno' '
|
|
|
|
|
cat >expect <<EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -408,6 +444,9 @@ test_expect_success 'status (status.showUntrackedFiles no)' '
|
|
|
|
|
test_expect_success 'status -uno (advice.statusHints false)' '
|
|
|
|
|
cat >expect <<EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
new file: dir2/added
|
|
|
|
|
|
|
|
|
@ -439,6 +478,10 @@ test_expect_success 'status -s (status.showUntrackedFiles no)' '
|
|
|
|
|
test_expect_success 'status -unormal' '
|
|
|
|
|
cat >expect <<EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -493,6 +536,10 @@ test_expect_success 'status -s (status.showUntrackedFiles normal)' '
|
|
|
|
|
test_expect_success 'status -uall' '
|
|
|
|
|
cat >expect <<EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -552,6 +599,10 @@ test_expect_success 'status -s (status.showUntrackedFiles all)' '
|
|
|
|
|
test_expect_success 'status with relative paths' '
|
|
|
|
|
cat >expect <<\EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -610,13 +661,19 @@ test_expect_success 'status --porcelain ignores relative paths setting' '
|
|
|
|
|
test_expect_success 'setup unique colors' '
|
|
|
|
|
|
|
|
|
|
git config status.color.untracked blue &&
|
|
|
|
|
git config status.color.branch green
|
|
|
|
|
git config status.color.branch green &&
|
|
|
|
|
git config status.color.localBranch yellow &&
|
|
|
|
|
git config status.color.remoteBranch cyan
|
|
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success 'status with color.ui' '
|
|
|
|
|
cat >expect <<\EOF &&
|
|
|
|
|
On branch <GREEN>master<RESET>
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -675,7 +732,7 @@ test_expect_success 'status -s with color.status' '
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
cat >expect <<\EOF
|
|
|
|
|
## <GREEN>master<RESET>
|
|
|
|
|
## <YELLOW>master<RESET>...<CYAN>upstream<RESET> [ahead <YELLOW>1<RESET>, behind <CYAN>2<RESET>]
|
|
|
|
|
<RED>M<RESET> dir1/modified
|
|
|
|
|
<GREEN>A<RESET> dir2/added
|
|
|
|
|
<BLUE>??<RESET> dir1/untracked
|
|
|
|
@ -726,7 +783,7 @@ test_expect_success 'status --porcelain respects -b' '
|
|
|
|
|
|
|
|
|
|
git status --porcelain -b >output &&
|
|
|
|
|
{
|
|
|
|
|
echo "## master" &&
|
|
|
|
|
echo "## master...upstream [ahead 1, behind 2]" &&
|
|
|
|
|
cat expect
|
|
|
|
|
} >tmp &&
|
|
|
|
|
mv tmp expect &&
|
|
|
|
@ -739,6 +796,10 @@ test_expect_success 'status --porcelain respects -b' '
|
|
|
|
|
test_expect_success 'status without relative paths' '
|
|
|
|
|
cat >expect <<\EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -785,6 +846,10 @@ test_expect_success 'status -s without relative paths' '
|
|
|
|
|
test_expect_success 'dry-run of partial commit excluding new file in index' '
|
|
|
|
|
cat >expect <<EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -825,6 +890,10 @@ test_expect_success 'setup status submodule summary' '
|
|
|
|
|
test_expect_success 'status submodule summary is disabled by default' '
|
|
|
|
|
cat >expect <<EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -881,6 +950,10 @@ head=$(cd sm && git rev-parse --short=7 --verify HEAD)
|
|
|
|
|
test_expect_success 'status submodule summary' '
|
|
|
|
|
cat >expect <<EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 1 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -939,6 +1012,10 @@ test_expect_success 'status -s submodule summary' '
|
|
|
|
|
test_expect_success 'status submodule summary (clean submodule): commit' '
|
|
|
|
|
cat >expect <<EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 2 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
@ -985,6 +1062,10 @@ test_expect_success 'status -z implies porcelain' '
|
|
|
|
|
test_expect_success 'commit --dry-run submodule summary (--amend)' '
|
|
|
|
|
cat >expect <<EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 2 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD^1 <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -1038,6 +1119,10 @@ touch .gitmodules
|
|
|
|
|
test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
|
|
|
|
|
cat > expect << EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 2 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -1146,6 +1231,10 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with modifie
|
|
|
|
|
test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
|
|
|
|
|
cat > expect << EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 2 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -1202,6 +1291,10 @@ head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --
|
|
|
|
|
test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
|
|
|
|
|
cat > expect << EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 2 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -1282,6 +1375,10 @@ test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary
|
|
|
|
|
|
|
|
|
|
cat > expect << EOF
|
|
|
|
|
; On branch master
|
|
|
|
|
; Your branch and 'upstream' have diverged,
|
|
|
|
|
; and have 2 and 2 different commits each, respectively.
|
|
|
|
|
; (use "git pull" to merge the remote branch into yours)
|
|
|
|
|
;
|
|
|
|
|
; Changes to be committed:
|
|
|
|
|
; (use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
;
|
|
|
|
@ -1329,6 +1426,10 @@ test_expect_success "status (core.commentchar with two chars with submodule summ
|
|
|
|
|
test_expect_success "--ignore-submodules=all suppresses submodule summary" '
|
|
|
|
|
cat > expect << EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 2 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
@ -1353,6 +1454,10 @@ EOF
|
|
|
|
|
test_expect_success '.gitmodules ignore=all suppresses unstaged submodule summary' '
|
|
|
|
|
cat > expect << EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 2 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
@ -1472,6 +1577,10 @@ test_expect_success 'git commit --dry-run will show a staged but ignored submodu
|
|
|
|
|
git add sm &&
|
|
|
|
|
cat >expect << EOF &&
|
|
|
|
|
On branch master
|
|
|
|
|
Your branch and '\''upstream'\'' have diverged,
|
|
|
|
|
and have 2 and 2 different commits each, respectively.
|
|
|
|
|
(use "git pull" to merge the remote branch into yours)
|
|
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
|
|