jcansdale / GitPullRequest

Git extension that opens PRs associated with the current branch
4 stars 2 forks source link

Prune attempts to delete branch multiple times when it has multiple associated PRs #29

Closed jcansdale closed 5 years ago

jcansdale commented 5 years ago
git pr --prune

Removing #31086 fix-double
Removing #31088 fix-double

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> LibGit2Sharp.NotFoundException: reference 'refs/heads/fix-double' not found
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
   at LibGit2Sharp.Core.Proxy.git_reference_lookup(RepositoryHandle repo, String name, Boolean shouldThrowIfNotFound)
   at LibGit2Sharp.BranchCollection.Remove(Branch branch)
   at GitPullRequest.Program.PruneBranches(GitPullRequestService service, Repository repo) in C:\Source\github.com\jcansdale\GitPullRequest\GitPullRequest\Program.cs:line 186
   at GitPullRequest.Program.OnExecute() in C:\Source\github.com\jcansdale\GitPullRequest\GitPullRequest\Program.cs:line 52
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments) in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 86
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context) in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 64
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext() in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 25
--- End of stack trace from previous location where exception was thrown ---
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass131_0.<OnExecute>b__0() in C:\projects\commandlineutils\src\CommandLineUtils\CommandLineApplication.cs:line 600
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](CommandLineContext context) in C:\projects\commandlineutils\src\CommandLineUtils\CommandLineApplication.Execute.cs:line 31
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](IConsole console, String[] args) in C:\projects\commandlineutils\src\CommandLineUtils\CommandLineApplication.Execute.cs:line 105
   at GitPullRequest.Program.Main(String[] args) in C:\Source\github.com\jcansdale\GitPullRequest\GitPullRequest\Program.cs:line 17

From @jaredpar