kblincoe / VisualGit_SE701_1

0 stars 0 forks source link

Unstaging of files removes them from the index (untracks them) #187

Open kdhira opened 6 years ago

kdhira commented 6 years ago

Recently, staging and unstaging functionality has been implemented (#33). Staging works as intended where if a user selects a file for staging, nodegit will stage it on that action, and the staging area is updated. However, with unstaging (moving the files back to the unstaged area), the files are instead removed from the index and become untracked (and nodegit stages the deletion of the file). This is not what is intended for the unstaging of files. It should perform a "git reset HEAD {file}" or similar action to just move the file back into the working directory and remove from the staging area.

From looking at nodegit there is APIs for resetting files, which one has been used here. But contrary to the naming of the APIs (Reset.default, Reset.reset etc) which should do a "reset" like operation, they appear to do more of a "git rm --cached" operation on the files. I could be wrong

Steps to reproduce

This will perform the incorrect behaviour and remove the file from the repository (stage the deletion of the file).

@softeng-701 issue size small?