]> git.ipfire.org Git - thirdparty/git.git/commit
shallow: fix relative deepen on non-shallow repositories
authorSamo Pogačnik <samo_pogacnik@t-2.net>
Mon, 11 May 2026 19:20:42 +0000 (21:20 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 May 2026 00:00:16 +0000 (09:00 +0900)
commit2431f5e0e5cd415a3ab1bddb435b692536cc95e8
treec48afaddbe7d9954dd8672a3b5aefba43abc36e5
parent94f057755b7941b321fd11fec1b2e3ca5313a4e0
shallow: fix relative deepen on non-shallow repositories

The commit "3ef68ff40e (shallow: handling fetch relative-deepen,
2026-02-15)" introduced a bug where using --deepen=<n> on a non-
shallow repository incorrectly treated the value as an absolute
depth, resulting in a shallow fetch and truncated history.

This patch prevents any modification when a relative deepen is
requested on a non-shallow repository.

A test is added to ensure that history is not changed when
--deepen is used on a non-shallow repository.

Reported-by: Owen Stephens <owen@owenstephens.co.uk>
Signed-off-by: Samo Pogačnik <samo_pogacnik@t-2.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
shallow.c
t/t5537-fetch-shallow.sh