]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-pack-refs.c
Remove case-sensitive file in t3030-merge-recursive.
[thirdparty/git.git] / builtin-pack-refs.c
index 8dc5b9efffc3ad2cd56130155a94aa489d0d0b1b..d080e30d67a913529d46e0da169faa4b0be75580 100644 (file)
@@ -4,7 +4,7 @@
 #include "tag.h"
 
 static const char builtin_pack_refs_usage[] =
-"git-pack-refs [--all] [--prune]";
+"git-pack-refs [--all] [--prune | --no-prune]";
 
 struct ref_to_prune {
        struct ref_to_prune *next;
@@ -36,8 +36,10 @@ static int handle_one_ref(const char *path, const unsigned char *sha1,
        /* Do not pack the symbolic refs */
        if ((flags & REF_ISSYMREF))
                return 0;
-       is_tag_ref = !strncmp(path, "refs/tags/", 10);
-       if (!cb->all && !is_tag_ref)
+       is_tag_ref = !prefixcmp(path, "refs/tags/");
+
+       /* ALWAYS pack refs that were already packed or are tags */
+       if (!cb->all && !is_tag_ref && !(flags & REF_ISPACKED))
                return 0;
 
        fprintf(cb->refs_file, "%s %s\n", sha1_to_hex(sha1), path);
@@ -90,10 +92,15 @@ int cmd_pack_refs(int argc, const char **argv, const char *prefix)
 
        memset(&cbdata, 0, sizeof(cbdata));
 
+       cbdata.prune = 1;
        for (i = 1; i < argc; i++) {
                const char *arg = argv[i];
                if (!strcmp(arg, "--prune")) {
-                       cbdata.prune = 1;
+                       cbdata.prune = 1; /* now the default */
+                       continue;
+               }
+               if (!strcmp(arg, "--no-prune")) {
+                       cbdata.prune = 0;
                        continue;
                }
                if (!strcmp(arg, "--all")) {