Bug 215636 - Support for 'git commit --amend'
Support for 'git commit --amend'
Status: RESOLVED FIXED
Product: versioncontrol
Classification: Unclassified
Component: Git
7.2
PC Linux
: P3 with 2 votes (vote)
: 7.4
Assigned To: Ondrej Vrabec
issues@versioncontrol
: API, API_REVIEW_FAST, PLAN
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-17 15:35 UTC by _ rkubacki
Modified: 2013-02-07 03:06 UTC (History)
5 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Proposed patch for this functionnality (27.23 KB, application/octet-stream)
2013-01-12 18:26 UTC, ymajoros
Details
another try (38.02 KB, application/octet-stream)
2013-01-14 18:00 UTC, ymajoros
Details
api change with tests (8.96 KB, patch)
2013-01-29 13:30 UTC, Ondrej Vrabec
Details | Diff
usage of the api (33.13 KB, patch)
2013-01-29 13:30 UTC, Ondrej Vrabec
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ rkubacki 2012-07-17 15:35:30 UTC
This is frequently used in Git world by some people as it gives you possibility to do things like fix commit message or remove/add/modify some files from your last commit.
Comment 1 diego.cerqueira 2012-08-22 20:49:17 UTC
Realmente faz falta. Aguardo ansioso por esse acréscimo a este módulo.
Comment 2 Ondrej Vrabec 2012-08-22 20:59:53 UTC
> Realmente faz falta. Aguardo ansioso por esse acréscimo a este módulo.
English, please
Comment 3 diego.cerqueira 2012-08-22 22:03:05 UTC
(In reply to comment #2)
> > Realmente faz falta. Aguardo ansioso por esse acréscimo a este módulo.
> English, please
Sorry! I said: I truly miss. I await this addition in this module.
(by Google Translate)
Comment 4 ymajoros 2013-01-11 14:05:16 UTC
Would it help if I'd volunteer to work on it and submit a patch?
Comment 5 Ondrej Vrabec 2013-01-11 14:16:33 UTC
(In reply to comment #4)
> Would it help if I'd volunteer to work on it and submit a patch?
Sure, you would be more than welcome.
Comment 6 Ondrej Vrabec 2013-01-11 14:17:59 UTC
... let me know if you need any help from me.
Comment 7 Ondrej Vrabec 2013-01-11 14:24:15 UTC
BTW, isn't git commit --amend exactly the same as:
1) Team -> Git -> Reset (select --soft option)
2) Team -> Git -> Commit again ?
... which is already possible in the IDE?
Comment 8 ymajoros 2013-01-11 15:59:48 UTC
The effect is the same, but git users are used to be able to just select "amend" to do it at once. 

In Eclipse, there is just a checkbox, which picks the amended commit's message if checked. Our team comes from Eclipse and I'm trying to see if we could use Netbeans instead, but this feature will surely be discussed.

Thanks for your help, I could use some. I'm an experienced Java developper (mostly Java EE, lots of Swing in the past), but only played with Netbeans platform a few times. Which modules are concerned? Is there some doc on how to debug an ide module? The fix is probably rather trivial, so I could just replace the module and restart, but I guess there are better tools.
Comment 9 ymajoros 2013-01-12 18:26:55 UTC
Created attachment 130141 [details]
Proposed patch for this functionnality

Here is a first working version:

- "amend" check box in commit dialog
- clicking "amend" alos selects HEAD's commit message 
- double clicking on a row on table opens a diff, without having to go through popup menu
Comment 10 Ondrej Vrabec 2013-01-14 13:01:32 UTC
thanks for the patch, i have several comments.

OV1 - the checkbox is incorrectly positioned, should be under the Author and Committer fields, not in the dialog's right upper corner. That's a detail, i can fix it myself.

OV2 - when getting the commit message the UI is blocked:
> Task task = logCommitDialogProgressSupport.start(rp, repository, preparingMessage);
> task.waitFinished();
calling waitFinished will successfully block the UI and the IDE becomes unresponsive until the git command finishes. It has to be moved to a background thread, preferably to the preparation phase: GitCommitPanel.getProgressSupport
Additionally the checkbox should be disabled (setEnabled(false)) until the message is acquired.

OV3 - use simpler method to get the message: GitClient.log(String, ProgressMonitor):
> getClient().log(GitUtils.HEAD, getProgressMonitor());
that will yield the last commit directly.

OV4 - amended commit cannot be finished until there are modified files. When you just want to modify the last commit message without changing any files, there's no way to finish the commit. GitCommitTable.containsCommitable has to be modify to reflect selected "amend" checkbox. In other words when the checkbox is selected the commit dialog's commit button can be enabled.
Comment 11 Ondrej Vrabec 2013-01-14 13:07:47 UTC
OV5 - please also remove the part with dbl-click opening a diff window. This is covered in bug #223178 and i already have a patch prepared for it. Just waiting for the right time to integrate it (probably beginning of the next week)
Comment 12 ymajoros 2013-01-14 18:00:15 UTC
Created attachment 130195 [details]
another try

Here is another try, mainly to see if it's what you intended. Still, I think we should simplify all of this (still volunteering to do so in later patchset).
Comment 13 Ondrej Vrabec 2013-01-15 09:59:50 UTC
> Here is another try, mainly to see if it's what you intended.
Yes, that solves my previous issues.
> Still, I think we should simplify all of this (still volunteering to do so in later patchset).
Be my guest, but file another issue for that and let's discuss this separately. I do not want to mix two different issues into one.
Comment 14 Ondrej Vrabec 2013-01-29 13:30:31 UTC
Created attachment 130782 [details]
api change with tests
Comment 15 Ondrej Vrabec 2013-01-29 13:30:53 UTC
Created attachment 130783 [details]
usage of the api
Comment 16 Ondrej Vrabec 2013-01-29 13:32:55 UTC
Kindly asking for a patch review, the API change is in "api change with tests"
Comment 17 Ondrej Vrabec 2013-01-29 13:35:12 UTC
The API change is simple, only one method was added: GitClient.commit(File[], String, GitUser, GitUser, boolean, ProgressMonitor)
Comment 18 Ondrej Vrabec 2013-02-05 09:07:08 UTC
if there are no objections, i will integrate tomorrow.
Comment 19 Ondrej Vrabec 2013-02-06 09:13:10 UTC
Thanks for the patch, thanks for the review. Integrated as http://hg.netbeans.org/core-main/rev/87dc70e52280
Comment 20 Quality Engineering 2013-02-07 03:06:54 UTC
Integrated into 'main-golden', will be available in build *201302070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/87dc70e52280
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #215636 - Support for 'git commit --amend'


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