This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 244684

Summary: Amend Last Commit should better handle tags
Product: versioncontrol Reporter: terje7601
Component: GitAssignee: Ondrej Vrabec <ovrabec>
Status: NEW ---    
Severity: normal CC: git
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:

Description terje7601 2014-05-23 09:55:01 UTC
To reproduce:
1) create a commit "A"
2) tag commit "A" with "v1.0"
3) change some files
4) create a commit "B" & check "Amend Last Commit"

At this point, the tag "v1.0" is not on the commit "B", but is a dangling tag now.

Now there are 2 issues:

1) you can't delete the tag: neither the Show History window nor the Git Repository Browser has an option to delete tags (in fact, the Show History window doesn't even show the dangling tag).

2) on creating a commit: if "Amend Last Commit" is checked & the affected commit is tagged, NetBeans should notify the user & ask what to do:
a) delete the tag, amend the commit & recreate the tag on the new commit
b) delete the tag
c) create a new commit instead of amending the last commit
d) leave the dangling tag (current NetBeans behavior)

and provide a checkbox to "don't ask again". Personally, I would like option (a) to be the default.
Comment 1 Ondrej Vrabec 2014-05-23 10:15:32 UTC
> 1) you can't delete the tag: neither the Show History window nor the Git
> Repository Browser has an option to delete tags (in fact, the Show History
> window doesn't even show the dangling tag).
You can:
1) Select the tag under repository/Tags
2) Show Details from the popup menu
3) in the opened panel click on Delete
I agree it's a bit hidden, maybe the action should be directly in the popup menu.

> 2) on creating a commit: if "Amend Last Commit" is checked & the affected commit is tagged, NetBeans should notify the user & ask what to do:
> a) delete the tag, amend the commit & recreate the tag on the new commit
Yes, i suppose after such a commit is amended user might be notified.
However the commit may not be necessarily unreferenced. If someone in the meantime connects a branch to the commit, the tag should remain:
1) switch on master
2) commit A
3) tag commit A
4) git branch NEW_BRANCH A
5) commit --amend B (commit A is amended but still referenced from branch NEW_BRANCH)

But the decision may be left on the user.
Comment 2 terje7601 2014-05-26 07:01:58 UTC
> I agree it's a bit hidden, maybe the action should be directly in the popup
> menu.

I just filed bug 244725 for this.

> However the commit may not be necessarily unreferenced. If someone in the
> meantime connects a branch to the commit, the tag should remain:
> 1) switch on master
> 2) commit A
> 3) tag commit A
> 4) git branch NEW_BRANCH A
> 5) commit --amend B (commit A is amended but still referenced from branch
> NEW_BRANCH)

Ah yes, I hadn't thought of that, so that's an extra option to consider. In this case it would indeed make sense to leave the tag untouched.