threads / patch / 30180

patchremote: update builtin usage

Subject: [PATCH] remote: update builtin usage

## tl;dr

2 messages between Apr 7, 2012 and Apr 9, 2012. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Michael Schubert· Apr 7, 2012, 14:25 UTC · lore
Add missing options "--tags|--no-tags" and "--push".
Signed-off-by: Michael Schubert <mschub@elegosoft.com>
---
 builtin/remote.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Show changes to builtin/remote.c +2 −2
diff --git a/builtin/remote.c b/builtin/remote.c
index fec92bc..b5645fe 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -9,7 +9,7 @@
 
 static const char * const builtin_remote_usage[] = {
 	"git remote [-v | --verbose]",
-	"git remote add [-t <branch>] [-m <master>] [-f] [--mirror=<fetch|push>] <name> <url>",
+	"git remote add [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>",
 	"git remote rename <old> <new>",
 	"git remote rm <name>",
 	"git remote set-head <name> (-a | -d | <branch>)",
@@ -17,7 +17,7 @@ static const char * const builtin_remote_usage[] = {
 	"git remote prune [-n | --dry-run] <name>",
 	"git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]",
 	"git remote set-branches [--add] <name> <branch>...",
-	"git remote set-url <name> <newurl> [<oldurl>]",
+	"git remote set-url [--push] <name> <newurl> [<oldurl>]",
 	"git remote set-url --add <name> <newurl>",
 	"git remote set-url --delete <name> <url>",
 	NULL
-- 
1.7.10.dirty
Junio C Hamano· Apr 9, 2012, 22:06 UTC · re: Michael Schubert · lore

Re: [PATCH] remote: update builtin usage

Michael Schubert <mschub@elegosoft.com> writes:
Show 29 quoted lines
> Add missing options "--tags|--no-tags" and "--push".
>
> Signed-off-by: Michael Schubert <mschub@elegosoft.com>
> ---
>  builtin/remote.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/remote.c b/builtin/remote.c
> index fec92bc..b5645fe 100644
> --- a/builtin/remote.c
> +++ b/builtin/remote.c
> @@ -9,7 +9,7 @@
>  
>  static const char * const builtin_remote_usage[] = {
>  	"git remote [-v | --verbose]",
> -	"git remote add [-t <branch>] [-m <master>] [-f] [--mirror=<fetch|push>] <name> <url>",
> +	"git remote add [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>",
>  	"git remote rename <old> <new>",
>  	"git remote rm <name>",
>  	"git remote set-head <name> (-a | -d | <branch>)",
> @@ -17,7 +17,7 @@ static const char * const builtin_remote_usage[] = {
>  	"git remote prune [-n | --dry-run] <name>",
>  	"git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]",
>  	"git remote set-branches [--add] <name> <branch>...",
> -	"git remote set-url <name> <newurl> [<oldurl>]",
> +	"git remote set-url [--push] <name> <newurl> [<oldurl>]",
>  	"git remote set-url --add <name> <newurl>",
>  	"git remote set-url --delete <name> <url>",
>  	NULL

Hrm. While this may not be _wrong_ per-se, it strikes me odd that builtin_remote_usage[] is more or less a superset of the subcommand specific usage text, e.g. builtin_remote_seturl_usage[], etc., but still need to be manually defined like this. That always leaves a risk that the descriptions would drift apart between the two places.

For example, builtin_remote_setbranches_usage[] has these two:
static const char * const builtin_remote_setbranches_usage[] = {
        "git remote set-branches <name> <branch>...",
        "git remote set-branches --add <name> <branch>...",
	NULL
};
where the above has only one, with an optional "[--add]".
There must be a better way to do this.

← back to recent threads