You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a Bug where Checkout would not checkout the provided branch, but rather nothing (?). This somehow does not occur on my local dev-machine, but only on our pipeline agent.
Reproduction steps
This is my code to commit my changes
publicCommit?CommitChanges(SemVersionnewVersion){usingvarrepo=new Repository(_executionSettings.Git.CloneTarget);
_logger.LogInformation("{head}", repo.Head.FriendlyName);varstatus= repo.RetrieveStatus();if(!status.IsDirty){
_logger.LogInformation("No changes in repository, skipping commit");returnnull;}vartargetBranch= LibGit2Sharp.Commands.Checkout(repo, GetBranch(repo, _executionSettings.Git.TargetBranch));
_logger.LogInformation("{head}", repo.Head.FriendlyName);
LibGit2Sharp.Commands.Stage(repo,new[]{
_executionSettings.FileNames.Changelog,
_executionSettings.FileNames.Version
});varauthor=new Signature("Version Agent","versionagent@example.com", DateTimeOffset.Now);varcommitMessage=$"chore(release): Released {newVersion} to production";
_logger.LogInformation("{head}", repo.Head.FriendlyName);varcommit= repo.Commit(commitMessage, author, author);
_logger.LogInformation("{head}", repo.Head.FriendlyName);
_logger.LogInformation("Commited new changes");returncommit;}
And this loads the provided branch.
private Branch GetBranch(Repositoryrepo,stringbranchName){varbranch= repo.Branches.SingleOrDefault(branch => branch.FriendlyName ==branchName);if(branch==null){thrownew ArgumentException($"Could not find branch '{branchName}'. Did you mean to use 'origin/{branchName}' instead?");}
_logger.LogInformation("Found branch '{branchName}' with head at {headSha}", branch.CanonicalName, branch.Commits.First().Sha);returnbranch;}
Expected behavior
I would except, that every logging statement would print "develop"
Actual behavior
Only the first logging prints "develop". The following only print "(no branch)"
Version of LibGit2Sharp (release number or SHA1)
0.27.2
Operating system(s) tested; .NET runtime tested
Local dev-machine: Windows 10
Pipeline: ubuntu
The text was updated successfully, but these errors were encountered:
I encountered a Bug where Checkout would not checkout the provided branch, but rather nothing (?). This somehow does not occur on my local dev-machine, but only on our pipeline agent.
Reproduction steps
This is my code to commit my changes
And this loads the provided branch.
Expected behavior
I would except, that every logging statement would print "develop"
Actual behavior
Only the first logging prints "develop". The following only print "(no branch)"
Version of LibGit2Sharp (release number or SHA1)
0.27.2
Operating system(s) tested; .NET runtime tested
Local dev-machine: Windows 10
Pipeline: ubuntu
The text was updated successfully, but these errors were encountered: