diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-05-23 13:35:22 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-05-23 13:35:22 -0700 |
commit | b83cfa5949081c32a13b84e8aeea7d2cb7a96331 (patch) | |
tree | ab7d7cc080ea030b18f9110013f140cb3a656b14 /archive.c | |
parent | 8d19426f985afdf4cc34f88198226964566dcdc1 (diff) | |
parent | bf38245be8f481ac1c08a98951b7fd00bbfc15ea (diff) | |
download | git-b83cfa5949081c32a13b84e8aeea7d2cb7a96331.tar.gz |
Merge branch 'rs/archive-tree-in-tip-simplify'
By René Scharfe
* rs/archive-tree-in-tip-simplify:
archive-tar: keep const in checksum calculation
archive: simplify refname handling
Diffstat (limited to 'archive.c')
-rw-r--r-- | archive.c | 17 |
1 files changed, 5 insertions, 12 deletions
@@ -254,18 +254,11 @@ static void parse_treeish_arg(const char **argv, /* Remotes are only allowed to fetch actual refs */ if (remote) { char *ref = NULL; - const char *refname, *colon = NULL; - - colon = strchr(name, ':'); - if (colon) - refname = xstrndup(name, colon - name); - else - refname = name; - - if (!dwim_ref(refname, strlen(refname), sha1, &ref)) - die("no such ref: %s", refname); - if (refname != name) - free((void *)refname); + const char *colon = strchr(name, ':'); + int refnamelen = colon ? colon - name : strlen(name); + + if (!dwim_ref(name, refnamelen, sha1, &ref)) + die("no such ref: %.*s", refnamelen, name); free(ref); } |