Skip to content

Add submodule changes to index #220

Closed
Haacked opened this Issue Oct 1, 2012 · 7 comments

2 participants

@Haacked
Haacked commented Oct 1, 2012

Copied from my accidental submission to the libgit2 repo

I know that @arrbee added support for git_submodule_add_to_index to LibGit2. Ideally, this simply works as part of the existing Index.Stage command, if possible.

That way, something like this would Just Work™ for a repository that has a submodule in the root named MySubmodule:

using (var libGitRepo = new Repository("@c:\path-to-my-repo\.git")) {
    libGitRepo.Index.Stage(new [] 
        { "file1.txt", "MySubmodule", "AnotherFile.md" });
}
@Haacked
Haacked commented Oct 1, 2012

Just to provide more info, the way GHfW gets the list of files to stage today is we parse the output of:

git status --untracked-files=all --porcelain -z

Then we build an array and call libGitRepo.Index.Stage one each. Today, this fails when one of the changes reported by status is a submodule that's been updated.

Ideally, we wouldn't have to shell out at all to do this. :)

@Haacked
Haacked commented Oct 24, 2012

Any updates on this?

@dahlbyk
libgit2 member
dahlbyk commented Oct 24, 2012

I've started playing around with submodules a bit in the context of libgit2/libgit2#756... if nobody else is working on it, I can see about tackling this first.

Out of curiosity, what's missing from RepositoryStatus such that you need to shell out to git.git?

@Haacked
Haacked commented Oct 25, 2012

Apparently the thing that's missing is my knowledge that it's been implemented! ;)

The code to grab the status was written before I joined and we probably didn't think to upgrade it to use RepositoryStatus. Good to know it's there!

@Haacked
Haacked commented Nov 27, 2012

Any updates on this?

@dahlbyk
libgit2 member
dahlbyk commented Nov 28, 2012

I have some of the native submodule bindings done locally, but not much else.

@dahlbyk
libgit2 member
dahlbyk commented Dec 16, 2012

In the context of #274 it probably makes sense to wait for the updated Stage() implementation.

@dahlbyk dahlbyk referenced this issue Feb 4, 2013
Merged

Submodules! #312

10 of 13 tasks complete
@dahlbyk dahlbyk added a commit to dahlbyk/libgit2sharp that referenced this issue Mar 3, 2013
@dahlbyk dahlbyk Add submodule support to Index.Stage()
Fix #220
92757f4
@dahlbyk dahlbyk added a commit to dahlbyk/libgit2sharp that referenced this issue Mar 26, 2013
@dahlbyk dahlbyk Add submodule support to Index.Stage()
Fix #220
e2948a5
@dahlbyk dahlbyk added a commit to dahlbyk/libgit2sharp that referenced this issue Apr 9, 2013
@dahlbyk dahlbyk Add Repository.Submodules
Includes submodule support in Index.Stage() to fix #220
ac4a5f6
@dahlbyk dahlbyk added a commit to dahlbyk/libgit2sharp that referenced this issue Apr 10, 2013
@dahlbyk dahlbyk Add Repository.Submodules
Includes submodule support in Index.Stage() to fix #220
82f0b25
@nulltoken nulltoken added a commit that closed this issue Apr 11, 2013
@dahlbyk dahlbyk Add Repository.Submodules
Includes submodule support in Index.Stage() to fix #220
6cc2854
@nulltoken nulltoken closed this in 6cc2854 Apr 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.