threads / patch / 40585

patchFix worktree usage message

Subject: [PATCH] Fix worktree usage message

## tl;dr

6 messages between Oct 18, 2015 and Oct 19, 2015. Diffs are folded; open one to read it.

replies: 5people: 4as markdown or json

Sidhant Sharma· Oct 18, 2015, 11:02 UTC · lore
Mark <branch> as optional in worktree command line usage.

Hi, just starting out with development for Git. Found this one super easy to fix, so made a patch :)

---
 builtin/worktree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to builtin/worktree.c +1 −2
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 71bb770..33d2d37 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -10,7 +10,7 @@
 #include "refs.h"

 static const char * const worktree_usage[] = {
-	N_("git worktree add [<options>] <path> <branch>"),
+	N_("git worktree add [<options>] <path> [<branch>]"),
 	N_("git worktree prune [<options>]"),
 	NULL
 };
--
2.6.2
Kevin Daudt· Oct 18, 2015, 11:39 UTC · re: Sidhant Sharma · lore

Re: [PATCH] Fix worktree usage message

On Sun, Oct 18, 2015 at 04:32:24PM +0530, Sidhant Sharma wrote:
> Mark <branch> as optional in worktree command line usage.
Thank you for the patch. 

Can you also explain why you mark it as optional in the commit message? That way it's clear why this patch is needed.

> 
> Hi, just starting out with development for Git. Found this one super easy to fix,
> so made a patch :)

These kind of comments don't belong in the commit message. You could add them below the first three ---. That way, they will not be part of the commit history.

Show 24 quoted lines
> 
> ---
>  builtin/worktree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/builtin/worktree.c b/builtin/worktree.c
> index 71bb770..33d2d37 100644
> --- a/builtin/worktree.c
> +++ b/builtin/worktree.c
> @@ -10,7 +10,7 @@
>  #include "refs.h"
> 
>  static const char * const worktree_usage[] = {
> -	N_("git worktree add [<options>] <path> <branch>"),
> +	N_("git worktree add [<options>] <path> [<branch>]"),
>  	N_("git worktree prune [<options>]"),
>  	NULL
>  };
> --
> 2.6.2
> --
> 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
Sidhant Sharma· Oct 18, 2015, 12:15 UTC · re: Kevin Daudt · lore
Mark <branch> optional in worktree command line usage to maintain consistency with man pages.
Reported-by: ch3cooli@gmail.com
Signed-off-by: Sidhant Sharma <tigerkid001@gmail.com>
---
 It was reported here: http://marc.info/?l=git&m=144514145804787&w=2
 builtin/worktree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to builtin/worktree.c +1 −2
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 71bb770..33d2d37 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -10,7 +10,7 @@
 #include "refs.h"

 static const char * const worktree_usage[] = {
-	N_("git worktree add [<options>] <path> <branch>"),
+	N_("git worktree add [<options>] <path> [<branch>]"),
 	N_("git worktree prune [<options>]"),
 	NULL
 };
--
2.6.2
Eric Sunshine· Oct 18, 2015, 16:51 UTC · re: Sidhant Sharma · lore

Re: [PATCH] Fix worktree usage message

On Sun, Oct 18, 2015 at 8:15 AM, Sidhant Sharma <tigerkid001@gmail.com> wrote:
> Mark <branch> optional in worktree command line usage to maintain consistency with man pages.

Thanks for the patch. To clarify that it is the in-code usage string which is incorrect, rather than the man page, how about something like the following as commit message instead?

    worktree: usage: denote <branch> as optional with 'add'
    Although 1eb07d8 (worktree: add: auto-vivify new branch when
    <branch> is omitted, 2015-07-06) updated the documentation when
    <branch> became optional, it neglected to update the in-code
    usage message. Fix this oversight.
> Reported-by: ch3cooli@gmail.com
>
> Signed-off-by: Sidhant Sharma <tigerkid001@gmail.com>

Citing the reporter is a nice touch, but drop the blank line between it and the sign-off.

Show 16 quoted lines
> ---
> diff --git a/builtin/worktree.c b/builtin/worktree.c
> index 71bb770..33d2d37 100644
> --- a/builtin/worktree.c
> +++ b/builtin/worktree.c
> @@ -10,7 +10,7 @@
>  #include "refs.h"
>
>  static const char * const worktree_usage[] = {
> -       N_("git worktree add [<options>] <path> <branch>"),
> +       N_("git worktree add [<options>] <path> [<branch>]"),
>         N_("git worktree prune [<options>]"),
>         NULL
>  };
> --
> 2.6.2
Sidhant Sharma· Oct 19, 2015, 04:44 UTC · re: Eric Sunshine · lore

[PATCH] worktree: usage: denote <branch> as optional with 'add'

Although 1eb07d8 (worktree: add: auto-vivify new branch when <branch> is omitted, 2015-07-06) updated the documentation when <branch> became optional, it neglected to update the in-code usage message. Fix this oversight.

Reported-by: ch3cooli@gmail.com
Signed-off-by: Sidhant Sharma <tigerkid001@gmail.com>
---
 builtin/worktree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to builtin/worktree.c +1 −2
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 71bb770..33d2d37 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -10,7 +10,7 @@
 #include "refs.h"

 static const char * const worktree_usage[] = {
-	N_("git worktree add [<options>] <path> <branch>"),
+	N_("git worktree add [<options>] <path> [<branch>]"),
 	N_("git worktree prune [<options>]"),
 	NULL
 };
--
2.6.2
Junio C Hamano· Oct 19, 2015, 06:35 UTC · re: Sidhant Sharma · lore

Re: [PATCH] worktree: usage: denote <branch> as optional with 'add'

Sidhant Sharma <tigerkid001@gmail.com> writes:
Show 8 quoted lines
> Although 1eb07d8 (worktree: add: auto-vivify new branch when
> <branch> is omitted, 2015-07-06) updated the documentation when
> <branch> became optional, it neglected to update the in-code
> usage message. Fix this oversight.
>
> Reported-by: ch3cooli@gmail.com
> Signed-off-by: Sidhant Sharma <tigerkid001@gmail.com>
> ---
Thanks.

I'll add "Helped-by: Eric Sunshine <sunshine@sunshineco.com>" and queue.

Show 18 quoted lines
>  builtin/worktree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/worktree.c b/builtin/worktree.c
> index 71bb770..33d2d37 100644
> --- a/builtin/worktree.c
> +++ b/builtin/worktree.c
> @@ -10,7 +10,7 @@
>  #include "refs.h"
>
>  static const char * const worktree_usage[] = {
> -	N_("git worktree add [<options>] <path> <branch>"),
> +	N_("git worktree add [<options>] <path> [<branch>]"),
>  	N_("git worktree prune [<options>]"),
>  	NULL
>  };
> --
> 2.6.2

← back to recent threads