Bug 351314 - JGit PushCommand implicitly creates branches on the remote system
Summary: JGit PushCommand implicitly creates branches on the remote system
Status: RESOLVED FIXED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 6.1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 445491 (view as bug list)
Depends on:
Blocks: 431872
  Show dependency tree
 
Reported: 2011-07-06 07:55 EDT by Christian Halstrick CLA
Modified: 2022-02-18 14:20 EST (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Halstrick CLA 2011-07-06 07:55:56 EDT
When you use JGit PushCommand and you don't specify an explicit refspec then JGit uses implicitly a refspec which potentially leads to the creation of a new branch in the remote system. The new branch will have the same name as the currently checked out branch.

Here JGit behaves differently from native git, where a push without an explicit refspec leads to the update of all "matching" branches (branches which exists locally and remotely). A native git push would not create new branches.

My problem is that JGit under the hood (without an explicit refespec) takes my local branch names to create branches on the remote system. Up to know I was sure that I can name my branches as I like (tmp1, tmp2, f***ingBugFix, ...) because I knew that J/EGit will never publish these names without my explicit order. That's not true anymore.

My proposal: If we can't have these "update only matching branches" rule then we should simply not update/create any branches if user "forgot" to specify any refspec.
Comment 1 Christian Campo CLA 2011-08-02 07:42:47 EDT
It seems that Egit asks actually for the passphrase when I do synchronize workspace. Just the clone wouldn't…. (if that makes any sense)
Comment 2 Christian Campo CLA 2011-08-02 07:43:06 EDT
(In reply to comment #1)
> It seems that Egit asks actually for the passphrase when I do synchronize
> workspace. Just the clone wouldn't…. (if that makes any sense)

sorry wrong bug…..
Comment 3 Rolf Theunissen CLA 2019-02-10 07:28:21 EST
JGit currently does not support the "push.default" configuration option. CGit defaults to "simple" behavior. The default behavior of JGit is "current", which explains the creation of the new branches.

Note that "simple" behaves as "current" for triangular workflows. In non-triangular workflows, it adds the safety check to not create new branches.
Comment 4 Eclipse Genie CLA 2019-02-10 13:00:26 EST
New Gerrit change created: https://git.eclipse.org/r/136629
Comment 5 Eclipse Genie CLA 2022-02-10 05:38:38 EST
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/190662
Comment 8 Thomas Wolf CLA 2022-02-18 14:20:42 EST
*** Bug 445491 has been marked as a duplicate of this bug. ***