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
This commit is contained in:
Junio C Hamano
2012-05-23 13:35:22 -07:00
2 changed files with 6 additions and 13 deletions

View File

@ -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;
const char *colon = strchr(name, ':');
int refnamelen = colon ? colon - name : strlen(name);
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);
if (!dwim_ref(name, refnamelen, sha1, &ref))
die("no such ref: %.*s", refnamelen, name);
free(ref);
}