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

Re: [PATCH] archive: simplify refname handling

From
Junio C Hamano <gitster@pobox.com>
Date
May 18, 2012, 18:27 UTC
Message-ID
<xmqqwr492vl7.fsf@junio.mtv.corp.google.com>
In-Reply-To
<4FB5DAE5.6020307@lsrfire.ath.cx>
René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
Show 7 quoted lines
> +		const char *colon = strchr(name, ':');
> +		size_t refnamelen = colon ? colon - name : strlen(name);
> +
> +		if (!dwim_ref(name, refnamelen, sha1, &ref))
> +			die("no such ref: %.*s", refnamelen, name);
>  		free(ref);
>  	}

Both dwim_ref()'s second parameter the vararg that corresponds to the length part of "%.*s" in die(), expect "int", not "size_t", so I needed this to get it compile.

 archive.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/archive.c b/archive.c
index 081ecb5..1e7156d 100644
--- a/archive.c
+++ b/archive.c
@@ -261,7 +261,7 @@ static void parse_treeish_arg(const char **argv,
 	if (remote) {
 		char *ref = NULL;
 		const char *colon = strchr(name, ':');
-		size_t refnamelen = colon ? colon - name : strlen(name);
+		int refnamelen = colon ? colon - name : strlen(name);
 
 		if (!dwim_ref(name, refnamelen, sha1, &ref))
 			die("no such ref: %.*s", refnamelen, name);
Previous: Junio C Hamano
Message 5 of 5 in “archive: simplify refname handling”
  1. archive: simplify refname handlingRené Scharfe, May 18, 2012
  2. Jeff KingMay 18, 2012
  3. Carlos Martín NietoMay 18, 2012
  4. Junio C HamanoMay 18, 2012
  5. Junio C HamanoMay 18, 2012

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.