git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Improve error message: not a valid branch name
@ 2007-08-26 15:28 Jari Aalto
  2007-08-26 21:26 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Jari Aalto @ 2007-08-26 15:28 UTC (permalink / raw)
  To: git


(create_branch): Extend die message from 'is not a valid branch name'
to '...(see git-check-ref-format)'.

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
---
 builtin-branch.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/builtin-branch.c b/builtin-branch.c
index 7408285..1006a85 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -431,7 +431,8 @@ static void create_branch(const char *name, const char *start_name,
 
 	snprintf(ref, sizeof ref, "refs/heads/%s", name);
 	if (check_ref_format(ref))
-		die("'%s' is not a valid branch name.", name);
+		die("'%s' is not a valid branch name "
+                    "(see git-check-ref-format)", name);
 
 	if (resolve_ref(ref, sha1, 1, NULL)) {
 		if (!force)
@@ -502,13 +503,15 @@ static void rename_branch(const char *oldname, const char *newname, int force)
 		die("Old branchname too long");
 
 	if (check_ref_format(oldref))
-		die("Invalid branch name: %s", oldref);
+		die("Invalid branch name: %s "
+                    "(see git-check-ref-format)", oldref);
 
 	if (snprintf(newref, sizeof(newref), "refs/heads/%s", newname) > sizeof(newref))
 		die("New branchname too long");
 
 	if (check_ref_format(newref))
-		die("Invalid branch name: %s", newref);
+		die("Invalid branch name: %s "
+                    "(see git-check-ref-format)", newref);
 
 	if (resolve_ref(newref, sha1, 1, NULL) && !force)
 		die("A branch named '%s' already exists.", newname);
-- 
1.5.3.rc5

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

* Re: [PATCH] Improve error message: not a valid branch name
  2007-08-26 15:28 [PATCH] Improve error message: not a valid branch name Jari Aalto
@ 2007-08-26 21:26 ` Junio C Hamano
  2007-08-26 22:09   ` Jari Aalto
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2007-08-26 21:26 UTC (permalink / raw)
  To: Jari Aalto; +Cc: git

Jari Aalto <jari.aalto@cante.net> writes:

> (create_branch): Extend die message from 'is not a valid branch name'
> to '...(see git-check-ref-format)'.

I think you meant to say "see git-check-ref-format(1)" as you
meant the manual page.

I am a bit torn on this.  git-check-ref-format.1 is where we
currently _happen_ to describe what valid refnames should look
like, but it could be argued that it is a bug in the manual.

Two possible improvements that are mutually incompatible would
be:

 - refactor that part of the manual to be included in the pages
   for any and all commands that can take refname from the user;
   this is inpractical as almost all command would be affected.

 - move that to more central place, say git(7), and everybody
   refer to that page;

I'd personally prefer the latter, as "naming things" is such a
central thing for the use of the system (this applies to the
description of "SHA-1 expression" that we curently have in
git-rev-parse(1) as well) and it is better for users to have
understanding of such fundamental syntaxes and concepts before
even using any individual commands.

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

* Re: [PATCH] Improve error message: not a valid branch name
  2007-08-26 21:26 ` Junio C Hamano
@ 2007-08-26 22:09   ` Jari Aalto
  2007-08-26 22:25     ` J. Bruce Fields
  0 siblings, 1 reply; 4+ messages in thread
From: Jari Aalto @ 2007-08-26 22:09 UTC (permalink / raw)
  To: git

Junio C Hamano <gitster@pobox.com> writes:

> Jari Aalto <jari.aalto@cante.net> writes:
>
>> (create_branch): Extend die message from 'is not a valid branch name'
>> to '...(see git-check-ref-format)'.
>
> I think you meant to say "see git-check-ref-format(1)" as you
> meant the manual page.

Yes.

> I am a bit torn on this.  git-check-ref-format.1 is where we
> currently _happen_ to describe what valid refnames should look
> like, but it could be argued that it is a bug in the manual.
>
> Two possible improvements that are mutually incompatible would
> be:
>
>  - refactor that part of the manual to be included in the pages
>    for any and all commands that can take refname from the user;
>    this is inpractical as almost all command would be affected.
>
>  - move that to more central place, say git(7), and everybody
>    refer to that page;
>
> I'd personally prefer the latter, as "naming things" is such a
> central thing for the use of the system (this applies to the
> description of "SHA-1 expression" that we curently have in
> git-rev-parse(1) as well) and it is better for users to have
> understanding of such fundamental syntaxes and concepts before
> even using any individual commands.

Wholeheartedly concur.

Should I re-submit the patch to refer to git(7) instead?

Jari

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

* Re: [PATCH] Improve error message: not a valid branch name
  2007-08-26 22:09   ` Jari Aalto
@ 2007-08-26 22:25     ` J. Bruce Fields
  0 siblings, 0 replies; 4+ messages in thread
From: J. Bruce Fields @ 2007-08-26 22:25 UTC (permalink / raw)
  To: Jari Aalto; +Cc: git

On Mon, Aug 27, 2007 at 01:09:20AM +0300, Jari Aalto wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> > Two possible improvements that are mutually incompatible would
> > be:
> >
> >  - refactor that part of the manual to be included in the pages
> >    for any and all commands that can take refname from the user;
> >    this is inpractical as almost all command would be affected.
> >
> >  - move that to more central place, say git(7), and everybody
> >    refer to that page;
> >
> > I'd personally prefer the latter, as "naming things" is such a
> > central thing for the use of the system (this applies to the
> > description of "SHA-1 expression" that we curently have in
> > git-rev-parse(1) as well) and it is better for users to have
> > understanding of such fundamental syntaxes and concepts before
> > even using any individual commands.
> 
> Wholeheartedly concur.

Sounds good to me too, but...

> Should I re-submit the patch to refer to git(7) instead?

... git(7) is pretty long, so finding the referred-to information in
that man page might take a while.  Would it be possible to put this in a
(section 7?) man page of its own?

--b.

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

end of thread, other threads:[~2007-08-26 22:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-26 15:28 [PATCH] Improve error message: not a valid branch name Jari Aalto
2007-08-26 21:26 ` Junio C Hamano
2007-08-26 22:09   ` Jari Aalto
2007-08-26 22:25     ` J. Bruce Fields

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 NNTP newsgroup(s).