diff --git a/Documentation/config.txt b/Documentation/config.txt index a32172a43c7369d0fff2a0a0ad32f6fde07149bf..bcf3d21ecb2aa7a2d78d5e9eca82fe1e4e88b5a9 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -911,6 +911,11 @@ core.commitGraph:: Enable git commit graph feature. Allows reading from the commit-graph file. +core.useReplaceRefs:: + If set to `false`, behave as if the `--no-replace-objects` + option was given on the command line. See linkgit:git[1] and + linkgit:git-replace[1] for more information. + core.sparseCheckout:: Enable "sparse checkout" feature. See section "Sparse checkout" in linkgit:git-read-tree[1] for more information. diff --git a/config.c b/config.c index 7968ef7566a1fc28c5d8e2ba99ae87c52fe23ece..5c6d8d17dd6d5321b28d6f4951c241d38b73af15 100644 --- a/config.c +++ b/config.c @@ -1347,6 +1347,11 @@ static int git_default_core_config(const char *var, const char *value) var, value); } + if (!strcmp(var, "core.usereplacerefs")) { + read_replace_refs = git_config_bool(var, value); + return 0; + } + /* Add other config variables here and to Documentation/config.txt. */ return 0; } diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh index aa3e24963967ba4be2394ceeab26f8317fb31b4b..86374a9c52c0bd26a8ba7223526c9e1f128f468a 100755 --- a/t/t6050-replace.sh +++ b/t/t6050-replace.sh @@ -113,6 +113,12 @@ test_expect_success 'test GIT_NO_REPLACE_OBJECTS env variable' ' GIT_NO_REPLACE_OBJECTS=1 git show $HASH2 | grep "A U Thor" ' +test_expect_success 'test core.usereplacerefs config option' ' + test_config core.usereplacerefs false && + git cat-file commit $HASH2 | grep "author A U Thor" && + git show $HASH2 | grep "A U Thor" +' + cat >tag.sig <