{"thread":{"id":"45469","subject":"Question: xdiff and \"pretty\" (human readable) diff output","startedAt":"2017-03-22T19:31:21Z","lastAt":"2017-03-22T19:48:05Z","messageCount":3,"participants":["matthew@giassa.net","Stefan Beller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"314948","messageId":"20170322192340.elg2gpvcshhk3jq3@darkstar","threadId":"45469","inReplyTo":null,"subject":"Question: xdiff and \"pretty\" (human readable) diff output","fromName":"","fromEmail":"matthew@giassa.net","sentAt":"2017-03-22T19:23:40Z","receivedAt":"2017-03-22T19:31:21Z","isPatch":false,"sender":{"key":"matthew@giassa.net","avatar":null},"body":"Good day,\n\nI have a question with respect to how git generates \"pretty\" (ie: human\nreadable) unified diffs. It's to my understanding that git uses its own\n(simplified/minimized) fork of libxdiff, simply referred to as \"xdiff\"\n[1]. Which tool/library is used to take the xdiff output and generate\nthe human-readable equivalent that is rendered to the console? I have a\nprogram that I'm maintaining that currently tracks changes to a couple\nof \"sandboxed\" files, and I wanted to add a simple console UI that\nperiodically shows the changes to the files over time and/or dumps the\n\"pretty diff\" to syslog.\n\nThank you.\n\n1. \"Use a *real* built-in diff generator Â· git/git@3443546\",\n   <https://github.com/git/git/commit/3443546f6ef57fe28ea5cca232df8e400bfc3883>,\n   Accessed 2017-03-22\n\n--Matthew\n\n"},{"id":"314951","messageId":"CAGZ79kZ+BGG6yj_rEvjDNf3gmV5KPgvOvLfH94VdPudzbGCkyA@mail.gmail.com","threadId":"45469","inReplyTo":"20170322192340.elg2gpvcshhk3jq3@darkstar","subject":"Re: Question: xdiff and \"pretty\" (human readable) diff output","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-03-22T19:43:41Z","receivedAt":"2017-03-22T19:44:28Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Mar 22, 2017 at 12:23 PM,  <matthew@giassa.net> wrote:\n> Good day,\n>\n> I have a question with respect to how git generates \"pretty\" (ie: human\n> readable) unified diffs. It's to my understanding that git uses its own\n> (simplified/minimized) fork of libxdiff, simply referred to as \"xdiff\"\n> [1].\n\ncorrect.\n\n> Which tool/library is used to take the xdiff output and generate\n> the human-readable equivalent that is rendered to the console?\n\nGit itself. Have a look at diff.c (it's only 5k lines of code ;)\n\nMaybe start with fn_out_consume which is a callback (for xdiff)\nthat is responsible for pretty printing the output, i.e. transforming the\noutput of xdiff according to Gits configuration.\n\n> I have a\n> program that I'm maintaining that currently tracks changes to a couple\n> of \"sandboxed\" files, and I wanted to add a simple console UI that\n> periodically shows the changes to the files over time and/or dumps the\n> \"pretty diff\" to syslog.\n\n> over time\n\nSo you could use cron for that?\n\n>  \"pretty diff\" to syslog.\n\nSo you want to modify the \"pretty diff\"?\nMaybe that can be archived by a custom format\n(see the git *log* man page) and doesn't require hacking.\n\nThanks,\nStefan\n"},{"id":"314953","messageId":"20170322194751.tpzsnnuaxgt7jyvt@darkstar","threadId":"45469","inReplyTo":"CAGZ79kZ+BGG6yj_rEvjDNf3gmV5KPgvOvLfH94VdPudzbGCkyA@mail.gmail.com","subject":"Re: Question: xdiff and \"pretty\" (human readable) diff output","fromName":"","fromEmail":"matthew@giassa.net","sentAt":"2017-03-22T19:47:51Z","receivedAt":"2017-03-22T19:48:05Z","isPatch":false,"sender":{"key":"matthew@giassa.net","avatar":null},"body":"* Stefan Beller <sbeller@google.com> [2017-03-22 12:43:41 -0700]:\n\n>On Wed, Mar 22, 2017 at 12:23 PM,  <matthew@giassa.net> wrote:\n>> Good day,\n>>\n>> I have a question with respect to how git generates \"pretty\" (ie: human\n>> readable) unified diffs. It's to my understanding that git uses its own\n>> (simplified/minimized) fork of libxdiff, simply referred to as \"xdiff\"\n>> [1].\n>\n>correct.\n>\n>> Which tool/library is used to take the xdiff output and generate\n>> the human-readable equivalent that is rendered to the console?\n>\n>Git itself. Have a look at diff.c (it's only 5k lines of code ;)\n>\n>Maybe start with fn_out_consume which is a callback (for xdiff)\n>that is responsible for pretty printing the output, i.e. transforming the\n>output of xdiff according to Gits configuration.\n>\n>> I have a\n>> program that I'm maintaining that currently tracks changes to a couple\n>> of \"sandboxed\" files, and I wanted to add a simple console UI that\n>> periodically shows the changes to the files over time and/or dumps the\n>> \"pretty diff\" to syslog.\n>\n>> over time\n>\n>So you could use cron for that?\n>\n>>  \"pretty diff\" to syslog.\n>\n>So you want to modify the \"pretty diff\"?\n>Maybe that can be archived by a custom format\n>(see the git *log* man page) and doesn't require hacking.\n>\n>Thanks,\n>Stefan\n\nThank you Stefan. This provides me with everything I need.\n\nCheers!\n\n-- \nMatthew Giassa\ne: matthew@giassa.net\n\n"}]}