Description
Could someone point me at why this may be happening?
I have some c# code that uses libgit2sharp to tag successful builds in TFS Git repositories - its wrapped in a custom tfs activity and called at the end of the build process
The code for the activity is here: https://github.com/gaspode44/TFSGitTagActivity
Its been working fine for a few weeks but has just started failing with the error above
snippet of code
using (var repository = new Repository(sourceFilesFolder))
{
var tag = repository.ApplyTag(tagName);
this.WriteToLog(context, string.Format("Tag applied: {0}", tag.CanonicalName));
// assumes remote to push to is origin
var remote = repository.Network.Remotes["origin"];
this.WriteToLog(context, string.Format("Pushing tag to {0}", remote.Url));
var refspec = string.Format("refs/tags/{0}:refs/tags/{0}", tagName);
this.WriteToLog(context, string.Format("Refspec used to push: {0}", refspec));
repository.Network.Push(
remote,
refspec,
new PushOptions
{
Credentials = new DefaultCredentials(),
OnPushStatusError = (error) => this.WriteToLog(context, string.Format("{0} - {1}", error.Message, error.Reference))
});
}
The line that fails is the call to apply tag
Forcing the build a second time results in success so I'm wondering if its something in the commit that I push from my local git repo?
There seems to be no difference between the parameters being passed between working and failing calls, applying using git cmd line also works
Any ideas what could cause this error?
Richard