From: Junio C Hamano Date: Fri, 13 Jan 2012 07:34:17 +0000 (-0800) Subject: Merge branch 'jk/maint-upload-archive' X-Git-Tag: v1.7.9-rc1~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/bdb8cb52962522e5444241242110780fc6a19c4f?ds=inline;hp=-c Merge branch 'jk/maint-upload-archive' * jk/maint-upload-archive: archive: re-allow HEAD:Documentation on a remote invocation --- bdb8cb52962522e5444241242110780fc6a19c4f diff --combined archive.c index 164bbd014a,a348480b26..1ee837d717 --- a/archive.c +++ b/archive.c @@@ -260,14 -260,23 +260,23 @@@ static void parse_treeish_arg(const cha /* 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) { @@@ -328,7 -337,7 +337,7 @@@ static int parse_archive_args(int argc "prepend prefix to each pathname in the archive"), OPT_STRING('o', "output", &output, "file", "write the archive to this file"), - OPT_BOOLEAN(0, "worktree-attributes", &worktree_attributes, + OPT_BOOL(0, "worktree-attributes", &worktree_attributes, "read .gitattributes in working directory"), OPT__VERBOSE(&verbose, "report archived files on stderr"), OPT__COMPR('0', &compression_level, "store only", 0), @@@ -342,7 -351,7 +351,7 @@@ OPT__COMPR_HIDDEN('8', &compression_level, 8), OPT__COMPR('9', &compression_level, "compress better", 9), OPT_GROUP(""), - OPT_BOOLEAN('l', "list", &list, + OPT_BOOL('l', "list", &list, "list supported archive formats"), OPT_GROUP(""), OPT_STRING(0, "remote", &remote, "repo",