git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] status merge: guarentee space between msg and path
@ 2014-03-11 16:30 Sandy Carter
  2014-03-11 19:59 ` Junio C Hamano
  2014-03-11 23:23 ` [PATCH v2] " Sandy Carter
  0 siblings, 2 replies; 10+ messages in thread
From: Sandy Carter @ 2014-03-11 16:30 UTC (permalink / raw)
  To: git; +Cc: jrnieder, Sandy Carter

Add space between how and one when printing status of unmerged data.
This fixes an appending of the how message when it is longer than 20.
This is the case in some translations such as the french one where
the colon gets appended to the file:

    supprimé par nous :wt-status.c
    modifié des deux côtés :wt-status.h

Additionally, having a space makes the file in question easier to select
in console to quickly address the problem. Without the space, the colon
(and, sometimes the last word) of the message is selected along with the
file.

The previous french example should now print as the following, which is
more proper:

    supprimé par nous : wt-status.c
    modifié des deux côtés : wt-status.h

Signed-off-by: Sandy Carter <sandy.carter@savoirfairelinux.com>
---
 wt-status.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wt-status.c b/wt-status.c
index a452407..69e0dfc 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -264,7 +264,7 @@ static void wt_status_print_unmerged_data(struct wt_status *s,
 	case 6: how = _("both added:"); break;
 	case 7: how = _("both modified:"); break;
 	}
-	status_printf_more(s, c, "%-20s%s\n", how, one);
+	status_printf_more(s, c, "%-19s %s\n", how, one);
 	strbuf_release(&onebuf);
 }
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] status merge: guarentee space between msg and path
  2014-03-11 16:30 [PATCH] status merge: guarentee space between msg and path Sandy Carter
@ 2014-03-11 19:59 ` Junio C Hamano
  2014-03-11 20:22   ` Sandy Carter
  2014-03-11 23:23 ` [PATCH v2] " Sandy Carter
  1 sibling, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2014-03-11 19:59 UTC (permalink / raw)
  To: Sandy Carter; +Cc: git, jrnieder

Sandy Carter <sandy.carter@savoirfairelinux.com> writes:

> diff --git a/wt-status.c b/wt-status.c
> index a452407..69e0dfc 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -264,7 +264,7 @@ static void wt_status_print_unmerged_data(struct wt_status *s,
>  	case 6: how = _("both added:"); break;
>  	case 7: how = _("both modified:"); break;
>  	}
> -	status_printf_more(s, c, "%-20s%s\n", how, one);
> +	status_printf_more(s, c, "%-19s %s\n", how, one);
>  	strbuf_release(&onebuf);
>  }

Thanks; I have to wonder if we would want to do something similar to
what 3651e45c (wt-status: take the alignment burden off translators,
2013-11-05) to the other parts of the output, though.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] status merge: guarentee space between msg and path
  2014-03-11 19:59 ` Junio C Hamano
@ 2014-03-11 20:22   ` Sandy Carter
  2014-03-11 20:26     ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Sandy Carter @ 2014-03-11 20:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Le 2014-03-11 15:59, Junio C Hamano a écrit :
> Sandy Carter <sandy.carter@savoirfairelinux.com> writes:
>
>> diff --git a/wt-status.c b/wt-status.c
>> index a452407..69e0dfc 100644
>> --- a/wt-status.c
>> +++ b/wt-status.c
>> @@ -264,7 +264,7 @@ static void wt_status_print_unmerged_data(struct wt_status *s,
>>   	case 6: how = _("both added:"); break;
>>   	case 7: how = _("both modified:"); break;
>>   	}
>> -	status_printf_more(s, c, "%-20s%s\n", how, one);
>> +	status_printf_more(s, c, "%-19s %s\n", how, one);
>>   	strbuf_release(&onebuf);
>>   }
>
> Thanks; I have to wonder if we would want to do something similar to
> what 3651e45c (wt-status: take the alignment burden off translators,
> 2013-11-05) to the other parts of the output, though.
>

I could, do this. It would be cleaner, but there's just the issue of the 
colon (:) which requires a space before it in the french language[1]. As 
you can see in po/fr.po, the french translators have done a good job at 
including it [2].

3651e45c takes the colon out of the control of the translators.

+       if (status == DIFF_STATUS_COPIED || status == DIFF_STATUS_RENAMED)
+               status_printf_more(s, c, "%s:%.*s%s -> %s",
+                                  what, len, padding, one, two);
+       else
+               status_printf_more(s, c, "%s:%.*s%s",
+                                  what, len, padding, one);


[1] https://en.wikipedia.org/wiki/Colon_%28punctuation%29#Spacing
[2] https://github.com/git/git/blob/master/po/fr.po#L585

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] status merge: guarentee space between msg and path
  2014-03-11 20:22   ` Sandy Carter
