Skip to content
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

Publish Documentation step report success but not publishing changes #147

Open
wozzo opened this issue Aug 28, 2017 · 3 comments
Open

Publish Documentation step report success but not publishing changes #147

wozzo opened this issue Aug 28, 2017 · 3 comments
Milestone

Comments

@wozzo
Copy link
Member

wozzo commented Aug 28, 2017

Running locally I found that changes to documentation were staged however the GitHasStagedChanges(publishFolder) call on line 151 of wyam.cake returned false.
The step reported success, but did not push any documentation.

@andreasnilsen
Copy link

I hit the same issue when trying to roll my own solution inspired by the Cake.Recipe code, I think the issue is with the underlying code in Cake.Git and/or LibGit2Sharp.

Looking at the source code for LibGit2Sharp's RepositoryStatus, it seems that the "Staged" list only contains existing files that were modified, not files that were added, deleted or renamed. These are stored in separate lists.
https://github.com/libgit2/libgit2sharp/blob/f8e2d42ed9051fa5a5348c1a13d006f0cc069bc7/LibGit2Sharp/RepositoryStatus.cs#L42

The Cake.Git method GitAliases.Repository.GitHasStagedChanges only checks the RepositoryStatus.Staged list, not the NewInIndex, DeletedFromIndex, RenamedInIndex.
`https://github.com/cake-contrib/Cake_Git/blob/ad0b56e6a8b53fcda9f1178f5a9953eff9f9d322/src/Cake.Git/GitAliases.Repository.cs#L120

So if your changes only contain new files/deleted files/renamed files it will not actually commit or push anything.

I guess it's a matter of discussion where the error lies, LibGit2Sharp's naming of the Staged-list is maybe a bit unfortunate, but I also guess that Cake.Git is consuming the RepositoryStatus "API" wrongly.

Should we create an issue with the Cake_Git project?

@wozzo
Copy link
Member Author

wozzo commented Sep 7, 2018 via email

@andreasnilsen
Copy link

@wozzo Well they are actually staged in Git, but LibGit2Sharp doesn't contain them in its' "staged list" in the RepositoryStatus. So I think this should be fixed in LibGit2Sharp/Cake.Git, not in Cake.Recipe.

I created an issue with Cake.Git : cake-contrib/Cake_Git#77

@gep13 gep13 added this to the vNext milestone Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants