# [PATCH] Fix worktree usage message

6 messages from 2015-10-18 to 2015-10-19. Participants: Sidhant Sharma, Kevin Daudt, Eric Sunshine, Junio C Hamano.
Thread: https://gitlist.dev/t/40585

## Sidhant Sharma, 2015-10-18 11:02

Subject: [PATCH] Fix worktree usage message
Message-ID: <1445166144-29509-1-git-send-email-tigerkid001@gmail.com>
URL: https://gitlist.dev/e/1445166144-29509-1-git-send-email-tigerkid001%40gmail.com

```
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(-)

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, 2015-10-18 11:39

Subject: Re: [PATCH] Fix worktree usage message
Message-ID: <20151018113902.GA12622@ikke.info>
URL: https://gitlist.dev/e/20151018113902.GA12622%40ikke.info
In-Reply-To: <1445166144-29509-1-git-send-email-tigerkid001@gmail.com>

```


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.


> 
> ---
>  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, 2015-10-18 12:15

Subject: [PATCH] Fix worktree usage message
Message-ID: <1445170530-31573-1-git-send-email-tigerkid001@gmail.com>
URL: https://gitlist.dev/e/1445170530-31573-1-git-send-email-tigerkid001%40gmail.com
In-Reply-To: <20151018113902.GA12622@ikke.info>

```
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(-)

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, 2015-10-18 16:51

Subject: Re: [PATCH] Fix worktree usage message
Message-ID: <CAPig+cRXq9qonwPpWQdnrFkJgQQW0zDokXQhSvw5n07d7OpqdQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcRXq9qonwPpWQdnrFkJgQQW0zDokXQhSvw5n07d7OpqdQ%40mail.gmail.com
In-Reply-To: <1445170530-31573-1-git-send-email-tigerkid001@gmail.com>

```
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.

> ---
> 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, 2015-10-19 04:44

Subject: [PATCH] worktree: usage: denote <branch> as optional with 'add'
Message-ID: <1445229893-4179-1-git-send-email-tigerkid001@gmail.com>
URL: https://gitlist.dev/e/1445229893-4179-1-git-send-email-tigerkid001%40gmail.com
In-Reply-To: <CAPig+cRXq9qonwPpWQdnrFkJgQQW0zDokXQhSvw5n07d7OpqdQ@mail.gmail.com>

```
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(-)

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, 2015-10-19 06:35

Subject: Re: [PATCH] worktree: usage: denote <branch> as optional with 'add'
Message-ID: <xmqqr3kr9xh1.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqr3kr9xh1.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <1445229893-4179-1-git-send-email-tigerkid001@gmail.com>

```
Sidhant Sharma <tigerkid001@gmail.com> writes:

> 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.

>  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

```
