git-send-pack: fix --all option when used with directory
commitc6777563cd2b3e1d1989732c3daf05a72fddb068
authorStanislav Kolotinskiy <stanislav@assembla.com>
Thu, 31 Mar 2016 13:55:09 +0000 (31 16:55 +0300)
committerJunio C Hamano <gitster@pobox.com>
Thu, 31 Mar 2016 21:58:26 +0000 (31 14:58 -0700)
tree28a0b6564a1bdc68ffa112714ea5bf4358c87e47
parent68c757f2199911005918aba45aa8ae0fecc72074
git-send-pack: fix --all option when used with directory

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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/send-pack.c
t/t5400-send-pack.sh