git-p4: handle update of moved/copied files when updating a shelve
[gitweb.git] / archive.c
index 0a07b140fedd8fb1f14dd844dae9844641842c57..fd556c28e420732bbe625b68663f9099a5316f96 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -29,6 +29,12 @@ void register_archiver(struct archiver *ar)
        archivers[nr_archivers++] = ar;
 }
 
+void init_archivers(void)
+{
+       init_tar_archiver();
+       init_zip_archiver();
+}
+
 static void format_subst(const struct commit *commit,
                          const char *src, size_t len,
                          struct strbuf *buf)
@@ -110,7 +116,8 @@ static const struct attr_check *get_archive_attrs(struct index_state *istate,
        static struct attr_check *check;
        if (!check)
                check = attr_check_initl("export-ignore", "export-subst", NULL);
-       return git_check_attr(istate, path, check) ? NULL : check;
+       git_check_attr(istate, path, check);
+       return check;
 }
 
 static int check_attr_export_ignore(const struct attr_check *check)
@@ -391,7 +398,7 @@ static void parse_treeish_arg(const char **argv,
        if (get_oid(name, &oid))
                die("Not a valid object name");
 
-       commit = lookup_commit_reference_gently(the_repository, &oid, 1);
+       commit = lookup_commit_reference_gently(ar_args->repo, &oid, 1);
        if (commit) {
                commit_sha1 = commit->object.oid.hash;
                archive_time = commit->date;
@@ -530,9 +537,6 @@ int write_archive(int argc, const char **argv, const char *prefix,
        git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable);
        git_config(git_default_config, NULL);
 
-       init_tar_archiver();
-       init_zip_archiver();
-
        args.repo = repo;
        argc = parse_archive_args(argc, argv, &ar, &args, name_hint, remote);
        if (!startup_info->have_repository) {