git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4] git-send-pack: fix --all option when used with directory

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 31, 2016, 20:28 UTC
Message-ID
<xmqq1t6qmlxk.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1459432509-12934-1-git-send-email-stanislav@assembla.com>
stanislav@assembla.com writes:
Show 19 quoted lines
> From: Stanislav Kolotinskiy <stanislav@assembla.com>
>
> When using git send-pack with --all option
> and a target repository specification ([<host>:]<directory>),
> usage message is being displayed instead of performing
> the actual transmission.
>
> The reason for this issue is that destination and refspecs are being set
> in the same conditional and are populated from argv. When a target
> repository is passed, refspecs is being populated as well with its value.
> This makes the check for refspecs not being NULL to always return true,
> which, in conjunction with the check for --all or --mirror options,
> is always true as well and returns usage message instead of proceeding.
>
> This ensures that send-pack will stop execution only when --all
> or --mirror switch is used in conjunction with any refspecs passed.
>
> Signed-off-by: Stanislav Kolotinskiy <stanislav@assembla.com>
> ---
Thanks, will queue.
Show 42 quoted lines
>  builtin/send-pack.c  |  2 +-
>  t/t5400-send-pack.sh | 12 ++++++++++++
>  2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/send-pack.c b/builtin/send-pack.c
> index f6e5d64..19f0577 100644
> --- a/builtin/send-pack.c
> +++ b/builtin/send-pack.c
> @@ -225,7 +225,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
>  	 * --all and --mirror are incompatible; neither makes sense
>  	 * with any refspecs.
>  	 */
> -	if ((refspecs && (send_all || args.send_mirror)) ||
> +	if ((nr_refspecs > 0 && (send_all || args.send_mirror)) ||
>  	    (send_all && args.send_mirror))
>  		usage_with_options(send_pack_usage, options);
>
> diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
> index 04cea97..305ca7a 100755
> --- a/t/t5400-send-pack.sh
> +++ b/t/t5400-send-pack.sh
> @@ -128,6 +128,18 @@ test_expect_success 'denyNonFastforwards trumps --force' '
>  	test "$victim_orig" = "$victim_head"
>  '
>
> +test_expect_success 'send-pack --all sends all branches' '
> +	# make sure we have at least 2 branches with different
> +	# values, just to be thorough
> +	git branch other-branch HEAD^ &&
> +
> +	git init --bare all.git &&
> +	git send-pack --all all.git &&
> +	git for-each-ref refs/heads >expect &&
> +	git -C all.git for-each-ref refs/heads >actual &&
> +	test_cmp expect actual
> +'
> +
>  test_expect_success 'push --all excludes remote-tracking hierarchy' '
>  	mkdir parent &&
>  	(
> --
> 2.8.0
Previous: stanislav@assembla.comNext: Junio C Hamano
Message 2 of 6 in “git-send-pack: fix --all option when used with directory”
  1. git-send-pack: fix --all option when used with directorystanislav@assembla.com, Mar 31, 2016
  2. Junio C HamanoMar 31, 2016
  3. Junio C HamanoMar 31, 2016
  4. Eric SunshineMar 31, 2016
  5. Jeff KingMar 31, 2016
  6. Stanislav KolotinskiyApr 1, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.