On Tue, Apr 23, 2019 at 10:30:56AM -0700, Elijah Newren wrote:
> diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c
> index f3353564f9..cfbd5c36c7 100644
> --- a/builtin/pack-refs.c
> +++ b/builtin/pack-refs.c
> @@ -1,4 +1,5 @@
> #include "builtin.h"
> +#include "config.h"
> #include "parse-options.h"
> #include "refs.h"
> #include "repository.h"
> @@ -16,6 +17,7 @@ int cmd_pack_refs(int argc, const char **argv, const char
> *prefix)
> OPT_BIT(0, "prune", &flags, N_("prune loose refs (default)"),
> PACK_REFS_PRUNE),
> OPT_END(),
> };
> + git_config(git_default_config, NULL);
> if (parse_options(argc, argv, prefix, opts, pack_refs_usage, 0))
> usage_with_options(pack_refs_usage, opts);
> return refs_pack_refs(get_main_ref_store(the_repository), flags);
I coincidentally just wrote the same patch (working off a branch of
v2.21, so I didn't yet have your fix here). Just for the record, this
fixes other bugs, too!
Mine was:
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index 9ea5fa4fd2..07d09ac67a 100755
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
@@ -253,4 +253,13 @@ test_expect_success SYMLINKS 'pack symlinked packed-refs' '
test "$(readlink .git/packed-refs)" = "my-deviant-packed-refs"
'
+test_expect_success 'pack-refs respects core.useReplaceRefs' '
+ # this is broken because the object refers to itself
+ commit=$(git rev-parse HEAD) &&
+ test_when_finished "git update-ref -d refs/replace/$commit" &&
+ git update-ref refs/replace/$commit $commit &&
+ test_must_fail git pack-refs --all &&
+ git -c core.useReplaceRefs=false pack-refs --all
+'
+
test_done
It's probably not worth adding the test independently, but I thought I'd
throw it out here for the benefit of the list archive.
-Peff