aboutsummaryrefslogtreecommitdiffstats
path: root/t/helper
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-06-13 12:29:45 -0700
committerJunio C Hamano <gitster@pobox.com>2023-06-13 12:29:45 -0700
commitcbc882ea388143bd6bbed139f97f67589777be60 (patch)
tree31f750427a978f17391c2be83e836d28b25fdee0 /t/helper
parentebd07c9f7e5d56fbe9d5816db95ecf137ed447ea (diff)
parent4fe42f326e10a547dc65dfe9e5ceaeeee02b98db (diff)
downloadgit-cbc882ea388143bd6bbed139f97f67589777be60.tar.gz
Merge branch 'jc/pack-ref-exclude-include'
"git pack-refs" learns "--include" and "--exclude" to tweak the ref hierarchy to be packed using pattern matching. * jc/pack-ref-exclude-include: pack-refs: teach pack-refs --include option pack-refs: teach --exclude option to exclude refs from being packed docs: clarify git-pack-refs --all will pack all refs
Diffstat (limited to 't/helper')
-rw-r--r--t/helper/test-ref-store.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index 6d8f844e9c..a6977b5e83 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -5,6 +5,7 @@
#include "worktree.h"
#include "object-store.h"
#include "repository.h"
+#include "revision.h"
struct flag_definition {
const char *name;
@@ -116,8 +117,16 @@ static struct flag_definition pack_flags[] = { FLAG_DEF(PACK_REFS_PRUNE),
static int cmd_pack_refs(struct ref_store *refs, const char **argv)
{
unsigned int flags = arg_flags(*argv++, "flags", pack_flags);
+ static struct ref_exclusions exclusions = REF_EXCLUSIONS_INIT;
+ static struct string_list included_refs = STRING_LIST_INIT_NODUP;
+ struct pack_refs_opts pack_opts = { .flags = flags,
+ .exclusions = &exclusions,
+ .includes = &included_refs };
- return refs_pack_refs(refs, flags);
+ if (pack_opts.flags & PACK_REFS_ALL)
+ string_list_append(pack_opts.includes, "*");
+
+ return refs_pack_refs(refs, &pack_opts);
}
static int cmd_create_symref(struct ref_store *refs, const char **argv)