Support deleted files for "Compare two files"
In the Diff or Commit window, the context action "Compare two files" does not work when two files are selected and one of them has been deleted from the repository (status "Missing").
-
If the other, non-deleted file has been added to the Git index (status "Added"), it shows the following dialog:
-
If the other, non-deleted has not been added to the Git index yet (status "Unknown"), it shows the following error dialog:
This is rather unfortunate, because for example when Git is unable to tell that a file has been both renamed and edited, and instead shows two files, one as deleted and one as added, then it would be quite useful to at least manually compare the changes by selecting the files and using "Compare two files".
What steps will reproduce the problem?
- Create a new local Git repository
- Commit a file
test.txt
with contenttest
(commit message does not matter) - Rename the file to
test-new.txt
and change the content tohello
- Open the Git Commit dialog
- Select both files
test.txt
andtest-new.txt
- Right click either of them and select "Compare two files"
A warning or error dialog appears
What is the expected output? What do you see instead?
Expected: It is possible to compare a deleted file with another one. Additionally:
- If one of the files has the status "Missing", and the other doesn't have this status, then it might be useful to show the "Missing" file always on the left pane of TortoiseGitMerge, regardless on which file of the two the "Compare two files" was invoked.
- The content of the "Missing" file(s) in TortoiseGitMerge should be read-only, or should properly handle the case when the user tries to save changes to that non-existent file (e.g. create the file, or show a save file dialog).
Actual: It is not possible to compare the content of the deleted file.
What version of TortoiseGit and Git are you using? On what operating system?
TortoiseGit 2.13.0.1
git version 2.36.1.windows.1
Microsoft Windows [Version 10.0.19043.1706]