-
Notifications
You must be signed in to change notification settings - Fork 870
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
Repository.Submodules.Add created #482
Conversation
Try the xUnit runner extension. |
RepositorySafeHandle repo, | ||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string url, | ||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path, | ||
int use_gitlink); |
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.
use_gitLink
can be bool
.
I've made all the changes but the Clone. Clone requires that there's no repository but when you add as submodule you have an empty one. I've added the optional parameters exposed by fetch and checkout, so now you can control Tags, Progress, Credentials, etc... |
@olmobrutall Hey! That looks like a nice addition to this project. Indeed, the submodule area need a bit of love. Thanks a lot for helping us with it! Just a few thoughts.
/cc @dahlbyk |
Hi @nulltoken,
I think the API could be improved by:
Congratulations for this nicely designed piece of work, maps perfectly with Git concepts, to the point that is maybe a better way to introduce C# programmers to git without all the bash woodoo. |
There would be a (convoluted) way to do this by retrieving the tips of the repository to submodule (through something similar to
I like not having to combine the working directory path with the submodule location by hand, but I'm unsure about adding another way to instanciate a
I'm not sure to follow you. Did you succeed in making it work? Do you encounter an issue but pushed the requested changes whatsoever? Could you please elaborate a bit on this, please?
❤️ Thanks, but I don't deserve this. It's been a team work. Nothing would have been possible without all the awesome contributions of these people. |
using (ThreadAffinity()) | ||
{ | ||
SubmoduleSafeHandle sub; | ||
var res = NativeMethods.git_submodule_add_setup(out sub, repo, url, path, useGitLink); |
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 is init-ing an empty repo at path
, but at L57 here, you're attempting to clone into that directory. In order to clone into a directory, it must be empty.
Check my comment here: https://github.com/libgit2/libgit2sharp/pull/482/files#r7454934 |
Happy to take this up and finish the implementation. How do I get this patch into my own repo? |
@pms1969 Add |
@pms1969 Some more gory details
|
You're a champ.Thanks. I'll see what I can manage. |
I'm getting the following 2 errors when trying to compile..... Should I be using the "Lax" or "Strict" versions? Error 1 The type or namespace name 'Utf8Marshaler' could not be found (are you missing a using directive or an assembly reference?) C:\Development\libgit2sharp\LibGit2Sharp\Core\NativeMethods.cs 1294 122 LibGit2Sharp |
Hmmm. It'll be hard to troubleshoot those errors without peeking at the code, could you please push it in a branch an open a PR? Regarding the Lax/Strict Marshalers, we use them as follows:
|
I had set them to Lax, but I think I may need to set them to Strict. It compiles now, but alas, I am at work. I plan to get the unit testing working on the way home, and set up a test or 2. Then I'll push and open a pull request. (might be next week now tho, since Easter is going to get in the way of anything productive). |
What branch should I push it too? any name do? |
The branch name doesn't matter much (we tend to use something that identifies the feature eg. |
I wouldn't mind taking this over as I need this functionality for a project I'm working on converting from another source control provider to git. I just have one issue that I'm not sure about. I can't find in the libgit2 api how you can add a submodule specifying a name that is different than the path:
Does it make sense then for SubmoduleCollection.Add() to only take the path and not the name then? The submodule ends up getting named whatever the relative path is. |
This is not functionality that belongs in As this rather old, I'm going to close it, but if you still want to, something like this would belong in |
This is my first pull request. I've created an Add method to Submodules. I haven't been able to run xUnit on VS so there's no test.
Feel free to change it.