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

Re: [PATCH] push: give early feedback

From
Fredrik Gustafsson <iveqy@iveqy.com>
Date
Jun 24, 2013, 18:04 UTC
Message-ID
<20130624180419.GC26287@paksenarrion.iveqy.com>
In-Reply-To
<1372095662-24527-1-git-send-email-artagnon@gmail.com>
On Mon, Jun 24, 2013 at 11:11:02PM +0530, Ramkumar Ramachandra wrote:
Show 36 quoted lines
> There are many configuration variables that determine exactly what a
> push does.  Give the user early feedback so that she has a chance to
> abort if she doesn't mean to push those refspecs to that destination
> like:
> 
>   $ git push
>   # pushing refspecs 'master next' to ram (^C to abort)
> 
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  Goes without saying: this is an early preview.
> 
>  builtin/push.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/builtin/push.c b/builtin/push.c
> index 2d84d10..085d5ab 100644
> --- a/builtin/push.c
> +++ b/builtin/push.c
> @@ -330,6 +330,7 @@ static int do_push(const char *repo, int flags)
>  {
>  	int i, errs;
>  	struct remote *remote = pushremote_get(repo);
> +	struct strbuf sb = STRBUF_INIT;
>  	const char **url;
>  	int url_nr;
>  
> @@ -375,6 +376,11 @@ static int do_push(const char *repo, int flags)
>  	}
>  	errs = 0;
>  	url_nr = push_url_of_remote(remote, &url);
> +
> +	for (i = 0; i < refspec_nr; i++)
> +		strbuf_addf(&sb, "%s%s", refspec[i], i == refspec_nr - 1 ? "": " ");
> +	printf("# pushing refspecs '%s' to %s (^C to abort)\n", sb.buf, remote->name);
> +
How about a strbuf_release here?
Can you really be sure that refspec_nr is set here?
Show 5 quoted lines
>  	if (url_nr) {
>  		for (i = 0; i < url_nr; i++) {
>  			struct transport *transport =
> -- 
> 1.8.3.1.549.g1f3a412.dirty
-- 
Med vänliga hälsningar
Fredrik Gustafsson

tel: 0733-608274
e-post: iveqy@iveqy.com
Previous: Ramkumar RamachandraNext: Junio C Hamano
Message 2 of 8 in “push: give early feedback”
  1. push: give early feedbackRamkumar Ramachandra, Jun 24, 2013
  2. Fredrik GustafssonJun 24, 2013
  3. Junio C HamanoJun 24, 2013
  4. Jeff KingJun 24, 2013
  5. Ramkumar RamachandraJun 24, 2013
  6. Jeff KingJun 24, 2013
  7. Ramkumar RamachandraJun 24, 2013
  8. Jeff KingJun 24, 2013

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.