Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • TortoiseGit TortoiseGit
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 382
    • Issues 382
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • TortoiseGitTortoiseGit
  • TortoiseGitTortoiseGit
  • Issues
  • #728
Closed
Open
Issue created Aug 02, 2015 by Sven Strickroth@mrtuxOwner

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?

  1. Find a file with more than two changes
  2. Right click on that file and choose "Diff With Previous"
  3. 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


Git-dummy-parameter.patch

PrevDiffCommand.patch

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking