diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-01-12 23:34:17 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-12 23:34:17 -0800 |
commit | bdb8cb52962522e5444241242110780fc6a19c4f (patch) | |
tree | 9ea9cf213a7d6d53544a565e91e79af22906e6ee /archive.c | |
parent | c4a01a3cbbd8b642a3ffc6bc550b68ac63d500ed (diff) | |
parent | 0f544ee897ac2cc760f29d3568cc4295ca69fd1f (diff) | |
download | git-bdb8cb52962522e5444241242110780fc6a19c4f.tar.gz |
Merge branch 'jk/maint-upload-archive'
* jk/maint-upload-archive:
archive: re-allow HEAD:Documentation on a remote invocation
Diffstat (limited to 'archive.c')
-rw-r--r-- | archive.c | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -260,14 +260,23 @@ static void parse_treeish_arg(const char **argv, /* Remotes are only allowed to fetch actual refs */ if (remote) { char *ref = NULL; - if (!dwim_ref(name, strlen(name), sha1, &ref)) - die("no such ref: %s", name); + 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); free(ref); } - else { - if (get_sha1(name, sha1)) - die("Not a valid object name"); - } + + if (get_sha1(name, sha1)) + die("Not a valid object name"); commit = lookup_commit_reference_gently(sha1, 1); if (commit) { |