32
test_i18ngrep "[Uu]sage" broken/usage
33
'
34
35
+test_expect_success 'create upstream branch' '
36
+ git checkout -b upstream &&
37
+ test_commit upstream1 &&
38
+ test_commit upstream2 &&
39
+ # leave the first commit on master as root because several
40
+ # tests depend on this case; for our upstream we only
41
+ # care about commit counts anyway, so a totally divergent
42
+ # history is OK
43
+ git checkout --orphan master
44
+'
45
+
46
test_expect_success 'setup' '
47
: >tracked &&
48
: >modified &&
64
echo 1 >dir1/modified &&
65
echo 2 >dir2/modified &&
66
echo 3 >dir2/added &&
56
- git add dir2/added
67
+ git add dir2/added &&
68
+
69
+ git branch --set-upstream-to=upstream
70
'
71
72
test_expect_success 'status (1)' '
88
test_expect_success 'status --column' '
89
cat >expect <<\EOF &&
90
# On branch master
91
+# Your branch and '\''upstream'\'' have diverged,
92
+# and have 1 and 2 different commits each, respectively.
93
+# (use "git pull" to merge the remote branch into yours)
94
+#
95
# Changes to be committed:
96
# (use "git reset HEAD <file>..." to unstage)
97
#
122
123
cat >expect <<\EOF
124
# On branch master
125
+# Your branch and 'upstream' have diverged,
126
+# and have 1 and 2 different commits each, respectively.
127
+# (use "git pull" to merge the remote branch into yours)
128
+#
129
# Changes to be committed:
130
# (use "git reset HEAD <file>..." to unstage)
131
#
199
200
cat >expect <<\EOF
201
On branch master
202
+Your branch and 'upstream' have diverged,
203
+and have 1 and 2 different commits each, respectively.
204
+
205
Changes to be committed:
206
new file: dir2/added
207
272
273
cat >expect <<\EOF &&
274
On branch master
275
+Your branch and '\''upstream'\'' have diverged,
276
+and have 1 and 2 different commits each, respectively.
277
+ (use "git pull" to merge the remote branch into yours)
278
+
279
Changes to be committed:
280
(use "git reset HEAD <file>..." to unstage)
281
341
342
cat >expect <<\EOF &&
343
On branch master
344
+Your branch and '\''upstream'\'' have diverged,
345
+and have 1 and 2 different commits each, respectively.
346
+ (use "git pull" to merge the remote branch into yours)
347
+
348
Changes to be committed:
349
(use "git reset HEAD <file>..." to unstage)
350
380
EOF
381
382
cat >expect <<\EOF
351
-## master
383
+## master...upstream [ahead 1, behind 2]
384
M dir1/modified
385
A dir2/added
386
?? dir1/untracked
414
test_expect_success 'status -uno' '
415
cat >expect <<EOF &&
416
On branch master
417
+Your branch and '\''upstream'\'' have diverged,
418
+and have 1 and 2 different commits each, respectively.
419
+ (use "git pull" to merge the remote branch into yours)
420
+
421
Changes to be committed:
422
(use "git reset HEAD <file>..." to unstage)
423
444
test_expect_success 'status -uno (advice.statusHints false)' '
445
cat >expect <<EOF &&
446
On branch master
447
+Your branch and '\''upstream'\'' have diverged,
448
+and have 1 and 2 different commits each, respectively.
449
+
450
Changes to be committed:
451
new file: dir2/added
452
478
test_expect_success 'status -unormal' '
479
cat >expect <<EOF &&
480
On branch master
481
+Your branch and '\''upstream'\'' have diverged,
482
+and have 1 and 2 different commits each, respectively.
483
+ (use "git pull" to merge the remote branch into yours)
484
+
485
Changes to be committed:
486
(use "git reset HEAD <file>..." to unstage)
487
536
test_expect_success 'status -uall' '
537
cat >expect <<EOF &&
538
On branch master
539
+Your branch and '\''upstream'\'' have diverged,
540
+and have 1 and 2 different commits each, respectively.
541
+ (use "git pull" to merge the remote branch into yours)
542
+
543
Changes to be committed:
544
(use "git reset HEAD <file>..." to unstage)
545
599
test_expect_success 'status with relative paths' '
600
cat >expect <<\EOF &&
601
On branch master
602
+Your branch and '\''upstream'\'' have diverged,
603
+and have 1 and 2 different commits each, respectively.
604
+ (use "git pull" to merge the remote branch into yours)
605
+
606
Changes to be committed:
607
(use "git reset HEAD <file>..." to unstage)
608
668
test_expect_success 'status with color.ui' '
669
cat >expect <<\EOF &&
670
On branch <GREEN>master<RESET>
671
+Your branch and '\''upstream'\'' have diverged,
672
+and have 1 and 2 different commits each, respectively.
673
+ (use "git pull" to merge the remote branch into yours)
674
+
675
Changes to be committed:
676
(use "git reset HEAD <file>..." to unstage)
677
730
'
731
732
cat >expect <<\EOF
678
-## <GREEN>master<RESET>
733
+## <GREEN>master<RESET>...<RED>upstream<RESET> [ahead <GREEN>1<RESET>, behind <RED>2<RESET>]
734
<RED>M<RESET> dir1/modified
735
<GREEN>A<RESET> dir2/added
736
<BLUE>??<RESET> dir1/untracked
781
782
git status --porcelain -b >output &&
783
{
729
- echo "## master" &&
784
+ echo "## master...upstream [ahead 1, behind 2]" &&
785
cat expect
786
} >tmp &&
787
mv tmp expect &&
794
test_expect_success 'status without relative paths' '
795
cat >expect <<\EOF &&
796
On branch master
797
+Your branch and '\''upstream'\'' have diverged,
798
+and have 1 and 2 different commits each, respectively.
799
+ (use "git pull" to merge the remote branch into yours)
800
+
801
Changes to be committed:
802
(use "git reset HEAD <file>..." to unstage)
803
844
test_expect_success 'dry-run of partial commit excluding new file in index' '
845
cat >expect <<EOF &&
846
On branch master
847
+Your branch and '\''upstream'\'' have diverged,
848
+and have 1 and 2 different commits each, respectively.
849
+ (use "git pull" to merge the remote branch into yours)
850
+
851
Changes to be committed:
852
(use "git reset HEAD <file>..." to unstage)
853
888
test_expect_success 'status submodule summary is disabled by default' '
889
cat >expect <<EOF &&
890
On branch master
891
+Your branch and '\''upstream'\'' have diverged,
892
+and have 1 and 2 different commits each, respectively.
893
+ (use "git pull" to merge the remote branch into yours)
894
+
895
Changes to be committed:
896
(use "git reset HEAD <file>..." to unstage)
897
948
test_expect_success 'status submodule summary' '
949
cat >expect <<EOF &&
950
On branch master
951
+Your branch and '\''upstream'\'' have diverged,
952
+and have 1 and 2 different commits each, respectively.
953
+ (use "git pull" to merge the remote branch into yours)
954
+
955
Changes to be committed:
956
(use "git reset HEAD <file>..." to unstage)
957
1010
test_expect_success 'status submodule summary (clean submodule): commit' '
1011
cat >expect <<EOF &&
1012
On branch master
1013
+Your branch and '\''upstream'\'' have diverged,
1014
+and have 2 and 2 different commits each, respectively.
1015
+ (use "git pull" to merge the remote branch into yours)
1016
+
1017
Changes not staged for commit:
1018
(use "git add <file>..." to update what will be committed)
1019
(use "git checkout -- <file>..." to discard changes in working directory)
1060
test_expect_success 'commit --dry-run submodule summary (--amend)' '
1061
cat >expect <<EOF &&
1062
On branch master
1063
+Your branch and '\''upstream'\'' have diverged,
1064
+and have 2 and 2 different commits each, respectively.
1065
+ (use "git pull" to merge the remote branch into yours)
1066
+
1067
Changes to be committed:
1068
(use "git reset HEAD^1 <file>..." to unstage)
1069
1117
test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
1118
cat > expect << EOF &&
1119
On branch master
1120
+Your branch and '\''upstream'\'' have diverged,
1121
+and have 2 and 2 different commits each, respectively.
1122
+ (use "git pull" to merge the remote branch into yours)
1123
+
1124
Changes to be committed:
1125
(use "git reset HEAD <file>..." to unstage)
1126
1229
test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1230
cat > expect << EOF &&
1231
On branch master
1232
+Your branch and '\''upstream'\'' have diverged,
1233
+and have 2 and 2 different commits each, respectively.
1234
+ (use "git pull" to merge the remote branch into yours)
1235
+
1236
Changes to be committed:
1237
(use "git reset HEAD <file>..." to unstage)
1238
1289
test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
1290
cat > expect << EOF &&
1291
On branch master
1292
+Your branch and '\''upstream'\'' have diverged,
1293
+and have 2 and 2 different commits each, respectively.
1294
+ (use "git pull" to merge the remote branch into yours)
1295
+
1296
Changes to be committed:
1297
(use "git reset HEAD <file>..." to unstage)
1298
1373
1374
cat > expect << EOF
1375
; On branch master
1376
+; Your branch and 'upstream' have diverged,
1377
+; and have 2 and 2 different commits each, respectively.
1378
+; (use "git pull" to merge the remote branch into yours)
1379
+;
1380
; Changes to be committed:
1381
; (use "git reset HEAD <file>..." to unstage)
1382
;
1424
test_expect_success "--ignore-submodules=all suppresses submodule summary" '
1425
cat > expect << EOF &&
1426
On branch master
1427
+Your branch and '\''upstream'\'' have diverged,
1428
+and have 2 and 2 different commits each, respectively.
1429
+ (use "git pull" to merge the remote branch into yours)
1430
+
1431
Changes not staged for commit:
1432
(use "git add <file>..." to update what will be committed)
1433
(use "git checkout -- <file>..." to discard changes in working directory)
1452
test_expect_success '.gitmodules ignore=all suppresses unstaged submodule summary' '
1453
cat > expect << EOF &&
1454
On branch master
1455
+Your branch and '\''upstream'\'' have diverged,
1456
+and have 2 and 2 different commits each, respectively.
1457
+ (use "git pull" to merge the remote branch into yours)
1458
+
1459
Changes to be committed:
1460
(use "git reset HEAD <file>..." to unstage)
1461
1575
git add sm &&
1576
cat >expect << EOF &&
1577
On branch master
1578
+Your branch and '\''upstream'\'' have diverged,
1579
+and have 2 and 2 different commits each, respectively.
1580
+ (use "git pull" to merge the remote branch into yours)
1581
+
1582
Changes to be committed:
1583
(use "git reset HEAD <file>..." to unstage)
1584