All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/5] Call send-pack with --remote option
@ 2007-04-28 17:05 Daniel Barkalow
  2007-04-29  5:51 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Barkalow @ 2007-04-28 17:05 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

When calling send-pack from git-push, use the --remote option when
appropriate.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 builtin-push.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/builtin-push.c b/builtin-push.c
index 2e944cd..d4734be 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -158,7 +158,7 @@ static int do_push(const char *repo)
 		refspec = remote->push_refspec;
 	}
 
-	argv = xmalloc((refspec_nr + 10) * sizeof(char *));
+	argv = xmalloc((refspec_nr + 11) * sizeof(char *));
 	argv[0] = "dummy-send-pack";
 	argc = 1;
 	if (all)
@@ -180,8 +180,13 @@ static int do_push(const char *repo)
 		if (!prefixcmp(dest, "http://") ||
 		    !prefixcmp(dest, "https://"))
 			sender = "http-push";
-		else if (thin)
-			argv[dest_argc++] = "--thin";
+		else {
+			char *rem = xmalloc(strlen(remote->name) + 10);
+			sprintf(rem, "--remote=%s", remote->name);
+			argv[dest_argc++] = rem;
+			if (thin)
+				argv[dest_argc++] = "--thin";
+		}
 		argv[0] = sender;
 		argv[dest_argc++] = dest;
 		while (dest_refspec_nr--)
-- 
1.5.1.2.255.g6ead4-dirty

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

* Re: [PATCH 5/5] Call send-pack with --remote option
  2007-04-28 17:05 [PATCH 5/5] Call send-pack with --remote option Daniel Barkalow
@ 2007-04-29  5:51 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2007-04-29  5:51 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: git

Daniel Barkalow <barkalow@iabervon.org> writes:

> diff --git a/builtin-push.c b/builtin-push.c
> index 2e944cd..d4734be 100644
> --- a/builtin-push.c
> +++ b/builtin-push.c
> @@ -158,7 +158,7 @@ static int do_push(const char *repo)
>  		refspec = remote->push_refspec;
>  	}
>  
> -	argv = xmalloc((refspec_nr + 10) * sizeof(char *));
> +	argv = xmalloc((refspec_nr + 11) * sizeof(char *));
>  	argv[0] = "dummy-send-pack";
>  	argc = 1;
>  	if (all)

I somehow thought this 10 was there not because we counted but
we know 10 gives us enough slop.  Adding one because we give an
extra parameter, while it is logically correct, feels somewhat
funny.  But I do not have a better suggestion (unless we count
exactly which we cannot do).

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

end of thread, other threads:[~2007-04-29  5:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-28 17:05 [PATCH 5/5] Call send-pack with --remote option Daniel Barkalow
2007-04-29  5:51 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.