Search code examples
gittortoisegitgit-diff

Error when using TortoiseGit diff command with new added file in commit


I try to make my custom program working with git. Some task like compare difference between two files I just create new process and run TortoiseGit Commands like this

/command:diff /startrev:20404fc1039ce9ee73f0d16213319afe480b0a05 /endrev:294e111888ed87a8c93a898f6e6f061b15250e0d /path:D:/Project/ReportingTool/Src/Reports.Types/Report.cs

On modified committed file, I got the same result as TortoiseGit UI. picture here

the problem is, on new added committed file there are no file in previous revision to checkout to compare. an error says

failed to checkout file "files/powershell/App_BuildAndDeploy.ps1" of 
revision 62f7869c1780e6501ec1c4dc0387f03efbde10da to 
"C:\Users\ME\AppData\Local\Temp\TortoiseGit\AppAAD3.tmp\App_BuildAndDeploy-
62f7869-left.ps1" libgit2 returned:the path 'App_BuildAndDeploy.ps1' does 
not exist in the given tree

How to get a result like TortoiseGit like this picture, desired result.

i know i can just create new empty file somewhere and use it to compare but i am not sure that is the best/correct way to do it


Solution

  • This was an issue in older versions of TortoiseGit and is fixed in TortoiseGit 2.5.0.

    Please note: That /startrev: and /endrev: parameters were mixed up in older versions, you might need to ajust these values.