Shell "Diff With Previous" doesn't work when there are more than 2 revisions for that file [PATCH]
By sideproj... on February 25, 2011 04:01 (imported from Google Code)
What steps will reproduce the problem?
- Find a file with more than two changes
- Right click on that file and choose "Diff With Previous"
- Nothing happens
What is the expected output? What do you see instead?
I would expect to see my working copy compared to the revision minus 1 for that file
What version of the product are you using? On what operating system?
Windows XP SP3, git version 1.6.5.1.1367.gcd48, TortoiseGit-1.6.3.0-32bit
-------------------
I notice that the "-n2" parameter (the max number of revisions to return) is being ignored by the
TortoiseGit\ext\tgit\revision.c:setup_revisions()
function since it starts to look at params at index of 1 instead of 0. The result is that
TortoiseGit\src\TortoiseProc\Commands\PrevDiffCommand.cpp:revs.ParserFromLog(&cmdLinePath,2,CGit::LOG_INFO_ONLY_HASH);
returns ALL of the revisions instead of just the last two.
I don't know the code base well enough to address this problem properly, but I have attached a patch (Git-dummy-parameter.patch) that adds a dummy 0th position parameter so that all the important parameters are found. This isn't a good solution, but it seems to work well enough. Mostly, I just want to bring this to someone's attention.
-------------------
I've attached a second patch that modifies the behavior of the "Diff With Previous" command to not care if more than 2 revisions are returned from revs.ParserFromLog(&cmdLinePath,2,CGit::LOG_INFO_ONLY_HASH);
I've also changed the feature so that it compares the working copy to revisions minus 1 for the file.
Diff -> Compares working copy to latest revision checked in
Diff With Previous -> Compares working copy to (latest revision checked in) minus 1
Use case: Doing a diff on a working copy file that hasn't been modified since last check-in will show no changes. Doing a "Diff With Previous" will show the last change made to the file