cake-contrib / Cake_Git

Cake AddIn that extends Cake with Git features using LibGit2 and LibGit2Sharp
https://cakebuild.net/extensions/cake-git
Other
39 stars 64 forks source link

Unable to add . #19

Closed wekempf closed 7 years ago

wekempf commented 8 years ago

I'm trying to add all pending changes, the equivalent of:

git add .

My repo is in a subdirectory, so I'm doing the following:

GetAdd("./clone", new FilePath[] { "./clone" });

I've tried everything I can think of for the second parameter, all to no avail. With a little playing around I think the issue is with how this relative path is converted.

    var file = File("./clone").Path.MakeAbsolute(Context.Environment);
    var dir = Directory("./clone").Path.MakeAbsolute(Context.Environment);
    Information(dir.GetRelativePath(file).FullPath);

This produces "../clone" rather than ".". Am I missing something obvious, or do we have a bug that needs to be fixed here?

devlead commented 8 years ago

Issue is because add that's a file path and not a string. Libgit2sharp doesn't have . concept. What would be possible though would be to add an alias to stage all pending changes something like a GitAddAll(repopath) that does something like below internally

    context.UseRepository(
        repositoryDirectoryPath,
        repository =>  Commands.Stage(repository, "*")
    );

Would be an small addition to GitAliases.Add.cs

devlead commented 7 years ago

There's now an GitAddAll