D25431: [Git] Be safer about removing files

Nathaniel Graham noreply at phabricator.kde.org
Wed Nov 20 22:06:12 GMT 2019


ngraham created this revision.
ngraham added a reviewer: Dolphin.
ngraham requested review of this revision.

REVISION SUMMARY
  Right now the `git rm` operation uses `--force`, which is dangerous because it can
  destroy your files in the case where you accidentally stage a file when then want it
  un-staged. Right now, performing a Git remove" operation on the file destroys it.
  Because the file was not yet added to the history, it's not recoverable. And because the
  file was was deleted using `git`, it's not put in the trash or made an undoable operation.
  
  This patch fixes that by replacing the `--force` argument with `--cached`, which uses
  a safe behavior by default and keeps the file on disk rather than destroying it.
  
  BUG: 414342
  FIXED-IN: 19.12.0

TEST PLAN
  Create a new file
  right-click on that file > Git add
  right-click on that file > Git remove
  
  Before: file is destroyed!
  
  After: file is un-staged and remains there

REPOSITORY
  R449 Plugins for Dolphin

BRANCH
  safer-git-rm (branched from master)

REVISION DETAIL
  https://phabricator.kde.org/D25431

AFFECTED FILES
  git/fileviewgitplugin.cpp

To: ngraham, #dolphin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20191120/6558a656/attachment.htm>


More information about the kfm-devel mailing list