From c6777563cd2b3e1d1989732c3daf05a72fddb068 Mon Sep 17 00:00:00 2001 From: Stanislav Kolotinskiy Date: Thu, 31 Mar 2016 16:55:09 +0300 Subject: git-send-pack: fix --all option when used with directory When using git send-pack with --all option and a target repository specification ([:]), 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 Signed-off-by: Junio C Hamano --- builtin/send-pack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/send-pack.c b/builtin/send-pack.c index f6e5d643c1..19f0577fa0 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); -- cgit v1.2.1