* Question: xdiff and "pretty" (human readable) diff output
@ 2017-03-22 19:23 matthew
2017-03-22 19:43 ` Stefan Beller
0 siblings, 1 reply; 3+ messages in thread
From: matthew @ 2017-03-22 19:23 UTC (permalink / raw)
To: git
Good day,
I have a question with respect to how git generates "pretty" (ie: human
readable) unified diffs. It's to my understanding that git uses its own
(simplified/minimized) fork of libxdiff, simply referred to as "xdiff"
[1]. Which tool/library is used to take the xdiff output and generate
the human-readable equivalent that is rendered to the console? I have a
program that I'm maintaining that currently tracks changes to a couple
of "sandboxed" files, and I wanted to add a simple console UI that
periodically shows the changes to the files over time and/or dumps the
"pretty diff" to syslog.
Thank you.
1. "Use a *real* built-in diff generator · git/git@3443546",
<https://github.com/git/git/commit/3443546f6ef57fe28ea5cca232df8e400bfc3883>,
Accessed 2017-03-22
--Matthew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question: xdiff and "pretty" (human readable) diff output
2017-03-22 19:23 Question: xdiff and "pretty" (human readable) diff output matthew
@ 2017-03-22 19:43 ` Stefan Beller
2017-03-22 19:47 ` matthew
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Beller @ 2017-03-22 19:43 UTC (permalink / raw)
To: matthew; +Cc: git@vger.kernel.org
On Wed, Mar 22, 2017 at 12:23 PM, <matthew@giassa.net> wrote:
> Good day,
>
> I have a question with respect to how git generates "pretty" (ie: human
> readable) unified diffs. It's to my understanding that git uses its own
> (simplified/minimized) fork of libxdiff, simply referred to as "xdiff"
> [1].
correct.
> Which tool/library is used to take the xdiff output and generate
> the human-readable equivalent that is rendered to the console?
Git itself. Have a look at diff.c (it's only 5k lines of code ;)
Maybe start with fn_out_consume which is a callback (for xdiff)
that is responsible for pretty printing the output, i.e. transforming the
output of xdiff according to Gits configuration.
> I have a
> program that I'm maintaining that currently tracks changes to a couple
> of "sandboxed" files, and I wanted to add a simple console UI that
> periodically shows the changes to the files over time and/or dumps the
> "pretty diff" to syslog.
> over time
So you could use cron for that?
> "pretty diff" to syslog.
So you want to modify the "pretty diff"?
Maybe that can be archived by a custom format
(see the git *log* man page) and doesn't require hacking.
Thanks,
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question: xdiff and "pretty" (human readable) diff output
2017-03-22 19:43 ` Stefan Beller
@ 2017-03-22 19:47 ` matthew
0 siblings, 0 replies; 3+ messages in thread
From: matthew @ 2017-03-22 19:47 UTC (permalink / raw)
To: Stefan Beller; +Cc: git@vger.kernel.org
* Stefan Beller <sbeller@google.com> [2017-03-22 12:43:41 -0700]:
>On Wed, Mar 22, 2017 at 12:23 PM, <matthew@giassa.net> wrote:
>> Good day,
>>
>> I have a question with respect to how git generates "pretty" (ie: human
>> readable) unified diffs. It's to my understanding that git uses its own
>> (simplified/minimized) fork of libxdiff, simply referred to as "xdiff"
>> [1].
>
>correct.
>
>> Which tool/library is used to take the xdiff output and generate
>> the human-readable equivalent that is rendered to the console?
>
>Git itself. Have a look at diff.c (it's only 5k lines of code ;)
>
>Maybe start with fn_out_consume which is a callback (for xdiff)
>that is responsible for pretty printing the output, i.e. transforming the
>output of xdiff according to Gits configuration.
>
>> I have a
>> program that I'm maintaining that currently tracks changes to a couple
>> of "sandboxed" files, and I wanted to add a simple console UI that
>> periodically shows the changes to the files over time and/or dumps the
>> "pretty diff" to syslog.
>
>> over time
>
>So you could use cron for that?
>
>> "pretty diff" to syslog.
>
>So you want to modify the "pretty diff"?
>Maybe that can be archived by a custom format
>(see the git *log* man page) and doesn't require hacking.
>
>Thanks,
>Stefan
Thank you Stefan. This provides me with everything I need.
Cheers!
--
Matthew Giassa
e: matthew@giassa.net
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-22 19:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-22 19:23 Question: xdiff and "pretty" (human readable) diff output matthew
2017-03-22 19:43 ` Stefan Beller
2017-03-22 19:47 ` matthew
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox