#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;
struct pack_refs_cb_data {
int prune;
+ int all;
struct ref_to_prune *ref_to_prune;
FILE *refs_file;
};
{
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);
cbdata.prune = 1;
continue;
}
+ if (!strcmp(arg, "--all")) {
+ cbdata.all = 1;
+ continue;
+ }
/* perhaps other parameters later... */
break;
}
die("unable to create ref-pack file structure (%s)",
strerror(errno));
for_each_ref(handle_one_ref, &cbdata);
+ fflush(cbdata.refs_file);
fsync(fd);
fclose(cbdata.refs_file);
if (commit_lock_file(&packed) < 0)