builtin/rebase.c: make sure the active branch isn't moved when autostashing
[gitweb.git] / archive.c
index 92bc001545756472069cfd9ec8430ba81822743c..a8da0fcc4f0cc47e585b3b378109fbd84496ed15 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -380,7 +380,7 @@ static void parse_treeish_arg(const char **argv,
                int remote)
 {
        const char *name = argv[0];
-       const unsigned char *commit_sha1;
+       const struct object_id *commit_oid;
        time_t archive_time;
        struct tree *tree;
        const struct commit *commit;
@@ -402,10 +402,10 @@ static void parse_treeish_arg(const char **argv,
 
        commit = lookup_commit_reference_gently(ar_args->repo, &oid, 1);
        if (commit) {
-               commit_sha1 = commit->object.oid.hash;
+               commit_oid = &commit->object.oid;
                archive_time = commit->date;
        } else {
-               commit_sha1 = NULL;
+               commit_oid = NULL;
                archive_time = time(NULL);
        }
 
@@ -418,7 +418,9 @@ static void parse_treeish_arg(const char **argv,
                unsigned short mode;
                int err;
 
-               err = get_tree_entry(&tree->object.oid, prefix, &tree_oid,
+               err = get_tree_entry(ar_args->repo,
+                                    &tree->object.oid,
+                                    prefix, &tree_oid,
                                     &mode);
                if (err || !S_ISDIR(mode))
                        die(_("current working directory is untracked"));
@@ -426,7 +428,7 @@ static void parse_treeish_arg(const char **argv,
                tree = parse_tree_indirect(&tree_oid);
        }
        ar_args->tree = tree;
-       ar_args->commit_sha1 = commit_sha1;
+       ar_args->commit_oid = commit_oid;
        ar_args->commit = commit;
        ar_args->time = archive_time;
 }