@ 2014-03-11 20:26     ` Junio C Hamano
  2014-03-11 23:33       ` Duy Nguyen
  0 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2014-03-11 20:26 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Sandy Carter

Sandy Carter <sandy.carter@savoirfairelinux.com> writes:

> Le 2014-03-11 15:59, Junio C Hamano a écrit :
>> Sandy Carter <sandy.carter@savoirfairelinux.com> writes:
>>
>>> diff --git a/wt-status.c b/wt-status.c
>>> index a452407..69e0dfc 100644
>>> --- a/wt-status.c
>>> +++ b/wt-status.c
>>> @@ -264,7 +264,7 @@ static void wt_status_print_unmerged_data(struct wt_status *s,
>>>   	case 6: how = _("both added:"); break;
>>>   	case 7: how = _("both modified:"); break;
>>>   	}
>>> -	status_printf_more(s, c, "%-20s%s\n", how, one);
>>> +	status_printf_more(s, c, "%-19s %s\n", how, one);
>>>   	strbuf_release(&onebuf);
>>>   }
>>
>> Thanks; I have to wonder if we would want to do something similar to
>> what 3651e45c (wt-status: take the alignment burden off translators,
>> 2013-11-05) to the other parts of the output, though.
>>
>
> I could, do this. It would be cleaner, but there's just the issue of
> the colon (:) which requires a space before it in the french
> language[1]. As you can see in po/fr.po, the french translators have
> done a good job at including it [2].
>
> 3651e45c takes the colon out of the control of the translators.

That is a separate bug we would need to address, then.  Duy Cc'ed.

> +       if (status == DIFF_STATUS_COPIED || status == DIFF_STATUS_RENAMED)
> +               status_printf_more(s, c, "%s:%.*s%s -> %s",
> +                                  what, len, padding, one, two);
> +       else
> +               status_printf_more(s, c, "%s:%.*s%s",
> +                                  what, len, padding, one);
>
>
> [1] https://en.wikipedia.org/wiki/Colon_%28punctuation%29#Spacing
> [2] https://github.com/git/git/blob/master/po/fr.po#L585

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] status merge: guarentee space between msg and path
  2014-03-11 16:30 [PATCH] status merge: guarentee space between msg and path Sandy Carter
  2014-03-11 19:59 ` Junio C Hamano
@ 2014-03-11 23:23 ` Sandy Carter
  2014-03-12 19:28   ` Junio C Hamano
  1 sibling, 1 reply; 10+ messages in thread
From: Sandy Carter @ 2014-03-11 23:23 UTC (permalink / raw)
  To: git; +Cc: gitster, pclouds, Sandy Carter

Add space between how and one when printing status of unmerged data.
This fixes an appending of the how message when it is longer than 20,
such  is the case in some translations such as the french one where the
colon gets appended to the file:
    supprimé par nous :wt-status.c
    modifié des deux côtés :wt-status.h
Additionally, having a space makes the file in question easier to select
in console to quickly address the problem. Without the space, the colon
(and, sometimes the last word) of the message is selected along with the
file.

The previous french example should now print as, which is more proper:
    supprimé par nous :      wt-status.c
    modifié des deux côtés : wt-status.h

try 2:
Add function so wt_status_print_unmerged_data() and
wt_status_print_change_data() make use of the same padding technique
defined as wt_status_status_padding_string()

This has the additionnal advantage of aligning unmerged paths with paths
of regular statuses.

Signed-off-by: Sandy Carter <sandy.carter@savoirfairelinux.com>
---
 t/t7060-wtstatus.sh         |  16 +++----
 t/t7506-status-submodule.sh |  18 ++++----
 t/t7508-status.sh           |  94 +++++++++++++++++++--------------------
 t/t7512-status-help.sh      |  30 ++++++-------
 wt-status.c                 | 104 +++++++++++++++++++++++++++++---------------
 5 files changed, 149 insertions(+), 113 deletions(-)

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] status merge: guarentee space between msg and path
  2014-03-11 20:26     ` Junio C Hamano
