All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] branch: reject -D/-d without branch name
@ 2013-01-25  8:26 Nguyễn Thái Ngọc Duy
  2013-01-25  8:45 ` Matthieu Moy
  2013-01-25 12:50 ` [PATCH v2 1/3] " Nguyễn Thái Ngọc Duy
  0 siblings, 2 replies; 14+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-01-25  8:26 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/branch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 873f624..1d3e842 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -837,7 +837,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		colopts = 0;
 	}
 
-	if (delete)
+	if (delete && argc)
 		return delete_branches(argc, argv, delete > 1, kinds, quiet);
 	else if (list) {
 		int ret = print_ref_list(kinds, detached, verbose, abbrev,
-- 
1.8.1.1.380.g782aa97

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

* Re: [PATCH] branch: reject -D/-d without branch name
  2013-01-25  8:26 [PATCH] branch: reject -D/-d without branch name Nguyễn Thái Ngọc Duy
@ 2013-01-25  8:45 ` Matthieu Moy
  2013-01-25  8:56   ` Duy Nguyen
  2013-01-25 12:50 ` [PATCH v2 1/3] " Nguyễn Thái Ngọc Duy
  1 sibling, 1 reply; 14+ messages in thread
From: Matthieu Moy @ 2013-01-25  8:45 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Junio C Hamano

Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:

> diff --git a/builtin/branch.c b/builtin/branch.c
> index 873f624..1d3e842 100644
> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -837,7 +837,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>  		colopts = 0;
>  	}
>  
> -	if (delete)
> +	if (delete && argc)
>  		return delete_branches(argc, argv, delete > 1, kinds, quiet);
>  	else if (list) {
>  		int ret = print_ref_list(kinds, detached, verbose, abbrev,

Shouldn't this error out with a clean error message ("branch name
expected" or so)?

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

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

* Re: [PATCH] branch: reject -D/-d without branch name
  2013-01-25  8:45 ` Matthieu Moy
@ 2013-01-25  8:56   ` Duy Nguyen
  0 siblings, 0 replies; 14+ messages in thread
From: Duy Nguyen @ 2013-01-25  8:56 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git, Junio C Hamano

On Fri, Jan 25, 2013 at 3:45 PM, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> wrote:
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
>
>> diff --git a/builtin/branch.c b/builtin/branch.c
>> index 873f624..1d3e842 100644
>> --- a/builtin/branch.c
>> +++ b/builtin/branch.c
>> @@ -837,7 +837,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>>               colopts = 0;
>>       }
>>
>> -     if (delete)
>> +     if (delete && argc)
>>               return delete_branches(argc, argv, delete > 1, kinds, quiet);
>>       else if (list) {
>>               int ret = print_ref_list(kinds, detached, verbose, abbrev,
>
> Shouldn't this error out with a clean error message ("branch name
> expected" or so)?

Yeah. But on the other hand, this command seems to prefer to print
help usage when incorrect number of arguments is given (checkout
blocks "if (edit_description)" and "if (rename)" in cmd_branch).
Should those be fixed too?
-- 
Duy

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

* [PATCH v2 1/3] branch: reject -D/-d without branch name
  2013-01-25  8:26 [PATCH] branch: reject -D/-d without branch name Nguyễn Thái Ngọc Duy
  2013-01-25  8:45 ` Matthieu Moy
@ 2013-01-25 12:50 ` Nguyễn Thái Ngọc Duy
  2013-01-25 12:50   ` [PATCH v2 2/3] branch: give a more helpful message on redundant arguments Nguyễn Thái Ngọc Duy
                     ` (3 more replies)
  1 sibling, 4 replies; 14+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-01-25 12:50 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Matthieu Moy,
	Nguyễn Thái Ngọc Duy

---
 builtin/branch.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 873f624..50fcacc 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -837,9 +837,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		colopts = 0;
 	}
 
-	if (delete)
+	if (delete) {
+		if (!argc)
+			die(_("branch name required"));
 		return delete_branches(argc, argv, delete > 1, kinds, quiet);
-	else if (list) {
+	} else if (list) {
 		int ret = print_ref_list(kinds, detached, verbose, abbrev,
 					 with_commit, argv);
 		print_columns(&output, colopts, NULL);
-- 
1.8.0.rc2.23.g1fb49df

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

* [PATCH v2 2/3] branch: give a more helpful message on redundant arguments
  2013-01-25 12:50 ` [PATCH v2 1/3] " Nguyễn Thái Ngọc Duy
@ 2013-01-25 12:50   ` Nguyễn Thái Ngọc Duy
  2013-01-27 11:58     ` Jonathan Nieder
  2013-01-25 12:50   ` [PATCH v2 3/3] branch: mark more strings for translation Nguyễn Thái Ngọc Duy
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-01-25 12:50 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Matthieu Moy,
	Nguyễn Thái Ngọc Duy

While at there, do not stop user from editing a branch description
when the unrelated HEAD is detached.
---
 builtin/branch.c  | 12 ++++++------
 t/t3200-branch.sh |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 50fcacc..ca61c5b 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -852,14 +852,14 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		const char *branch_name;
 		struct strbuf branch_ref = STRBUF_INIT;
 
-		if (detached)
-			die("Cannot give description to detached HEAD");
-		if (!argc)
+		if (!argc) {
+			if (detached)
+				die("Cannot give description to detached HEAD");
 			branch_name = head;
-		else if (argc == 1)
+		} else if (argc == 1)
 			branch_name = argv[0];
 		else
-			usage_with_options(builtin_branch_usage, options);
+			die(_("cannot edit description of more than one branch"));
 
 		strbuf_addf(&branch_ref, "refs/heads/%s", branch_name);
 		if (!ref_exists(branch_ref.buf)) {
@@ -881,7 +881,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		else if (argc == 2)
 			rename_branch(argv[0], argv[1], rename > 1);
 		else
-			usage_with_options(builtin_branch_usage, options);
+			die(_("too many branches for a rename operation"));
 	} else if (new_upstream) {
 		struct branch *branch = branch_get(argv[0]);
 
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 80e6be3..f3e0e4a 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -73,8 +73,8 @@ test_expect_success \
 
 test_expect_success \
     'git branch -m dumps usage' \
-       'test_expect_code 129 git branch -m 2>err &&
-	test_i18ngrep "[Uu]sage: git branch" err'
+       'test_expect_code 128 git branch -m 2>err &&
+	test_i18ngrep "too many branches for a rename operation" err'
 
 test_expect_success \
     'git branch -m m m/m should work' \
-- 
1.8.0.rc2.23.g1fb49df

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

* [PATCH v2 3/3] branch: mark more strings for translation
  2013-01-25 12:50 ` [PATCH v2 1/3] " Nguyễn Thái Ngọc Duy
  2013-01-25 12:50   ` [PATCH v2 2/3] branch: give a more helpful message on redundant arguments Nguyễn Thái Ngọc Duy
@ 2013-01-25 12:50   ` Nguyễn Thái Ngọc Duy
  2013-01-27 11:55     ` Jonathan Nieder
  2013-01-25 19:04   ` [PATCH v2 1/3] branch: reject -D/-d without branch name Junio C Hamano
  2013-01-28  1:18   ` [PATCH v3 1/4] branch: no detached HEAD check when editing another branch's description Nguyễn Thái Ngọc Duy
  3 siblings, 1 reply; 14+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-01-25 12:50 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Matthieu Moy,
	Nguyễn Thái Ngọc Duy

---
 builtin/branch.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index ca61c5b..597b578 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -466,7 +466,7 @@ static void add_verbose_info(struct strbuf *out, struct ref_item *item,
 			     int verbose, int abbrev)
 {
 	struct strbuf subject = STRBUF_INIT, stat = STRBUF_INIT;
-	const char *sub = " **** invalid ref ****";
+	const char *sub = _(" **** invalid ref ****");
 	struct commit *commit = item->commit;
 
 	if (commit && !parse_commit(commit)) {
@@ -590,7 +590,7 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
 		struct commit *filter;
 		filter = lookup_commit_reference_gently(merge_filter_ref, 0);
 		if (!filter)
-			die("object '%s' does not point to a commit",
+			die(_("object '%s' does not point to a commit"),
 			    sha1_to_hex(merge_filter_ref));
 
 		filter->object.flags |= UNINTERESTING;
@@ -854,7 +854,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 
 		if (!argc) {
 			if (detached)
-				die("Cannot give description to detached HEAD");
+				die(_("Cannot give description to detached HEAD"));
 			branch_name = head;
 		} else if (argc == 1)
 			branch_name = argv[0];
@@ -866,10 +866,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 			strbuf_release(&branch_ref);
 
 			if (!argc)
-				return error("No commit on branch '%s' yet.",
+				return error(_("No commit on branch '%s' yet."),
 					     branch_name);
 			else
-				return error("No such branch '%s'.", branch_name);
+				return error(_("No branch named '%s'."),
+					     branch_name);
 		}
 		strbuf_release(&branch_ref);
 
-- 
1.8.0.rc2.23.g1fb49df

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

* Re: [PATCH v2 1/3] branch: reject -D/-d without branch name
  2013-01-25 12:50 ` [PATCH v2 1/3] " Nguyễn Thái Ngọc Duy
  2013-01-25 12:50   ` [PATCH v2 2/3] branch: give a more helpful message on redundant arguments Nguyễn Thái Ngọc Duy
  2013-01-25 12:50   ` [PATCH v2 3/3] branch: mark more strings for translation Nguyễn Thái Ngọc Duy
@ 2013-01-25 19:04   ` Junio C Hamano
  2013-01-26  3:12     ` Duy Nguyen
  2013-01-28  1:18   ` [PATCH v3 1/4] branch: no detached HEAD check when editing another branch's description Nguyễn Thái Ngọc Duy
  3 siblings, 1 reply; 14+ messages in thread
From: Junio C Hamano @ 2013-01-25 19:04 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Matthieu Moy

Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:

> ---
>  builtin/branch.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Forgot to sign-off?

Is this a real problem?

I do not see it particularly wrong to succeed after deleting 0 or
more given branch names.

>
> diff --git a/builtin/branch.c b/builtin/branch.c
> index 873f624..50fcacc 100644
> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -837,9 +837,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>  		colopts = 0;
>  	}
>  
> -	if (delete)
> +	if (delete) {
> +		if (!argc)
> +			die(_("branch name required"));
>  		return delete_branches(argc, argv, delete > 1, kinds, quiet);
> -	else if (list) {
> +	} else if (list) {
>  		int ret = print_ref_list(kinds, detached, verbose, abbrev,
>  					 with_commit, argv);
>  		print_columns(&output, colopts, NULL);

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

* Re: [PATCH v2 1/3] branch: reject -D/-d without branch name
  2013-01-25 19:04   ` [PATCH v2 1/3] branch: reject -D/-d without branch name Junio C Hamano
@ 2013-01-26  3:12     ` Duy Nguyen
  0 siblings, 0 replies; 14+ messages in thread
From: Duy Nguyen @ 2013-01-26  3:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Matthieu Moy

On Sat, Jan 26, 2013 at 2:04 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
>
>> ---
>>  builtin/branch.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> Forgot to sign-off?

Yes

> Is this a real problem?

Yes. My thoughts yesterday when I happened to type "git branch -D":

"Wait, I just entered a delete command without a branch name. It did
not report anything, which in UNIX world usually means successful
operation. _What_ did it delete??"

I knew this code so I just went check. If I did not know, I might as
well list all branches I had and see if something was missing. A short
message would have saved me the trouble.

> I do not see it particularly wrong to succeed after deleting 0 or
> more given branch names.
-- 
Duy

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

* Re: [PATCH v2 3/3] branch: mark more strings for translation
  2013-01-25 12:50   ` [PATCH v2 3/3] branch: mark more strings for translation Nguyễn Thái Ngọc Duy
@ 2013-01-27 11:55     ` Jonathan Nieder
  0 siblings, 0 replies; 14+ messages in thread
From: Jonathan Nieder @ 2013-01-27 11:55 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Junio C Hamano, Matthieu Moy

Nguyễn Thái Ngọc Duy wrote:

> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -466,7 +466,7 @@ static void add_verbose_info(struct strbuf *out, struct ref_item *item,
>  			     int verbose, int abbrev)
>  {
>  	struct strbuf subject = STRBUF_INIT, stat = STRBUF_INIT;
> -	const char *sub = " **** invalid ref ****";
> +	const char *sub = _(" **** invalid ref ****");

This worried me for a second --- is it an actual message that gets
emitted, a placeholder used only in code, or some combination of
the two?

Luckily it really is just a message (or rather, a value for the commit
message column in the " f7c0c00 [ahead 58, behind 197] vcs-svn: drop
obj_pool.h" message).

For what it's worth, assuming this passes tests,
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

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

* Re: [PATCH v2 2/3] branch: give a more helpful message on redundant arguments
  2013-01-25 12:50   ` [PATCH v2 2/3] branch: give a more helpful message on redundant arguments Nguyễn Thái Ngọc Duy
@ 2013-01-27 11:58     ` Jonathan Nieder
  0 siblings, 0 replies; 14+ messages in thread
From: Jonathan Nieder @ 2013-01-27 11:58 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Junio C Hamano, Matthieu Moy

Nguyễn Thái Ngọc Duy wrote:

> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -852,14 +852,14 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>  		const char *branch_name;
>  		struct strbuf branch_ref = STRBUF_INIT;
>  
> -		if (detached)
> -			die("Cannot give description to detached HEAD");
> -		if (!argc)
> +		if (!argc) {
> +			if (detached)
> +				die("Cannot give description to detached HEAD");

Good catch.  Shouldn't this bugfix be a separate patch, so it can also
be included in maint?

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

* [PATCH v3 1/4] branch: no detached HEAD check when editing another branch's description
  2013-01-25 12:50 ` [PATCH v2 1/3] " Nguyễn Thái Ngọc Duy
                     ` (2 preceding siblings ...)
  2013-01-25 19:04   ` [PATCH v2 1/3] branch: reject -D/-d without branch name Junio C Hamano
@ 2013-01-28  1:18   ` Nguyễn Thái Ngọc Duy
  2013-01-28  1:18     ` [PATCH v3 2/4] branch: reject -D/-d without branch name Nguyễn Thái Ngọc Duy
                       ` (2 more replies)
  3 siblings, 3 replies; 14+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-01-28  1:18 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Matthieu Moy, Jonathan Nieder,
	Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Split out from v3's 2/3 as Jonathan suggested.

 builtin/branch.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 873f624..ea6498b 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -850,11 +850,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		const char *branch_name;
 		struct strbuf branch_ref = STRBUF_INIT;
 
-		if (detached)
-			die("Cannot give description to detached HEAD");
-		if (!argc)
+		if (!argc) {
+			if (detached)
+				die("Cannot give description to detached HEAD");
 			branch_name = head;
-		else if (argc == 1)
+		} else if (argc == 1)
 			branch_name = argv[0];
 		else
 			usage_with_options(builtin_branch_usage, options);
-- 
1.8.1.1.459.g5970e58

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

* [PATCH v3 2/4] branch: reject -D/-d without branch name
  2013-01-28  1:18   ` [PATCH v3 1/4] branch: no detached HEAD check when editing another branch's description Nguyễn Thái Ngọc Duy
@ 2013-01-28  1:18     ` Nguyễn Thái Ngọc Duy
  2013-01-28  1:18     ` [PATCH v3 3/4] branch: give a more helpful message on redundant arguments Nguyễn Thái Ngọc Duy
  2013-01-28  1:18     ` [PATCH v3 4/4] branch: mark more strings for translation Nguyễn Thái Ngọc Duy
  2 siblings, 0 replies; 14+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-01-28  1:18 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Matthieu Moy, Jonathan Nieder,
	Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/branch.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index ea6498b..30c4545 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -837,9 +837,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		colopts = 0;
 	}
 
-	if (delete)
+	if (delete) {
+		if (!argc)
+			die(_("branch name required"));
 		return delete_branches(argc, argv, delete > 1, kinds, quiet);
-	else if (list) {
+	} else if (list) {
 		int ret = print_ref_list(kinds, detached, verbose, abbrev,
 					 with_commit, argv);
 		print_columns(&output, colopts, NULL);
-- 
1.8.1.1.459.g5970e58

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

* [PATCH v3 3/4] branch: give a more helpful message on redundant arguments
  2013-01-28  1:18   ` [PATCH v3 1/4] branch: no detached HEAD check when editing another branch's description Nguyễn Thái Ngọc Duy
  2013-01-28  1:18     ` [PATCH v3 2/4] branch: reject -D/-d without branch name Nguyễn Thái Ngọc Duy
@ 2013-01-28  1:18     ` Nguyễn Thái Ngọc Duy
  2013-01-28  1:18     ` [PATCH v3 4/4] branch: mark more strings for translation Nguyễn Thái Ngọc Duy
  2 siblings, 0 replies; 14+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-01-28  1:18 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Matthieu Moy, Jonathan Nieder,
	Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/branch.c  | 4 ++--
 t/t3200-branch.sh | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 30c4545..ca61c5b 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -859,7 +859,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		} else if (argc == 1)
 			branch_name = argv[0];
 		else
-			usage_with_options(builtin_branch_usage, options);
+			die(_("cannot edit description of more than one branch"));
 
 		strbuf_addf(&branch_ref, "refs/heads/%s", branch_name);
 		if (!ref_exists(branch_ref.buf)) {
@@ -881,7 +881,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		else if (argc == 2)
 			rename_branch(argv[0], argv[1], rename > 1);
 		else
-			usage_with_options(builtin_branch_usage, options);
+			die(_("too many branches for a rename operation"));
 	} else if (new_upstream) {
 		struct branch *branch = branch_get(argv[0]);
 
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 80e6be3..f3e0e4a 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -73,8 +73,8 @@ test_expect_success \
 
 test_expect_success \
     'git branch -m dumps usage' \
-       'test_expect_code 129 git branch -m 2>err &&
-	test_i18ngrep "[Uu]sage: git branch" err'
+       'test_expect_code 128 git branch -m 2>err &&
+	test_i18ngrep "too many branches for a rename operation" err'
 
 test_expect_success \
     'git branch -m m m/m should work' \
-- 
1.8.1.1.459.g5970e58

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

* [PATCH v3 4/4] branch: mark more strings for translation
  2013-01-28  1:18   ` [PATCH v3 1/4] branch: no detached HEAD check when editing another branch's description Nguyễn Thái Ngọc Duy
  2013-01-28  1:18     ` [PATCH v3 2/4] branch: reject -D/-d without branch name Nguyễn Thái Ngọc Duy
  2013-01-28  1:18     ` [PATCH v3 3/4] branch: give a more helpful message on redundant arguments Nguyễn Thái Ngọc Duy
@ 2013-01-28  1:18     ` Nguyễn Thái Ngọc Duy
  2 siblings, 0 replies; 14+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-01-28  1:18 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Matthieu Moy, Jonathan Nieder,
	Nguyễn Thái Ngọc Duy

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 On Sun, Jan 27, 2013 at 6:55 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
 > For what it's worth, assuming this passes tests,

 It passes the tests. Although I doubt the tests are written to catch
 this.

 builtin/branch.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index ca61c5b..597b578 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -466,7 +466,7 @@ static void add_verbose_info(struct strbuf *out, struct ref_item *item,
 			     int verbose, int abbrev)
 {
 	struct strbuf subject = STRBUF_INIT, stat = STRBUF_INIT;
-	const char *sub = " **** invalid ref ****";
+	const char *sub = _(" **** invalid ref ****");
 	struct commit *commit = item->commit;
 
 	if (commit && !parse_commit(commit)) {
@@ -590,7 +590,7 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
 		struct commit *filter;
 		filter = lookup_commit_reference_gently(merge_filter_ref, 0);
 		if (!filter)
-			die("object '%s' does not point to a commit",
+			die(_("object '%s' does not point to a commit"),
 			    sha1_to_hex(merge_filter_ref));
 
 		filter->object.flags |= UNINTERESTING;
@@ -854,7 +854,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 
 		if (!argc) {
 			if (detached)
-				die("Cannot give description to detached HEAD");
+				die(_("Cannot give description to detached HEAD"));
 			branch_name = head;
 		} else if (argc == 1)
 			branch_name = argv[0];
@@ -866,10 +866,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 			strbuf_release(&branch_ref);
 
 			if (!argc)
-				return error("No commit on branch '%s' yet.",
+				return error(_("No commit on branch '%s' yet."),
 					     branch_name);
 			else
-				return error("No such branch '%s'.", branch_name);
+				return error(_("No branch named '%s'."),
+					     branch_name);
 		}
 		strbuf_release(&branch_ref);
 
-- 
1.8.1.1.459.g5970e58

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

end of thread, other threads:[~2013-01-28  1:19 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-25  8:26 [PATCH] branch: reject -D/-d without branch name Nguyễn Thái Ngọc Duy
2013-01-25  8:45 ` Matthieu Moy
2013-01-25  8:56   ` Duy Nguyen
2013-01-25 12:50 ` [PATCH v2 1/3] " Nguyễn Thái Ngọc Duy
2013-01-25 12:50   ` [PATCH v2 2/3] branch: give a more helpful message on redundant arguments Nguyễn Thái Ngọc Duy
2013-01-27 11:58     ` Jonathan Nieder
2013-01-25 12:50   ` [PATCH v2 3/3] branch: mark more strings for translation Nguyễn Thái Ngọc Duy
2013-01-27 11:55     ` Jonathan Nieder
2013-01-25 19:04   ` [PATCH v2 1/3] branch: reject -D/-d without branch name Junio C Hamano
2013-01-26  3:12     ` Duy Nguyen
2013-01-28  1:18   ` [PATCH v3 1/4] branch: no detached HEAD check when editing another branch's description Nguyễn Thái Ngọc Duy
2013-01-28  1:18     ` [PATCH v3 2/4] branch: reject -D/-d without branch name Nguyễn Thái Ngọc Duy
2013-01-28  1:18     ` [PATCH v3 3/4] branch: give a more helpful message on redundant arguments Nguyễn Thái Ngọc Duy
2013-01-28  1:18     ` [PATCH v3 4/4] branch: mark more strings for translation Nguyễn Thái Ngọc Duy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.