git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: make git ignore the timestamp embedded in PDFs

From
ALAndreas Leha <andreas.leha@med.uni-goettingen.de>
Date
May 18, 2013, 18:09 UTC
Message-ID
<87ip2ggnx9.fsf@med.uni-goettingen.de>
In-Reply-To
<5197AD3A.5050500@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 31 quoted lines
> Am 18.05.2013 09:42, schrieb Andreas Leha:
>>> Am 14.05.2013 15:17, schrieb Andreas Leha:
>>>> Hi all,
>>>>
>>>> how can I make git ignore the time stamp(s) in a PDF.  Two PDFs that
>>>> differ only in these time stamps should be considered identical.
>>>> ...
>>>> What I tried is a filter:
>>>> ,----[ ~/.gitconfig ]
>>>> | [filter "pdfresetdate"]
>>>> |         clean = pdfresetdate
>>>> `----
>>>>
>>>> This 'works' as far as the committed pdf indeed has the date reset to my
>>>> default value.
>>>>
>>>> However, when I re-checkout the files, they are marked modified by git.
>>>
>>> I'm using cleaned files every now and then, but not on Linux. I have
>>> never observed this behavior recently.
>>>
>>> If you 'git add' the file, does it keep its modified state? Does 'git
>> 
>> yes.
>> 
>>> diff' tell a difference?
>> 
>> no.
>
> I do not believe you. I'm sure that "Binary files differ" was
> reported.

You are correct, of course. I had forgotten that I also had enabled a special diff for pdf files, that reports the difference in the pdfinfo output.

Show 9 quoted lines
> The reason is that your pdfresetdate script is not idempotent. Look:
>
> $ pdfresetdate < x.pdf > y.pdf
> $ pdfresetdate < y.pdf > z.pdf
> $ md5sum x.pdf y.pdf z.pdf
> c46a7097574a035e89d1a46d93c83528  x.pdf
> 8e6d942b4cc7d8a4dfe6898867573617  y.pdf
> e6333bc0f8ab9781d3e1d811a392d516  z.pdf
>

Thanks for that. I had not noticed due to the non-binary diff I had enabled.

> A file that was already cleaned by the clean filter must not be
> modified, i.e., the y.pdf and z.pdf should be identical. But they are not.
>
> Fix your clean filter.
I will (try to) do.  Anyway, git seems unresponsible for my issue.
Thanks for that clear analysis!

Regards, Andreas

Previous: Johannes Sixt
Message 5 of 5 in “make git ignore the timestamp embedded in PDFs”
  1. Andreas LehaMay 14, 2013
  2. Johannes SixtMay 14, 2013
  3. Andreas LehaMay 18, 2013
  4. Johannes SixtMay 18, 2013
  5. Andreas LehaMay 18, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.