Why didn't we mark want_obj as ~UNINTERESTING in the old code?
[gitweb.git] / builtin-pack-refs.c
index 23d0d0720e2e617b9a4187ac1ba37b2605e4a940..042d2718f904303600a57cfe8b5de83f5c0d34db 100644 (file)
@@ -2,7 +2,7 @@
 #include "refs.h"
 
 static const char builtin_pack_refs_usage[] =
-"git-pack-refs [--prune]";
+"git-pack-refs [--all] [--prune]";
 
 struct ref_to_prune {
        struct ref_to_prune *next;
@@ -12,6 +12,7 @@ struct ref_to_prune {
 
 struct pack_refs_cb_data {
        int prune;
+       int all;
        struct ref_to_prune *ref_to_prune;
        FILE *refs_file;
 };
@@ -29,6 +30,8 @@ static int handle_one_ref(const char *path, const unsigned char *sha1,
 {
        struct pack_refs_cb_data *cb = cb_data;
 
+       if (!cb->all && strncmp(path, "refs/tags/", 10))
+               return 0;
        /* Do not pack the symbolic refs */
        if (!(flags & REF_ISSYMREF))
                fprintf(cb->refs_file, "%s %s\n", sha1_to_hex(sha1), path);
@@ -77,6 +80,10 @@ int cmd_pack_refs(int argc, const char **argv, const char *prefix)
                        cbdata.prune = 1;
                        continue;
                }
+               if (!strcmp(arg, "--all")) {
+                       cbdata.all = 1;
+                       continue;
+               }
                /* perhaps other parameters later... */
                break;
        }