diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh
index 7d467c0..f49f3b3 100755
--- a/t/t7060-wtstatus.sh
+++ b/t/t7060-wtstatus.sh
@@ -38,7 +38,7 @@ You have unmerged paths.
Unmerged paths:
(use "git add/rm <file>..." as appropriate to mark resolution)
- deleted by us: foo
+ deleted by us: foo
no changes added to commit (use "git add" and/or "git commit -a")
EOF
@@ -142,8 +142,8 @@ You have unmerged paths.
Unmerged paths:
(use "git add/rm <file>..." as appropriate to mark resolution)
- both added: conflict.txt
- deleted by them: main.txt
+ both added: conflict.txt
+ deleted by them: main.txt
no changes added to commit (use "git add" and/or "git commit -a")
EOF
@@ -175,9 +175,9 @@ You have unmerged paths.
Unmerged paths:
(use "git add/rm <file>..." as appropriate to mark resolution)
- both deleted: main.txt
- added by them: sub_master.txt
- added by us: sub_second.txt
+ both deleted: main.txt
+ added by them: sub_master.txt
+ added by us: sub_second.txt
no changes added to commit (use "git add" and/or "git commit -a")
EOF
@@ -198,12 +198,12 @@ You have unmerged paths.
Changes to be committed:
- new file: sub_master.txt
+ new file: sub_master.txt
Unmerged paths:
(use "git rm <file>..." to mark resolution)
- both deleted: main.txt
+ both deleted: main.txt
Untracked files not listed (use -u option to show untracked files)
EOF
diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
index d31b34d..745d88b 100755
--- a/t/t7506-status-submodule.sh
+++ b/t/t7506-status-submodule.sh
@@ -38,7 +38,7 @@ test_expect_success 'status with modified file in submodule' '
(cd sub && git reset --hard) &&
echo "changed" >sub/foo &&
git status >output &&
- test_i18ngrep "modified: sub (modified content)" output
+ test_i18ngrep "modified: sub (modified content)" output
'
test_expect_success 'status with modified file in submodule (porcelain)' '
@@ -53,7 +53,7 @@ test_expect_success 'status with modified file in submodule (porcelain)' '
test_expect_success 'status with added file in submodule' '
(cd sub && git reset --hard && echo >foo && git add foo) &&
git status >output &&
- test_i18ngrep "modified: sub (modified content)" output
+ test_i18ngrep "modified: sub (modified content)" output
'
test_expect_success 'status with added file in submodule (porcelain)' '
@@ -68,7 +68,7 @@ test_expect_success 'status with untracked file in submodule' '
(cd sub && git reset --hard) &&
echo "content" >sub/new-file &&
git status >output &&
- test_i18ngrep "modified: sub (untracked content)" output
+ test_i18ngrep "modified: sub (untracked content)" output
'
test_expect_success 'status -uno with untracked file in submodule' '
@@ -87,7 +87,7 @@ test_expect_success 'status with added and untracked file in submodule' '
(cd sub && git reset --hard && echo >foo && git add foo) &&
echo "content" >sub/new-file &&
git status >output &&
- test_i18ngrep "modified: sub (modified content, untracked content)" output
+ test_i18ngrep "modified: sub (modified content, untracked content)" output
'
test_expect_success 'status with added and untracked file in submodule (porcelain)' '
@@ -105,7 +105,7 @@ test_expect_success 'status with modified file in modified submodule' '
(cd sub && echo "next change" >foo && git commit -m "next change" foo) &&
echo "changed" >sub/foo &&
git status >output &&
- test_i18ngrep "modified: sub (new commits, modified content)" output
+ test_i18ngrep "modified: sub (new commits, modified content)" output
'
test_expect_success 'status with modified file in modified submodule (porcelain)' '
@@ -120,7 +120,7 @@ test_expect_success 'status with modified file in modified submodule (porcelain)
test_expect_success 'status with added file in modified submodule' '
(cd sub && git reset --hard && echo >foo && git add foo) &&
git status >output &&
- test_i18ngrep "modified: sub (new commits, modified content)" output
+ test_i18ngrep "modified: sub (new commits, modified content)" output
'
test_expect_success 'status with added file in modified submodule (porcelain)' '
@@ -135,7 +135,7 @@ test_expect_success 'status with untracked file in modified submodule' '
(cd sub && git reset --hard) &&
echo "content" >sub/new-file &&
git status >output &&
- test_i18ngrep "modified: sub (new commits, untracked content)" output
+ test_i18ngrep "modified: sub (new commits, untracked content)" output
'
test_expect_success 'status with untracked file in modified submodule (porcelain)' '
@@ -149,7 +149,7 @@ test_expect_success 'status with added and untracked file in modified submodule'
(cd sub && git reset --hard && echo >foo && git add foo) &&
echo "content" >sub/new-file &&
git status >output &&
- test_i18ngrep "modified: sub (new commits, modified content, untracked content)" output
+ test_i18ngrep "modified: sub (new commits, modified content, untracked content)" output
'
test_expect_success 'status with added and untracked file in modified submodule (porcelain)' '
@@ -174,7 +174,7 @@ test_expect_success 'setup .git file for sub' '
test_expect_success 'status with added file in modified submodule with .git file' '
(cd sub && git reset --hard && echo >foo && git add foo) &&
git status >output &&
- test_i18ngrep "modified: sub (new commits, modified content)" output
+ test_i18ngrep "modified: sub (new commits, modified content)" output
'
test_expect_success 'rm submodule contents' '
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index c987b5e..460c653 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -72,13 +72,13 @@ test_expect_success 'status --column' '
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
-# new file: dir2/added
+# 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
+# modified: dir1/modified
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
@@ -102,13 +102,13 @@ cat >expect <<\EOF
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
-# new file: dir2/added
+# 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
+# modified: dir1/modified
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
@@ -158,10 +158,10 @@ test_expect_success 'commit ignores status.displayCommentPrefix=false in COMMIT_
cat >expect <<\EOF
On branch master
Changes to be committed:
- new file: dir2/added
+ new file: dir2/added
Changes not staged for commit:
- modified: dir1/modified
+ modified: dir1/modified
Untracked files:
dir1/untracked
@@ -233,13 +233,13 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- new file: dir2/added
+ 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
+ modified: dir1/modified
Untracked files:
(use "git add <file>..." to include in what will be committed)
@@ -296,13 +296,13 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- new file: dir2/added
+ 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
+ modified: dir1/modified
Ignored files:
(use "git add -f <file>..." to include in what will be committed)
@@ -362,13 +362,13 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- new file: dir2/added
+ 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
+ modified: dir1/modified
Untracked files not listed (use -u option to show untracked files)
EOF
@@ -386,10 +386,10 @@ test_expect_success 'status -uno (advice.statusHints false)' '
cat >expect <<EOF &&
On branch master
Changes to be committed:
- new file: dir2/added
+ new file: dir2/added
Changes not staged for commit:
- modified: dir1/modified
+ modified: dir1/modified
Untracked files not listed
EOF
@@ -419,13 +419,13 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- new file: dir2/added
+ 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
+ modified: dir1/modified
Untracked files:
(use "git add <file>..." to include in what will be committed)
@@ -477,13 +477,13 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- new file: dir2/added
+ 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
+ modified: dir1/modified
Untracked files:
(use "git add <file>..." to include in what will be committed)
@@ -540,13 +540,13 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- new file: ../dir2/added
+ 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: modified
+ modified: modified
Untracked files:
(use "git add <file>..." to include in what will be committed)
@@ -611,13 +611,13 @@ On branch <GREEN>master<RESET>
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- <GREEN>new file: dir2/added<RESET>
+ <GREEN>new file: dir2/added<RESET>
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)
- <RED>modified: dir1/modified<RESET>
+ <RED>modified: dir1/modified<RESET>
Untracked files:
(use "git add <file>..." to include in what will be committed)
@@ -741,13 +741,13 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- new file: dir2/added
+ 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
+ modified: dir1/modified
Untracked files:
(use "git add <file>..." to include in what will be committed)
@@ -791,7 +791,7 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- modified: dir1/modified
+ modified: dir1/modified
Untracked files:
(use "git add <file>..." to include in what will be committed)
@@ -833,14 +833,14 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- new file: dir2/added
- new file: sm
+ new file: dir2/added
+ new file: sm
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
+ modified: dir1/modified
Untracked files:
(use "git add <file>..." to include in what will be committed)
@@ -893,14 +893,14 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- new file: dir2/added
- new file: sm
+ new file: dir2/added
+ new file: sm
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
+ modified: dir1/modified
Submodule changes to be committed:
@@ -956,7 +956,7 @@ 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
+ modified: dir1/modified
Untracked files:
(use "git add <file>..." to include in what will be committed)
@@ -1005,14 +1005,14 @@ On branch master
Changes to be committed:
(use "git reset HEAD^1 <file>..." to unstage)
- new file: dir2/added
- new file: sm
+ new file: dir2/added
+ new file: sm
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
+ modified: dir1/modified
Submodule changes to be committed:
@@ -1060,13 +1060,13 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- modified: sm
+ modified: sm
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
+ modified: dir1/modified
Submodule changes to be committed:
@@ -1170,15 +1170,15 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- modified: sm
+ modified: sm
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)
(commit or discard the untracked or modified content in submodules)
- modified: dir1/modified
- modified: sm (modified content)
+ modified: dir1/modified
+ modified: sm (modified content)
Submodule changes to be committed:
@@ -1228,14 +1228,14 @@ On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- modified: sm
+ modified: sm
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
- modified: sm (new commits)
+ modified: dir1/modified
+ modified: sm (new commits)
Submodule changes to be committed:
@@ -1310,14 +1310,14 @@ cat > expect << EOF
; Changes to be committed:
; (use "git reset HEAD <file>..." to unstage)
;
-; modified: sm
+; modified: sm
;
; 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
-; modified: sm (new commits)
+; modified: dir1/modified
+; modified: sm (new commits)
;
; Submodule changes to be committed:
;
@@ -1361,7 +1361,7 @@ 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
+ modified: dir1/modified
Untracked files:
(use "git add <file>..." to include in what will be committed)
diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh
index 3cec57a..8fa69b0 100755
--- a/t/t7512-status-help.sh
+++ b/t/t7512-status-help.sh
@@ -33,7 +33,7 @@ You have unmerged paths.
Unmerged paths:
(use "git add <file>..." to mark resolution)
- both modified: main.txt
+ both modified: main.txt
no changes added to commit (use "git add" and/or "git commit -a")
EOF
@@ -54,7 +54,7 @@ All conflicts fixed but you are still merging.
Changes to be committed:
- modified: main.txt
+ modified: main.txt
Untracked files not listed (use -u option to show untracked files)
EOF
@@ -87,7 +87,7 @@ Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
- both modified: main.txt
+ both modified: main.txt
no changes added to commit (use "git add" and/or "git commit -a")
EOF
@@ -111,7 +111,7 @@ You are currently rebasing branch '\''rebase_conflicts'\'' on '\''$ONTO'\''.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- modified: main.txt
+ modified: main.txt
Untracked files not listed (use -u option to show untracked files)
EOF
@@ -146,7 +146,7 @@ Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
- both modified: main.txt
+ both modified: main.txt
no changes added to commit (use "git add" and/or "git commit -a")
EOF
@@ -169,7 +169,7 @@ You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- modified: main.txt
+ modified: main.txt
Untracked files not listed (use -u option to show untracked files)
EOF
@@ -224,7 +224,7 @@ 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: main.txt
+ modified: main.txt
no changes added to commit (use "git add" and/or "git commit -a")
EOF
@@ -307,7 +307,7 @@ 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: main.txt
+ modified: main.txt
no changes added to commit (use "git add" and/or "git commit -a")
EOF
@@ -379,7 +379,7 @@ 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: main.txt
+ modified: main.txt
no changes added to commit (use "git add" and/or "git commit -a")
EOF
@@ -456,7 +456,7 @@ 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: main.txt
+ modified: main.txt
no changes added to commit (use "git add" and/or "git commit -a")
EOF
@@ -602,7 +602,7 @@ rebase in progress; onto $ONTO
You are currently rebasing branch '\''statushints_disabled'\'' on '\''$ONTO'\''.
Unmerged paths:
- both modified: main.txt
+ both modified: main.txt
no changes added to commit
EOF
@@ -636,7 +636,7 @@ You are currently cherry-picking commit $TO_CHERRY_PICK.
Unmerged paths:
(use "git add <file>..." to mark resolution)
- both modified: main.txt
+ both modified: main.txt
no changes added to commit (use "git add" and/or "git commit -a")
EOF
@@ -660,7 +660,7 @@ You are currently cherry-picking commit $TO_CHERRY_PICK.
Changes to be committed:
- modified: main.txt
+ modified: main.txt
Untracked files not listed (use -u option to show untracked files)
EOF
@@ -707,7 +707,7 @@ Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
- both modified: to-revert.txt
+ both modified: to-revert.txt
no changes added to commit (use "git add" and/or "git commit -a")
EOF
@@ -727,7 +727,7 @@ You are currently reverting commit $TO_REVERT.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
- modified: to-revert.txt
+ modified: to-revert.txt
Untracked files not listed (use -u option to show untracked files)
EOF
diff --git a/wt-status.c b/wt-status.c
index a452407..5990c99 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -245,27 +245,26 @@ static void wt_status_print_trailer(struct wt_status *s)
#define quote_path quote_path_relative
-static void wt_status_print_unmerged_data(struct wt_status *s,
- struct string_list_item *it)
+static const char *wt_status_unmerged_status_string(int status)
{
- const char *c = color(WT_STATUS_UNMERGED, s);
- struct wt_status_change_data *d = it->util;
- struct strbuf onebuf = STRBUF_INIT;
- const char *one, *how = _("bug");
-
- one = quote_path(it->string, s->prefix, &onebuf);
- status_printf(s, color(WT_STATUS_HEADER, s), "\t");
- switch (d->stagemask) {
- case 1: how = _("both deleted:"); break;
- case 2: how = _("added by us:"); break;
- case 3: how = _("deleted by them:"); break;
- case 4: how = _("added by them:"); break;
- case 5: how = _("deleted by us:"); break;
- case 6: how = _("both added:"); break;
- case 7: how = _("both modified:"); break;
+ switch (status) {
+ case 1:
+ return _("both deleted");
+ case 2:
+ return _("added by us");
+ case 3:
+ return _("deleted by them");
+ case 4:
+ return _("added by them");
+ case 5:
+ return _("deleted by us");
+ case 6:
+ return _("both added");
+ case 7:
+ return _("both modified");
+ default:
+ return NULL;
}
- status_printf_more(s, c, "%-20s%s\n", how, one);
- strbuf_release(&onebuf);
}
static const char *wt_status_diff_status_string(int status)@@ -292,28 +291,25 @@ static const char *wt_status_diff_status_string(int status)
}
}
-static void wt_status_print_change_data(struct wt_status *s,
- int change_type,
- struct string_list_item *it)
+static const char *wt_status_status_padding_string()
{
- struct wt_status_change_data *d = it->util;
- const char *c = color(change_type, s);
- int status;
- char *one_name;
- char *two_name;
- const char *one, *two;
- struct strbuf onebuf = STRBUF_INIT, twobuf = STRBUF_INIT;
- struct strbuf extra = STRBUF_INIT;
static char *padding;
- const char *what;
+ const char *message;
+ int status;
int len;
if (!padding) {
int width = 0;
- /* If DIFF_STATUS_* uses outside this range, we're in trouble */
+ /* Obtain width of widest status message */
+ for (status = 1; status <= 7; status++) {
+ message = wt_status_unmerged_status_string(status);
+ len = message ? strlen(message) : 0;
+ if (len > width)
+ width = len;
+ }
for (status = 'A'; status <= 'Z'; status++) {
- what = wt_status_diff_status_string(status);
- len = what ? strlen(what) : 0;
+ message = wt_status_diff_status_string(status);
+ len = message ? strlen(message) : 0;
if (len > width)
width = len;
}@@ -322,6 +318,46 @@ static void wt_status_print_change_data(struct wt_status *s,
memset(padding, ' ', width);
}
+ return padding;
+}
+
+static void wt_status_print_unmerged_data(struct wt_status *s,
+ struct string_list_item *it)
+{
+ const char *c = color(WT_STATUS_UNMERGED, s);
+ struct wt_status_change_data *d = it->util;
+ struct strbuf onebuf = STRBUF_INIT;
+ const char *one, *how = _("bug");
+ const char *padding = wt_status_status_padding_string();
+ int len;
+
+ padding = wt_status_status_padding_string();
+ one = quote_path(it->string, s->prefix, &onebuf);
+ status_printf(s, color(WT_STATUS_HEADER, s), "\t");
+ how = wt_status_unmerged_status_string(d->stagemask);
+ /* 1 for colon, which is not part of "what" */
+ len = strlen(padding) - (utf8_strwidth(how) + 1);
+ status_printf_more(s, c, "%s:%.*s%s\n",
+ how, len, padding, one);
+ strbuf_release(&onebuf);
+}
+
+static void wt_status_print_change_data(struct wt_status *s,
+ int change_type,
+ struct string_list_item *it)
+{
+ struct wt_status_change_data *d = it->util;
+ const char *c = color(change_type, s);
+ int status;
+ char *one_name;
+ char *two_name;
+ const char *one, *two;
+ struct strbuf onebuf = STRBUF_INIT, twobuf = STRBUF_INIT;
+ struct strbuf extra = STRBUF_INIT;
+ const char *padding = wt_status_status_padding_string();
+ const char *what;
+ int len;
+
one_name = two_name = it->string;
switch (change_type) {
case WT_STATUS_UPDATED:--
1.9.0