Bug 395628

Summary: PushCommand to delete remote branch differs from command line
Product: [Technology] JGit Reporter: RĂ¼diger Herrmann <ruediger.herrmann>
Component: JGitAssignee: Project Inbox <jgit.core-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: robin
Version: 2.1Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description RĂ¼diger Herrmann CLA 2012-12-03 11:44:50 EST
If the PushCommand is configured to delete a remote branch, it behaves different from the Git command line.
Given there is a local branch 'foo' that tracks a remote brach with the same name, this code snippet:
  PushCommand pushCommand = ...
  pushCommand.setRemote( "origin" );
  pushCommand.add( ":foo" );
  pushCommand.call();
deletes the 'foo' branch on the remote repository *and* locally.

Whereas 'git push origin :foo' from the command line leaves the local branch 'foo' intact.