@ 2014-03-11 23:33       ` Duy Nguyen
  2014-03-12 18:39         ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Duy Nguyen @ 2014-03-11 23:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List, Sandy Carter

On Wed, Mar 12, 2014 at 3:26 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Sandy Carter <sandy.carter@savoirfairelinux.com> writes:
>
>> Le 2014-03-11 15:59, Junio C Hamano a écrit :
>>> Sandy Carter <sandy.carter@savoirfairelinux.com> writes:
>>>
>>>> diff --git a/wt-status.c b/wt-status.c
>>>> index a452407..69e0dfc 100644
>>>> --- a/wt-status.c
>>>> +++ b/wt-status.c
>>>> @@ -264,7 +264,7 @@ static void wt_status_print_unmerged_data(struct wt_status *s,
>>>>     case 6: how = _("both added:"); break;
>>>>     case 7: how = _("both modified:"); break;
>>>>     }
>>>> -   status_printf_more(s, c, "%-20s%s\n", how, one);
>>>> +   status_printf_more(s, c, "%-19s %s\n", how, one);
>>>>     strbuf_release(&onebuf);
>>>>   }
>>>
>>> Thanks; I have to wonder if we would want to do something similar to
>>> what 3651e45c (wt-status: take the alignment burden off translators,
>>> 2013-11-05) to the other parts of the output, though.
>>>
>>
>> I could, do this. It would be cleaner, but there's just the issue of
>> the colon (:) which requires a space before it in the french
>> language[1]. As you can see in po/fr.po, the french translators have
>> done a good job at including it [2].
>>
>> 3651e45c takes the colon out of the control of the translators.
>
> That is a separate bug we would need to address, then.  Duy Cc'ed.

We went through this before

http://thread.gmane.org/gmane.linux.debian.devel.bugs.general/1109239/focus=239560

If the colon needs language specific treatment then it should be part
of the translatable strings.
-- 
Duy

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] status merge: guarentee space between msg and path
  2014-03-11 23:33       ` Duy Nguyen
@ 2014-03-12 18:39         ` Junio C Hamano
  0 siblings, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2014-03-12 18:39 UTC (permalink / raw)
  To: Duy Nguyen, Jonathan Nieder; +Cc: Git Mailing List, Sandy Carter

Duy Nguyen <pclouds@gmail.com> writes:

> On Wed, Mar 12, 2014 at 3:26 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Sandy Carter <sandy.carter@savoirfairelinux.com> writes:
>>
>>> 3651e45c takes the colon out of the control of the translators.
>>
>> That is a separate bug we would need to address, then.  Duy Cc'ed.
>
> We went through this before
>
> http://thread.gmane.org/gmane.linux.debian.devel.bugs.general/1109239/focus=239560
>
> If the colon needs language specific treatment then it should be part
> of the translatable strings.

OK.  So we should resurrect $gmane/239537 and adjust the codepath
that was touched by 3651e45c to move the colon into translatable
string?

What other places do we assume that colons are to immediately follow
whatever human-readable text used as a label/heading, I wonder...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] status merge: guarentee space between msg and path
  2014-03-11 23:23 ` [PATCH v2] " Sandy Carter
@ 2014-03-12 19:28   ` Junio C Hamano
  2014-03-12 20:08     ` Sandy Carter
  0 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2014-03-12 19:28 UTC (permalink / raw)
  To: Sandy Carter; +Cc: git, pclouds

Sandy Carter <sandy.carter@savoirfairelinux.com> writes:

