* Re: a problem with git diff [not found] <65cbee30-fa37-1422-98f2-2c2b5aa094bd@maurel.de> @ 2020-04-16 22:55 ` brian m. carlson [not found] ` <24a180f6-cc7e-fe5b-e810-0fc717d601ea@maurel.de> 0 siblings, 1 reply; 4+ messages in thread From: brian m. carlson @ 2020-04-16 22:55 UTC (permalink / raw) To: Guy Maurel; +Cc: git [-- Attachment #1: Type: text/plain, Size: 1556 bytes --] On 2020-04-16 at 16:43:40, Guy Maurel wrote: > Hello! > > Using the appended two files: > git diff combine.cpp-2020-04-16-A combine.cpp-2020-04-16-R > git-diff.diff-Y > > doesn't show the same differences as with: > meld combine.cpp-2020-04-16-R combine.cpp-2020-04-16-A > > Have a look at git-diff.diff-Y at line 210: > -static void process_returns(void) > +static void mark_lvalue(chunk_t *pc) > > which is NOT correct. It looks like there's some additional code that gets inserted before the process_returns function. In this case, the diff is accurate in that applying it to the old file will result in the new file, but it's not very helpful. The reason is that the default diff algorithm, myers, looks for common lines and finds them in the blank lines in both process_returns and the new code above it. It then writes the diff as a set of deletions of the lines in process_returns and an addition of the lines in the new code, plus a final addition of the process_returns function. While correct, this is, as you noted, confusing. If you're looking for a more helpful output, you can use --diff-algorithm=patience (or diff.algorithm=patience), which results in a diff output that more logically matches what most humans would like to see. You can also use the histogram diff algorithm, which is based on patience but has some additional heuristics. Which one produces better output differs depending on the circumstance. -- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 263 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <24a180f6-cc7e-fe5b-e810-0fc717d601ea@maurel.de>]
* Re: a problem with git diff [not found] ` <24a180f6-cc7e-fe5b-e810-0fc717d601ea@maurel.de> @ 2020-04-17 20:33 ` brian m. carlson 2020-04-17 21:32 ` Junio C Hamano 2020-04-22 9:10 ` Pratyush Yadav 0 siblings, 2 replies; 4+ messages in thread From: brian m. carlson @ 2020-04-17 20:33 UTC (permalink / raw) To: Guy Maurel; +Cc: git [-- Attachment #1: Type: text/plain, Size: 412 bytes --] On 2020-04-17 at 12:23:35, Guy Maurel wrote: > Hello again! > > Using .git/config with > [diff] > algorithm = patience > > doesn't work with "git gui" > What is to do? I don't know because I don't use git-gui. If you would, please keep the list in CC, so that other folks who do know the answer can chime in. -- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 263 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: a problem with git diff 2020-04-17 20:33 ` brian m. carlson @ 2020-04-17 21:32 ` Junio C Hamano 2020-04-22 9:10 ` Pratyush Yadav 1 sibling, 0 replies; 4+ messages in thread From: Junio C Hamano @ 2020-04-17 21:32 UTC (permalink / raw) To: brian m. carlson; +Cc: Guy Maurel, git "brian m. carlson" <sandals@crustytoothpaste.net> writes: > I don't know because I don't use git-gui. If you would, please keep the > list in CC, so that other folks who do know the answer can chime in. I do not use git-gui, either, but IIRC, it stayed away from scripting around Porcelain commands, so it is not all that surprising that it does not use diff.algorithm. There is gui.diffopts configuration used in git-gui/lib/diff.tcl:: lappend cmd -p lappend cmd --color set cmd [concat $cmd $repo_config(gui.diffopts)] if {$repo_config(gui.diffcontext) >= 1} { lappend cmd "-U$repo_config(gui.diffcontext)" } so perhaps you can pass --patience via that configuration? I.e. [gui] diffopts = --patience in .git/config? ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: a problem with git diff 2020-04-17 20:33 ` brian m. carlson 2020-04-17 21:32 ` Junio C Hamano @ 2020-04-22 9:10 ` Pratyush Yadav 1 sibling, 0 replies; 4+ messages in thread From: Pratyush Yadav @ 2020-04-22 9:10 UTC (permalink / raw) To: brian m. carlson, Guy Maurel, git On 17/04/20 08:33PM, brian m. carlson wrote: > On 2020-04-17 at 12:23:35, Guy Maurel wrote: > > Hello again! > > > > Using .git/config with > > [diff] > > algorithm = patience > > > > doesn't work with "git gui" > > What is to do? The bug has been reported on this list before. I will try to fix it when I can find the time. In the meantime, please use Junio's suggestion as a workaround. > I don't know because I don't use git-gui. If you would, please keep the > list in CC, so that other folks who do know the answer can chime in. -- Regards, Pratyush Yadav ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-22 9:10 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <65cbee30-fa37-1422-98f2-2c2b5aa094bd@maurel.de> 2020-04-16 22:55 ` a problem with git diff brian m. carlson [not found] ` <24a180f6-cc7e-fe5b-e810-0fc717d601ea@maurel.de> 2020-04-17 20:33 ` brian m. carlson 2020-04-17 21:32 ` Junio C Hamano 2020-04-22 9:10 ` Pratyush Yadav
Code repositories for project(s) associated with this public inbox https://80x24.org/mirrors/git.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).