git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v2] git-send-pack: Fix --all option when used with directory
@ 2016-03-24 14:14 Stanislav Kolotinskiy
  2016-03-24 14:17 ` Stanislav Kolotinskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Stanislav Kolotinskiy @ 2016-03-24 14:14 UTC (permalink / raw
  To: git; +Cc: peff, dborowitz, Stanislav Kolotinskiy

---
 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.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] git-send-pack: Fix --all option when used with directory
  2016-03-24 14:14 [PATCH v2] git-send-pack: Fix --all option when used with directory Stanislav Kolotinskiy
@ 2016-03-24 14:17 ` Stanislav Kolotinskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Stanislav Kolotinskiy @ 2016-03-24 14:17 UTC (permalink / raw
  To: git

Please ignore this thread, I sent the email without making sure that I 
copied commit message. I'm sorry for that.

On 24/03/16 16:14, Stanislav Kolotinskiy wrote:
> ---
>   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 &&
>   	(

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-24 14:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-24 14:14 [PATCH v2] git-send-pack: Fix --all option when used with directory Stanislav Kolotinskiy
2016-03-24 14:17 ` Stanislav Kolotinskiy

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).