зеркало из https://github.com/microsoft/git.git
Merge branch 'tb/fix-persistent-shallow' into master
When "fetch.writeCommitGraph" configuration is set in a shallow repository and a fetch moves the shallow boundary, we wrote out broken commit-graph files that do not match the reality, which has been corrected. * tb/fix-persistent-shallow: commit.c: don't persist substituted parents when unshallowing
This commit is contained in:
Коммит
24ecfdf206
|
@ -203,7 +203,8 @@ static int commit_graph_compatible(struct repository *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_commit_graft(r);
|
prepare_commit_graft(r);
|
||||||
if (r->parsed_objects && r->parsed_objects->grafts_nr)
|
if (r->parsed_objects &&
|
||||||
|
(r->parsed_objects->grafts_nr || r->parsed_objects->substituted_parent))
|
||||||
return 0;
|
return 0;
|
||||||
if (is_repository_shallow(r))
|
if (is_repository_shallow(r))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
2
commit.c
2
commit.c
|
@ -423,6 +423,8 @@ int parse_commit_buffer(struct repository *r, struct commit *item, const void *b
|
||||||
pptr = &item->parents;
|
pptr = &item->parents;
|
||||||
|
|
||||||
graft = lookup_commit_graft(r, &item->object.oid);
|
graft = lookup_commit_graft(r, &item->object.oid);
|
||||||
|
if (graft)
|
||||||
|
r->parsed_objects->substituted_parent = 1;
|
||||||
while (bufptr + parent_entry_len < tail && !memcmp(bufptr, "parent ", 7)) {
|
while (bufptr + parent_entry_len < tail && !memcmp(bufptr, "parent ", 7)) {
|
||||||
struct commit *new_parent;
|
struct commit *new_parent;
|
||||||
|
|
||||||
|
|
1
object.h
1
object.h
|
@ -25,6 +25,7 @@ struct parsed_object_pool {
|
||||||
char *alternate_shallow_file;
|
char *alternate_shallow_file;
|
||||||
|
|
||||||
int commit_graft_prepared;
|
int commit_graft_prepared;
|
||||||
|
int substituted_parent;
|
||||||
|
|
||||||
struct buffer_slab *buffer_slab;
|
struct buffer_slab *buffer_slab;
|
||||||
};
|
};
|
||||||
|
|
|
@ -81,6 +81,20 @@ test_expect_success 'fetch --unshallow from shallow clone' '
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'fetch --unshallow from a full clone' '
|
||||||
|
git clone --no-local --depth=2 .git shallow3 &&
|
||||||
|
(
|
||||||
|
cd shallow3 &&
|
||||||
|
git log --format=%s >actual &&
|
||||||
|
test_write_lines 4 3 >expect &&
|
||||||
|
test_cmp expect actual &&
|
||||||
|
git -c fetch.writeCommitGraph fetch --unshallow &&
|
||||||
|
git log origin/master --format=%s >actual &&
|
||||||
|
test_write_lines 4 3 2 1 >expect &&
|
||||||
|
test_cmp expect actual
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'fetch something upstream has but hidden by clients shallow boundaries' '
|
test_expect_success 'fetch something upstream has but hidden by clients shallow boundaries' '
|
||||||
# the blob "1" is available in .git but hidden by the
|
# the blob "1" is available in .git but hidden by the
|
||||||
# shallow2/.git/shallow and it should be resent
|
# shallow2/.git/shallow and it should be resent
|
||||||
|
|
Загрузка…
Ссылка в новой задаче