Skip to content

Commit ed12124

Browse files
pks-tgitster
authored andcommitted
t/helper: drop pack-refs wrapper
The test helper provides a "ref-store <store> pack-refs" wrapper that more or less directly invokes `refs_pack_refs()`. This helper is only used in a single test with the "PACK_REFS_PRUNE" and "PACK_REFS_ALL" flags. Both of these flags can directly be accessed via git-pack-refs(1) though via the `--all` and `--prune` flags, which makes the helper superfluous. Refactor the test to use git-pack-refs(1) instead of the test helper. Drop the now-unused test helper command. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4ccf706 commit ed12124

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

t/helper/test-ref-store.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -112,25 +112,6 @@ static const char **get_store(const char **argv, struct ref_store **refs)
112112
return argv + 1;
113113
}
114114

115-
static struct flag_definition pack_flags[] = { FLAG_DEF(PACK_REFS_PRUNE),
116-
FLAG_DEF(PACK_REFS_ALL),
117-
{ NULL, 0 } };
118-
119-
static int cmd_pack_refs(struct ref_store *refs, const char **argv)
120-
{
121-
unsigned int flags = arg_flags(*argv++, "flags", pack_flags);
122-
static struct ref_exclusions exclusions = REF_EXCLUSIONS_INIT;
123-
static struct string_list included_refs = STRING_LIST_INIT_NODUP;
124-
struct pack_refs_opts pack_opts = { .flags = flags,
125-
.exclusions = &exclusions,
126-
.includes = &included_refs };
127-
128-
if (pack_opts.flags & PACK_REFS_ALL)
129-
string_list_append(pack_opts.includes, "*");
130-
131-
return refs_pack_refs(refs, &pack_opts);
132-
}
133-
134115
static int cmd_create_symref(struct ref_store *refs, const char **argv)
135116
{
136117
const char *refname = notnull(*argv++, "refname");
@@ -326,7 +307,6 @@ struct command {
326307
};
327308

328309
static struct command commands[] = {
329-
{ "pack-refs", cmd_pack_refs },
330310
{ "create-symref", cmd_create_symref },
331311
{ "delete-refs", cmd_delete_refs },
332312
{ "rename-ref", cmd_rename_ref },

t/t0601-reffiles-pack-refs.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,16 @@ test_expect_success 'prepare a trivial repository' '
3232
HEAD=$(git rev-parse --verify HEAD)
3333
'
3434

35-
test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '
36-
N=`find .git/refs -type f | wc -l` &&
35+
test_expect_success 'pack-refs --prune --all' '
36+
test_path_is_missing .git/packed-refs &&
37+
git pack-refs --no-prune --all &&
38+
test_path_is_file .git/packed-refs &&
39+
N=$(find .git/refs -type f | wc -l) &&
3740
test "$N" != 0 &&
38-
test-tool ref-store main pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL &&
39-
N=`find .git/refs -type f` &&
41+
42+
git pack-refs --prune --all &&
43+
test_path_is_file .git/packed-refs &&
44+
N=$(find .git/refs -type f) &&
4045
test -z "$N"
4146
'
4247

0 commit comments

Comments
 (0)