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 ).
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?
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.
Created attachment 147782 [details]
Created attachment 147783 [details]
(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.
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)
(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:
> ?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.
Integrated into 'main-silver', will be available in build *201407040001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Ondrej Vrabec <email@example.com>
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