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

Re: [PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Sep 27, 2013, 14:25 UTC
Message-ID
<52459570.4030301@viscovery.net>
In-Reply-To
<1380283828-25420-4-git-send-email-artagnon@gmail.com>
Am 9/27/2013 14:10, schrieb Ramkumar Ramachandra:
Show 20 quoted lines
> +			else if (!strcmp(formatp, "track") &&
> +				!prefixcmp(name, "upstream")) {
> +				char buf[40];
> +
> +				if (!upstream_present)
> +					continue;
> +				stat_tracking_info(branch, &num_ours, &num_theirs);
> +				if (!num_ours && !num_theirs)
> +					v->s = "";
> +				else if (!num_ours) {
> +					sprintf(buf, "[behind %d]", num_theirs);
> +					v->s = xstrdup(buf);
> +				} else if (!num_theirs) {
> +					sprintf(buf, "[ahead %d]", num_ours);
> +					v->s = xstrdup(buf);
> +				} else {
> +					sprintf(buf, "[ahead %d, behind %d]",
> +						num_ours, num_theirs);
> +					v->s = xstrdup(buf);
> +				}
These strdupped strings are leaked, right?
Show 20 quoted lines
> +				continue;
> +			} else if (!strcmp(formatp, "trackshort") &&
> +				!prefixcmp(name, "upstream")) {
> +				if (!upstream_present)
> +					continue;
> +				stat_tracking_info(branch, &num_ours, &num_theirs);
> +				if (!num_ours && !num_theirs)
> +					v->s = "=";
> +				else if (!num_ours)
> +					v->s = "<";
> +				else if (!num_theirs)
> +					v->s = ">";
> +				else
> +					v->s = "<>";
> +				continue;
> +			} else
>  				die("unknown %.*s format %s",
>  				    (int)(formatp - name), name, formatp);
>  		}
> 
-- Hannes
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 8 of 13 in “Juggling between hot branches”
  1. 0/3 Juggling between hot branchesRamkumar Ramachandra, Sep 27, 2013
  2. 1/3 for-each-ref: introduce %C(...) for colorRamkumar Ramachandra, Sep 27, 2013
  3. Phil HordSep 27, 2013
  4. 2/3 for-each-ref: introduce %(HEAD) asterisk markerRamkumar Ramachandra, Sep 27, 2013
  5. 3/3 for-each-ref: introduce %(upstream:track[short])Ramkumar Ramachandra, Sep 27, 2013
  6. Phil HordSep 27, 2013
  7. Ramkumar RamachandraSep 27, 2013
  8. Johannes SixtSep 27, 2013
  9. Ramkumar RamachandraSep 27, 2013
  10. Jonathan NiederSep 27, 2013
  11. Philip OakleySep 27, 2013
  12. Ramkumar RamachandraSep 27, 2013
  13. Philip OakleySep 27, 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.