> Add space between how and one when printing status of unmerged data.
> This fixes an appending of the how message when it is longer than 20,
> such  is the case in some translations such as the french one where the
> colon gets appended to the file:
>     supprimé par nous :wt-status.c
>     modifié des deux côtés :wt-status.h
> Additionally, having a space makes the file in question easier to select
> in console to quickly address the problem. Without the space, the colon
> (and, sometimes the last word) of the message is selected along with the
> file.
>
> The previous french example should now print as, which is more proper:
>     supprimé par nous :      wt-status.c
>     modifié des deux côtés : wt-status.h
>
> try 2:
> Add function so wt_status_print_unmerged_data() and
> wt_status_print_change_data() make use of the same padding technique
> defined as wt_status_status_padding_string()
>
> This has the additionnal advantage of aligning unmerged paths with paths
> of regular statuses.
>
> Signed-off-by: Sandy Carter <sandy.carter@savoirfairelinux.com>
> ---
>  t/t7060-wtstatus.sh         |  16 +++----
>  t/t7506-status-submodule.sh |  18 ++++----
>  t/t7508-status.sh           |  94 +++++++++++++++++++--------------------
>  t/t7512-status-help.sh      |  30 ++++++-------

This is too noisy a patch to be reviewed.  I tried to resurrect
Jonathan's fix from Dec 2013 and posted it elsewhere---does it work
for you?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] status merge: guarentee space between msg and path
  2014-03-12 19:28   ` Junio C Hamano
@ 2014-03-12 20:08     ` Sandy Carter
  2014-03-12 20:43       ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Sandy Carter @ 2014-03-12 20:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, pclouds


Le 2014-03-12 15:28, Junio C Hamano a écrit :
> Sandy Carter <sandy.carter@savoirfairelinux.com> writes:
>
>> Add space between how and one when printing status of unmerged data.
>> This fixes an appending of the how message when it is longer than 20,
>> such  is the case in some translations such as the french one where the
>> colon gets appended to the file:
>>      supprimé par nous :wt-status.c
>>      modifié des deux côtés :wt-status.h
>> Additionally, having a space makes the file in question easier to select
>> in console to quickly address the problem. Without the space, the colon
>> (and, sometimes the last word) of the message is selected along with the
>> file.
>>
>> The previous french example should now print as, which is more proper:
>>      supprimé par nous :      wt-status.c
>>      modifié des deux côtés : wt-status.h
>>
>> try 2:
>> Add function so wt_status_print_unmerged_data() and
>> wt_status_print_change_data() make use of the same padding technique
>> defined as wt_status_status_padding_string()
>>
>> This has the additionnal advantage of aligning unmerged paths with paths
>> of regular statuses.
>>
>> Signed-off-by: Sandy Carter <sandy.carter@savoirfairelinux.com>
>> ---
>>   t/t7060-wtstatus.sh         |  16 +++----
>>   t/t7506-status-submodule.sh |  18 ++++----
>>   t/t7508-status.sh           |  94 +++++++++++++++++++--------------------
>>   t/t7512-status-help.sh      |  30 ++++++-------
>
> This is too noisy a patch to be reviewed.  I tried to resurrect
> Jonathan's fix from Dec 2013 and posted it elsewhere---does it work
> for you?

Seems fine except for the bit about returning _("bug"), which I brought up.

Seems to do the same thing as my proposal without changing the alignment 
of paths in of regular status output. No changes to tests necessary, 
less noisy.

It works for me.

> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] status merge: guarentee space between msg and path
  2014-03-12 20:08     ` Sandy Carter
@ 2014-03-12 20:43       ` Junio C Hamano
  0 siblings, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2014-03-12 20:43 UTC (permalink / raw)
  To: Sandy Carter; +Cc: git, pclouds

Sandy Carter <sandy.carter@savoirfairelinux.com> writes:

> Seems fine except for the bit about returning _("bug"), which I brought up.
>
> Seems to do the same thing as my proposal without changing the
> alignment of paths in of regular status output. No changes to tests
> necessary, less noisy.
>
> It works for me.

Thanks.  I'll work on a better split, then, and resend them later.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-03-12 20:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-11 16:30 [PATCH] status merge: guarentee space between msg and path Sandy Carter
2014-03-11 19:59 ` Junio C Hamano
2014-03-11 20:22   ` Sandy Carter
2014-03-11 20:26     ` Junio C Hamano
2014-03-11 23:33       ` Duy Nguyen
2014-03-12 18:39         ` Junio C Hamano
2014-03-11 23:23 ` [PATCH v2] " Sandy Carter
2014-03-12 19:28   ` Junio C Hamano
2014-03-12 20:08     ` Sandy Carter
2014-03-12 20:43       ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).