Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 245236 - Git merge support should allow to specify fast-forward behavior
Git merge support should allow to specify fast-forward behavior
Status: RESOLVED FIXED
Product: versioncontrol
Classification: Unclassified
Component: Git
8.0
PC Windows 7
: P3 with 1 vote (vote)
: 8.0.1
Assigned To: Ondrej Vrabec
issues@versioncontrol
: API, API_REVIEW_FAST
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-25 13:53 UTC by terje7601
Modified: 2014-07-04 02:37 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
API change (17.78 KB, patch)
2014-06-26 08:02 UTC, Ondrej Vrabec
Details | Diff
ui part (34.21 KB, patch)
2014-06-26 08:02 UTC, Ondrej Vrabec
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description terje7601 2014-06-25 13:53:47 UTC
I would like NetBeans to provide an option under Tools -> Options -> Team -> Git which allows to choose between the following options:
* use the value of merge.ff as specified in the config file of the repository
* fast-forward if possible (= current NetBeans behavior)
* always create a commit (= --no-ff)
* only allow fast forward (= --ff-only)
* always ask (= popup a dialog on each merge & ask the user whether or not to create a commit)

I'm particularly interested in support for --no-ff. Support for this has been added to JGit 2.3 ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=336933 ) & is already available in NetBeans ( http://hg.netbeans.org/core-main/rev/de1cd0ecaad3 ).
Comment 1 Ondrej Vrabec 2014-06-25 14:40:09 UTC
i believe the default in NetBeans is not "-ff" but whatever is stated in .git/config. So it always defaults to "merge.ff".
When do you expect NetBeans asks for this? Would it be enough to have this option in the Merge dialog?
Comment 2 Ondrej Vrabec 2014-06-26 08:01:57 UTC
Please review the API change. Needed to overload GitClient.merge method to accept a new enum (FastForwardOption) specifiying either fast-forward, fast-forward-only or no-fast-forward merge. The enum was added to GitRepository final class and its default value for the repo and current branch can be got from GitRepository.getFastForwardOption method.
Comment 3 Ondrej Vrabec 2014-06-26 08:02:19 UTC
Created attachment 147782 [details]
API change
Comment 4 Ondrej Vrabec 2014-06-26 08:02:39 UTC
Created attachment 147783 [details]
ui part
Comment 5 terje7601 2014-06-26 10:34:31 UTC
(In reply to Ondrej Vrabec from comment #1)
> i believe the default in NetBeans is not "-ff" but whatever is stated in
> .git/config. So it always defaults to "merge.ff".

I just tested this & it didn't work for me. So if NetBeans is supposed to honor the merge.ff setting, this seems to be a bug.

To reproduce (nothing special about it):
1) create a Java application
2) do a git commit
3) create a new branch "next" & check "checkout new branch"
4) change something & create a new commit
5) switch back to the master branch
6) set merge.ff to false in the .git/config file
At this point, doing a merge in NetBeans just does a fast forward. Doing the same merge from the command-line does create the extra merge commit (git version 1.8.3.msysgit.0)

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 2
Java: 1.8.0; Java HotSpot(TM) 64-Bit Server VM 25.0-b70
Runtime: Java(TM) SE Runtime Environment 1.8.0-b132
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)

> When do you expect NetBeans asks for this? Would it be enough to have this
> option in the Merge dialog?

Yes, if Netbeans by default does whatever is stated in .git/config, then an option in the Merge dialog would be enough for me.
Comment 6 Ondrej Vrabec 2014-06-26 11:21:21 UTC
Please try a dev build, it uses a newer JGit, support for merge.ff was added to JGit around this January: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=48e36d8cb335382b99ec829d0dfe34be71ed49bb and made it only into a dev build of NetBeans (not present in 8.0)
Comment 7 terje7601 2014-06-26 13:41:29 UTC
(In reply to Ondrej Vrabec from comment #6)
> Please try a dev build, it uses a newer JGit, support for merge.ff was added
> to JGit around this January:
> http://git.eclipse.org/c/jgit/jgit.git/commit/
> ?id=48e36d8cb335382b99ec829d0dfe34be71ed49bb and made it only into a dev
> build of NetBeans (not present in 8.0)

Ah yes, it works in the dev build, thanks.
Comment 8 Ondrej Vrabec 2014-07-02 11:12:48 UTC
fix: http://hg.netbeans.org/core-main/rev/9eb37931b8ca
Comment 9 Ondrej Vrabec 2014-07-02 11:12:52 UTC
fix: http://hg.netbeans.org/core-main/rev/bffba4b4745a
Comment 10 Quality Engineering 2014-07-04 02:37:02 UTC
Integrated into 'main-silver', will be available in build *201407040001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/9eb37931b8ca
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #245236 - Git merge support should allow to specify fast-forward behavior
- add new GitClient.merge method
- add new enum FastForwardOption
- add new method GitRepository.getFastFrowardOption returning the default value


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo