-
Notifications
You must be signed in to change notification settings - Fork 889
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds Depth to FetchOptions allowing for shallow cloning #2070
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -780,6 +780,13 @@ public static string Clone(string sourceUrl, string workdirPath, | |
|
||
options ??= new CloneOptions(); | ||
|
||
// As default behaviour for GitFetchOptionsWrapper ctor is to create | ||
// a new instance of GitFetchOptions we only populate the Depth field. | ||
var fetchOptions = new GitFetchOptions | ||
{ | ||
Depth = options.FetchOptions.Depth, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That doesn't look like the case to me. The
|
||
}; | ||
|
||
// context variable that contains information on the repository that | ||
// we are cloning. | ||
var context = new RepositoryOperationContext(Path.GetFullPath(workdirPath), sourceUrl); | ||
|
@@ -794,7 +801,7 @@ public static string Clone(string sourceUrl, string workdirPath, | |
} | ||
|
||
using (var checkoutOptionsWrapper = new GitCheckoutOptsWrapper(options)) | ||
using (var fetchOptionsWrapper = new GitFetchOptionsWrapper()) | ||
using (var fetchOptionsWrapper = new GitFetchOptionsWrapper(fetchOptions)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need another test for this extra options : what if it is null and being passed to the ctor? Also, how about using using var ... (we might want to remove the brackets) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If FetchOptions.Depth is not set (or is set to 0) behaviour should be as before (i.e. should do a non-shallow clone), correct? So that is what should be tested? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All previously existing tests would essentially already be testing that though... |
||
{ | ||
var gitCheckoutOptions = checkoutOptionsWrapper.Options; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be unnecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you are referring to the
= 0
part only.