Merge branch 'sp/shallow-deepen-on-non-shallow-repo-fix'
"git fetch --deepen=<n>" in a full clone truncated the history to <n> commits deep, which has been corrected to be a no-op instead. * sp/shallow-deepen-on-non-shallow-repo-fix: shallow: fix relative deepen on non-shallow repositoriesmain
commit
186602e2a9
|
|
@ -245,7 +245,11 @@ struct commit_list *get_shallow_commits(struct object_array *heads,
|
|||
int depth, int shallow_flag, int not_shallow_flag)
|
||||
{
|
||||
if (shallows && deepen_relative) {
|
||||
depth += get_shallows_depth(heads, shallows);
|
||||
int cur_shallow_depth = get_shallows_depth(heads, shallows);
|
||||
if (cur_shallow_depth)
|
||||
depth += cur_shallow_depth;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
return get_shallows_or_depth(heads, NULL, NULL,
|
||||
depth, shallow_flag, not_shallow_flag);
|
||||
|
|
|
|||
|
|
@ -251,6 +251,16 @@ test_expect_success '.git/shallow is edited by repack' '
|
|||
origin "+refs/heads/*:refs/remotes/origin/*"
|
||||
'
|
||||
|
||||
test_expect_success 'fetch --deepen does not truncate' '
|
||||
git clone --no-local .git full-clone &&
|
||||
git -C full-clone rev-parse --is-shallow-repository >expect &&
|
||||
git -C full-clone log --oneline >>expect &&
|
||||
git -C full-clone fetch --deepen=1 &&
|
||||
git -C full-clone rev-parse --is-shallow-repository >actual &&
|
||||
git -C full-clone log --oneline >>actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
. "$TEST_DIRECTORY"/lib-httpd.sh
|
||||
start_httpd
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue