Merge branch 'jk/maint-upload-archive'
authorJunio C Hamano <gitster@pobox.com>
Fri, 13 Jan 2012 07:34:17 +0000 (23:34 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 Jan 2012 07:34:17 +0000 (23:34 -0800)
* jk/maint-upload-archive:
archive: re-allow HEAD:Documentation on a remote invocation

1  2 
archive.c
diff --combined archive.c
index 164bbd014a82feac48886db6f27ba85d61a059ac,a348480b26500f616b9ad6f6bdef7b06d5ffdf7b..1ee837d7170cfa52da6725cfe7c5ae0d6d67462e
+++ 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),
                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",