Re: [RFC PATCH 1/1] push: introduce '--heads' option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Teng Long <dyroneteng@xxxxxxxxx> 于2022年12月5日周一 21:44写道:
>
> From: Teng Long <dyroneteng@xxxxxxxxx>
>
> The '--all' option of git-push built-in cmd support to push all branches
> (refs under refs/heads) to remote. Under the usage, a user can easlily
> work in some scenarios, for example, branches synchronization and batch
> upload.
>
> '--all' was introduced for a long time, meanwhile, git supports to
> customize the storage location under "refs/". when a new git user see
> the usage like, 'git push origin --all', we might feel like we're
> pushing _all_ the refs instead of just branches without looking at the
> documents until we found the related description of it or '--mirror'.
>

"--all" sounds like it will include all things: branches, tags, but it only
includes branches under ref/heads/, which does cause a little confusion
for users.

> To ensure compatibility, we cannot rename '--all' to another name
> directly, one way is, we can try to add a new option '--heads' which be
> identical with the functionality of '--all' to let the user understand
> the meaning of representation more clearly. Actually, We've more or less
> named options this way already, for example, in 'git-show-ref' and 'git
> ls-remote'.
>
> At the same time, we fix a related issue about the wrong help
> information of '--all' option in code.
>
> Signed-off-by: Teng Long <dyroneteng@xxxxxxxxx>
> ---
>  Documentation/git-push.txt |  1 +
>  builtin/push.c             | 13 +++++++------
>  t/t5523-push-upstream.sh   | 19 ++++++++++++-------
>  3 files changed, 20 insertions(+), 13 deletions(-)
>
> diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
> index 5bb1d5aae25..a5d18fb90b6 100644
> --- a/Documentation/git-push.txt
> +++ b/Documentation/git-push.txt
> @@ -147,6 +147,7 @@ already exists on the remote side.
>  `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.
>
>  --all::
> +--heads::
>         Push all branches (i.e. refs under `refs/heads/`); cannot be
>         used with other <refspec>.
>
> diff --git a/builtin/push.c b/builtin/push.c
> index 60ac8017e52..970cabaa78b 100644
> --- a/builtin/push.c
> +++ b/builtin/push.c
> @@ -588,11 +588,12 @@ int cmd_push(int argc, const char **argv, const char *prefix)
>         struct option options[] = {
>                 OPT__VERBOSITY(&verbosity),
>                 OPT_STRING( 0 , "repo", &repo, N_("repository"), N_("repository")),
> -               OPT_BIT( 0 , "all", &flags, N_("push all refs"), TRANSPORT_PUSH_ALL),
> +               OPT_BIT( 0 , "all", &flags, N_("push all branches"), TRANSPORT_PUSH_ALL),
> +               OPT_BIT( 0 , "heads", &flags, N_("push all branches"), TRANSPORT_PUSH_ALL),

Maybe OPT_ALIAS() will be better?




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux