{"thread":{"id":"12727","subject":"gitk: how to apply '--color-words' to the diff command","startedAt":"2008-03-17T19:18:53Z","lastAt":"2008-03-18T20:58:40Z","messageCount":3,"participants":["Dirk Süsserott"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"72311","messageId":"47DEC41D.9050409@dirk.my1.cc","threadId":"12727","inReplyTo":null,"subject":"gitk: how to apply '--color-words' to the diff command","fromName":"Dirk Süsserott","fromEmail":"newsletter@dirk.my1.cc","sentAt":"2008-03-17T19:18:53Z","receivedAt":"2008-03-17T19:18:53Z","isPatch":false,"sender":{"key":"newsletter@dirk.my1.cc","avatar":null},"body":"Hello,\n\na few days ago I found a patch for gitk that adds a checkbox 'Ignore \nspace change' to the gitk GUI and -- when clicked -- adds the '-w' \nswitch to the diff command. I found that a very convenient way to see \n'what has really changed'. The patch was contributed by Steffen Prohaska \nand has sha1 b9b86007e27d9a06d58feab618a5be1d491ed13e in the\ngit://git.kernel.org/pub/scm/git/git.git repository.\n\nInspired by this, I thought a '--color-words' switch would be even more\nconvenient. I took the patch as a template and kinda replaced all\noccurences of '-w' with '--color-words' (do not take this literally).\n\nUnfortunately gitk then shows the diffs not colorized but with those \nugly escape sequences instead. I'm not a Python person and just able to \n'copy and waste', but probably some of you had the same idea and got it \nright.\n\nDirk\n"},{"id":"72447","messageId":"47E02C32.10009@suesserott.de","threadId":"12727","inReplyTo":"47DEC41D.9050409@dirk.my1.cc","subject":"Re: gitk: how to apply '--color-words' to the diff command","fromName":"Dirk Süsserott","fromEmail":"poststelle@suesserott.de","sentAt":"2008-03-18T20:55:14Z","receivedAt":"2008-03-18T20:55:14Z","isPatch":false,"sender":{"key":"poststelle@suesserott.de","avatar":null},"body":">\n> a few days ago I found a patch for gitk that adds a checkbox 'Ignore \n> space change' to the gitk GUI and -- when clicked -- adds the '-w' \n> switch to the diff command. I found that a very convenient way to see \n> 'what has really changed'. The patch was contributed by Steffen \n> Prohaska and has sha1 b9b86007e27d9a06d58feab618a5be1d491ed13e in the\n> git://git.kernel.org/pub/scm/git/git.git repository.\n>\n> Inspired by this, I thought a '--color-words' switch would be even more\n> convenient. I took the patch as a template and kinda replaced all\n> occurences of '-w' with '--color-words' (do not take this literally).\n>\n> Unfortunately gitk then shows the diffs not colorized but with those \n> ugly escape sequences instead. I'm not a Python person and just able \n> to 'copy and waste', but probably some of you had the same idea and \n> got it right.\n>\nI'm not only not a Python person but also not a Tcl person. Did't even \nfigure out the difference. :-(\n\nHowever, what I figured out is that it's not as simple as I thought: The \ncolorization in question is hard coded in the last 'else' branch of \n'getblobdiffline'. When a line starts with a '+' or '-', then it's shown \nin green or red. To support the --color-words switch it would be \nneccessary to actually parse diff's output wrt. to the colors. Not that \neasy, I guess.\n\nSorry for the noise.\n\nDirk\n"},{"id":"72465","messageId":"47E02D00.2080703@dirk.my1.cc","threadId":"12727","inReplyTo":"47DEC41D.9050409@dirk.my1.cc","subject":"Re: gitk: how to apply '--color-words' to the diff command","fromName":"Dirk Süsserott","fromEmail":"newsletter@dirk.my1.cc","sentAt":"2008-03-18T20:58:40Z","receivedAt":"2008-03-18T20:58:40Z","isPatch":false,"sender":{"key":"newsletter@dirk.my1.cc","avatar":null},"body":">\n> a few days ago I found a patch for gitk that adds a checkbox 'Ignore \n> space change' to the gitk GUI and -- when clicked -- adds the '-w' \n> switch to the diff command. I found that a very convenient way to see \n> 'what has really changed'. The patch was contributed by Steffen \n> Prohaska and has sha1 b9b86007e27d9a06d58feab618a5be1d491ed13e in the\n> git://git.kernel.org/pub/scm/git/git.git repository.\n>\n> Inspired by this, I thought a '--color-words' switch would be even more\n> convenient. I took the patch as a template and kinda replaced all\n> occurences of '-w' with '--color-words' (do not take this literally).\n>\n> Unfortunately gitk then shows the diffs not colorized but with those \n> ugly escape sequences instead. I'm not a Python person and just able \n> to 'copy and waste', but probably some of you had the same idea and \n> got it right.\n>\nI'm not only not a Python person but also not a Tcl person. Did't even \nfigure out the difference. Sorry for that.\n\nHowever, what I figured out is that it's not as simple as I thought: The \ncolorization in question is hard coded in the last 'else' branch of \n'getblobdiffline'. When a line starts with a '+' or '-', then it's shown \nin green or red. To support the --color-words switch it would be \nneccessary to actually parse diff's output wrt. to the colors.\n\nSorry for the noise.\n\nDirk\n"}]}