-
Notifications
You must be signed in to change notification settings - Fork 62
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
Added Two Reset method Overloads. #6
Conversation
@DavidBrower please add a test case for these new aliases in test.cake and I'll try to review asap. |
@devlead Apologies for not having mentioned this in my OP. I'm afraid I am unable to run the tests in test.cake due to an issue with running git clone using lilbgit2sharp from behind a (corporate) proxy: I will see if there is a way around this to add a test case. |
Currently it runs target Refactor would basically be add To be able to run all you could add an Regardless you could add tests for your added aliases and invoke |
I've almost completed the refactoring along the lines that you have suggested. However, I've noticed that Git-Set-Tag is failing due it not finding the specified file. It's difficult understanding what is wrong here as it seems to want to shell out to an exe that I don't have at that location (possibly as a consequence of Git-Clone not being executed). Any thoughts? |
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// ARGUMENTS | ||
/////////////////////////////////////////////////////////////////////////////// | ||
var target = Argument<string>("target", "Default-Tests"); | ||
var localTests = Argument<bool>("local-tests", false); |
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.
No need for this people can specify target
to Local-Tests
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.
Ok, will amend.
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.
So, do you want to be able to call the PS script like this:
.\build.ps1 -Target Local-Tests
?
Something's broken in the Git-Clone maybe some ordering issue, haven't checked details yet, just saw CI failed. |
@devlead I see that it's failing with the message Update Yup, it's an ordering issue. Hopefully, will get a fix up soon. |
I am concerned that |
@DavidBrower Currently I'll review at PR in a couple of hours, meanwhile could you please rebase/squash into 1 commit. |
@@ -36,6 +36,7 @@ Param( | |||
[switch]$WhatIf | |||
) | |||
|
|||
|
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 file should be reverted to original state as it hasn't changed.
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 missed this for some reason. Will rectify.
GitReset(ResetMode) which resets the current branch HEAD to the latest commit and, optionally, modifies the index and working tree. GitReset(ResetMode, CommitId) which resets the current branch HEAD to the specified commit and, optionally, modifies the index and working tree. $Target can be passed a value of Local-Tests which runs all tests except Git-Clone. The purpose of this is to allow for the situation where someone is behind a corporate proxy and the test repository on GitHub cannot be cloned (see libgit2/libgit2#2106).
@devlead Is there anything else that you can think needs to be added to the PR? |
@DavidBrower LGTM, merged 👍 |
@DavidBrower it's now on Nuget |
Hi Guys,
I've forked Cake.Git and added two reset overloads that call into the corresponding libgit2sharp methods. The reason for making this addition is that we want to be able to roll back the updates made by GitVersion to our AssemblyInfo.cs files at the end of a build.
Ideally, we'd like to be able to specify a pattern to target */AssemblyInfo.cs and no other files since there may be build artifacts that we wish to retain (and for which .gitignore is too brittle a protection). However, I see that libgit2sharp doesn't offer calling into the git_reset_default method in libgit2.
Summary of Additions
GitReset(ResetMode) which resets the current branch HEAD to the latest
commit and, optionally, modifies the index and working tree.
GitReset(ResetMode, CommitId) which resets the current branch HEAD to the
specified commit and, optionally, modifies the index and working tree.