Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fetch: enable deepening/shortening shallow clones#6662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethomson merged 1 commit intolibgit2:mainfromkempniu:enable-deepening-and-shortening-shallow-clones
Dec 14, 2023
Merged

fetch: enable deepening/shortening shallow clones#6662

ethomson merged 1 commit intolibgit2:mainfromkempniu:enable-deepening-and-shortening-shallow-clones
Dec 14, 2023

Conversation

kempniu
Copy link
Contributor

A shallow repository can currently only be completely unshallowed, which is caused by mark_local() only marking locally-existing objects as wanted if the fetch depth is set toINT_MAX (GIT_FETCH_DEPTH_UNSHALLOW). This prevents deepening the history of a shallow clone to an arbitrary number of commits, which may be preferable over full unshallowing for large repositories.

Enable deepening and shortening shallow clones by marking locally-existing objects as wanted whenever the fetch depth is set to any non-default value (eitherGIT_FETCH_DEPTH_UNSHALLOW or an arbitrary positive integer).

A shallow repository can currently only be completely unshallowed, whichis caused by mark_local() only marking locally-existing objects aswanted if the fetch depth is set to INT_MAX (GIT_FETCH_DEPTH_UNSHALLOW).This prevents deepening the history of a shallow clone to an arbitrarynumber of commits, which may be preferable over full unshallowing forlarge repositories.Enable deepening and shortening shallow clones by markinglocally-existing objects as wanted whenever the fetch depth is set toany non-default value (either GIT_FETCH_DEPTH_UNSHALLOW or an arbitrarypositive integer).
git_repository_free(repo);
}

void test_online_shallow__shorten_four(void)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
voidtest_online_shallow__shorten_four(void)
voidtest_online_shallow__shorten_five(void)

It looks like this actually deepens five not four?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Bothtest_online_shallow__deepen_six() andtest_online_shallow__shorten_four() start by cloning the test repository with a depth of 5 (clone_opts.fetch_opts.depth = 5;).

test_online_shallow__deepen_six() then fetches from the repository again, but with a depth of 6 (fetch_opts.depth = 6;), to demonstrate that libgit2 is able to make a shallow historydeeper.

test_online_shallow__shorten_four(), which you called out in your comment, performs the post-cloning fetch with a depth of 4 (fetch_opts.depth = 4;), to demonstrate that libgit2 is also able to make a shallow historyshorter.

Does this help?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Oops. 😓 Yes, sorry, I misread that.

kempniu reacted with thumbs up emoji
@ethomson
Copy link
Member

Thanks for the fix! Sorry for the delay, I had to read the surrounding comment a few times to remember how this all works. 😅

One minor question about the name of the test - otherwise looks great.

kempniu reacted with heart emoji

@ethomsonethomson merged commita52685f intolibgit2:mainDec 14, 2023
@ethomson
Copy link
Member

Thanks@kempniu !

kempniu reacted with thumbs up emoji

@kempniukempniu deleted the enable-deepening-and-shortening-shallow-clones branchDecember 14, 2023 10:51
@ethomsonethomson added the bug labelDec 14, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ethomsonethomsonethomson approved these changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@kempniu@ethomson

[8]ページ先頭

©2009-2025 Movatter.jp