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 210330 - rename/delete/copy prematurely modify the index(staging area)
Summary: rename/delete/copy prematurely modify the index(staging area)
Status: NEW
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Git (show other bugs)
Version: 7.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-29 00:13 UTC by daveistooshort
Modified: 2012-04-07 02:40 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description daveistooshort 2012-03-29 00:13:41 UTC
When using netbeans to rename, copy, or delete source files (and potentially some other operations) the file is immediately added to the index. Instead the file should only be changed in the index when preparing to commit the changes.

The current behavior is very irritating when using netbeans in conjunction with command line git.
Comment 1 Ondrej Vrabec 2012-04-05 13:43:50 UTC
a question:
what happens if you run "git mv/delete" on commandline? I am not too experienced git user but i thought that e.g. git mv A B will also affect index, won't it? I believe we are consistent with commandline's behavior.
Comment 2 daveistooshort 2012-04-07 02:35:34 UTC
(In reply to comment #1)
> a question:
> what happens if you run "git mv/delete" on commandline? I am not too
> experienced git user but i thought that e.g. git mv A B will also affect index,
> won't it? I believe we are consistent with commandline's behavior.

You are correct that is the command line behavior. The issue is a workflow one rather than a technical correctness one. I will try to explain.

Just because I have deleted/copied/moved a file doesn't mean I would invoke the git command to stage the change immediately, normally I would only do that at the time I intend commit those changes. Similarly I do not run the "git add" command every time I save a change to a file, but only once when I am preparing to commit.

As it currently is, if I use netbeans to delete a file or rename a class and then decide to not commit that change in my next commit I then have to manually unstage those changes from the index.

Also many git commands by default refer to the version of the file in the index.
-"git diff" by default shows to changes between the working copy and the index
-"git checkout <file>" overwrites the working copy version with the one in the index

So ideally anything going into the index should be done explicitly rather than implicitly. Currently in netbeans some do (rm/mv/cp), and some do not (save, new file).

Lastly git does not store meta data about renames so nothing is lost by delaying and treating staging operation as a "git rm" followed by a "git add".
Comment 3 daveistooshort 2012-04-07 02:40:27 UTC
> So ideally anything going into the index should be done explicitly rather than
> implicitly. Currently in netbeans some do (rm/mv/cp), and some do not (save,
> new file).

Sorry that second sentence is badly worded. I meant currently in netbeans rm/mv/cp are treated as implicit staging and save/newfile are treated as explicit staging.