{"thread":{"id":"62555","subject":"Understanding the diff output in gitk when comparing a commit with working tree","startedAt":"2024-11-28T08:28:04Z","lastAt":"2024-11-29T07:38:47Z","messageCount":2,"participants":["tobias.boesch@miele.com","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"508266","messageId":"AS2PR08MB82880324292BB445428393B7E1292@AS2PR08MB8288.eurprd08.prod.outlook.com","threadId":"62555","inReplyTo":"AS2PR08MB82888F1C5AE63BD383E53FE6E1282@AS2PR08MB8288.eurprd08.prod.outlook.com","subject":"Understanding the diff output in gitk when comparing a commit with working tree","fromName":"tobias.boesch@miele.com","fromEmail":"tobias.boesch@miele.com","sentAt":"2024-11-28T08:27:37Z","receivedAt":"2024-11-28T08:28:04Z","isPatch":false,"sender":{"key":"tobias.boesch@miele.com","avatar":"https://avatars.githubusercontent.com/u/64197724?v=4"},"body":"Hello everyone,\n\nin gitk one can compare commits by selecting one commit, then right click on another commit and use the different diff options in the context menu. That works great!\nI found that when comparing a commit with those changes made in the working tree, I don’t understand the following observations I made in the diff output for _some_ files:\n\n- the diff output is not colored in red and green for additions and removals, but in red and bold black (still preceded with “++”, “+-“, “--“ and so on)\n- some files show no differences, but an external diff shows that those differences are there\n- the index of the diff shows an output like mentioned in the “combined diff” format (see https://git-scm.com/docs/diff-format#_combined_diff_format), and looks like “index NUMBER,NUMBER..NUMER”\n\nOther files show up in a “normal” way; as a diff with red and green highlighted lines for additions and removals and no empty file diffs.\n\nTo reproduce this make some more changes in the working tree of a git repo. Then compare an older commit with the working tree in gitk and search for my observations in the diff output.\n\nCan someone please explain me why all this happens?\n\nBest wishes\nTobias\n\n\n\n-------------------------------------------------------------------------------------------------\nimperial-Werke oHG, Sitz Bünde, Registergericht Bad Oeynhausen - HRA 4825\n"},{"id":"508320","messageId":"d88a5f98-55e3-45dc-8f59-b7089096ba1f@kdbg.org","threadId":"62555","inReplyTo":"AS2PR08MB82880324292BB445428393B7E1292@AS2PR08MB8288.eurprd08.prod.outlook.com","subject":"Re: Understanding the diff output in gitk when comparing a commit with working tree","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2024-11-29T07:38:35Z","receivedAt":"2024-11-29T07:38:47Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 28.11.24 um 09:27 schrieb tobias.boesch@miele.com:\n> I found that when comparing a commit with those changes made in the\n> working tree, I don’t understand the following observations I made\n> in the diff output for _some_ files:\n> \n> - the diff output is not colored in red and green for additions and\n> removals, but in red and bold black (still preceded with “++”, “+-“,\n> “--“ and so on)\n\nI will assume that there is no merge conflict. Then you see a combined\ndiff where the \"first parent\" is the index and the \"second parent\" is\nthe commit that you selected.\n\nWithout having looked at the code and its history, I guess that this is\nan accident that nobody has bothered to fix, because it is not a very\nuseful way to show differences between the worktree and a selected commit.\n\n-- Hannes\n\n"}]}