atom-git-control icon indicating copy to clipboard operation
atom-git-control copied to clipboard

Compare doesn't work with deleted/moved/renamed files in the commit?

Open dflock opened this issue 9 years ago • 4 comments

I get this output clicking Compare:

> git status --porcelain --untracked-files=all
> git fetch --prune
M  phemi_builder/README.md
M  phemi_builder/build_release.yml
A  phemi_builder/host_vars/bell.yml
M  phemi_builder/inventory/builder.ini
D  phemi_builder/package_build/tasks/main.yml
R  phemi_builder/roles/build_images/tasks/main.yml -> phemi_builder/roles/images_build/tasks/main.yml
R  phemi_builder/roles/save_images/tasks/main.yml -> phemi_builder/roles/images_save/tasks/main.yml
R  phemi_builder/roles/init_phemi_builder/files/id_rsa.phemi-builder -> phemi_builder/roles/init_phemi_builder/files/id_rsa
R  phemi_builder/roles/init_phemi_builder/files/id_rsa.phemi-builder.pub -> phemi_builder/roles/init_phemi_builder/files/id_rsa.pub
M  phemi_builder/roles/init_phemi_builder/tasks/main.yml
A  phemi_builder/roles/package_build/tasks/main.yml
A  phemi_builder/roles/upload_build/tasks/main.yml
A  phemi_builder/roles/workspace_folders/tasks/main.yml
R  phemi_builder/roles/setup_workspace/tasks/main.yml -> phemi_builder/roles/workspace_vars/tasks/main.yml
> git --no-pager diff phemi_builder/README.md phemi_builder/build_release.yml phemi_builder/host_vars/bell.yml phemi_builder/inventory/builder.ini phemi_builder/package_build/tasks/main.yml phemi_builder/roles/build_images/tasks/main.yml phemi_builder/roles/save_images/tasks/main.yml phemi_builder/roles/init_phemi_builder/files/id_rsa.phemi-builder phemi_builder/roles/init_phemi_builder/files/id_rsa.phemi-builder.pub phemi_builder/roles/init_phemi_builder/tasks/main.yml phemi_builder/roles/package_build/tasks/main.yml phemi_builder/roles/upload_build/tasks/main.yml phemi_builder/roles/workspace_folders/tasks/main.yml phemi_builder/roles/setup_workspace/tasks/main.yml

fatal: phemi_builder/package_build/tasks/main.yml: no such path in the working tree.
Use 'git <command> -- <path>...' to specify paths that do not exist locally.
'git --no-pager diff phemi_builder/README.md phemi_builder/build_release.yml phemi_builder/host_vars/bell.yml phemi_builder/inventory/builder.ini phemi_builder/package_build/tasks/main.yml phemi_builder/roles/build_images/tasks/main.yml phemi_builder/roles/save_images/tasks/main.yml phemi_builder/roles/init_phemi_builder/files/id_rsa.phemi-builder phemi_builder/roles/init_phemi_builder/files/id_rsa.phemi-builder.pub phemi_builder/roles/init_phemi_builder/tasks/main.yml phemi_builder/roles/package_build/tasks/main.yml phemi_builder/roles/upload_build/tasks/main.yml phemi_builder/roles/workspace_folders/tasks/main.yml phemi_builder/roles/setup_workspace/tasks/main.yml' exited with error code 128

dflock avatar Nov 13 '15 21:11 dflock

Okay, this seems to be because GIT tries to access a path that has been deleted as it wants to compare a file at that location.

I think the -N flag added to the git diff could solve this problem. PR once again welcome but it should be a "simple" change if it works.

MarcelMue avatar Nov 22 '15 20:11 MarcelMue

+1

pinx avatar Dec 17 '15 11:12 pinx

Ran into this today, got the working tree full of untracked files and lots of changes, trying to review my changes, I can't see the diff of another file, when I have selected one for commit.

Should'nt we just see the compare/diff of a file by default when selecting it?

Phoscur avatar Jan 06 '16 21:01 Phoscur

This is a critical bug

It wipes files if you try viewing the changes to a rename.

Clicking the "view changes" button on a rename blindly executes:

git --no-pager diff oldFilename -> newFilename

This pipes the output of git --no-pager diff oldFilename - (which is empty on stdout) into newFilename, erasing it.

I've just lost some work to this :(

At the very least all commandline arguments need to be properly escaped, to avoid accidental side effects like this.

ProPuke avatar Jan 16 '17 21:01 ProPuke