diff options
author | Jeff King <peff@peff.net> | 2018-07-18 22:45:25 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-07-19 00:45:27 +0200 |
commit | da4398d6a03eb2cf857aa63190e9bf60305befd2 (patch) | |
tree | 61335160817ac56d4c0ad7014b8b4d0670435e95 /t/t6050-replace.sh | |
parent | check_replace_refs: rename to read_replace_refs (diff) | |
download | git-da4398d6a03eb2cf857aa63190e9bf60305befd2.tar.xz git-da4398d6a03eb2cf857aa63190e9bf60305befd2.zip |
add core.usereplacerefs config option
We can already disable replace refs using a command line
option or environment variable, but those are awkward to
apply universally. Let's add a config option to do the same
thing.
That raises the question of why one might want to do so
universally. The answer is that replace refs violate the
immutability of objects. For instance, if you wanted to
cache the diff between commit XYZ and its parent, then in
theory that never changes; the hash XYZ represents the total
state. But replace refs violate that; pushing up a new ref
may create a completely new diff.
The obvious "if it hurts, don't do it" answer is not to
create replace refs if you're doing this kind of caching.
But for a site hosting arbitrary repositories, they may want
to allow users to share replace refs with each other, but
not actually respect them on the site (because the caching
is more important than the replace feature).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6050-replace.sh')
-rwxr-xr-x | t/t6050-replace.sh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh index aa3e249639..86374a9c52 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 <<EOF object $HASH2 type commit |