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

Re: git with custom diff for commits

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 18, 2007, 09:25 UTC
Message-ID
<7vodco1him.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<vpqk5ncz8fn.fsf@bauges.imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Show 12 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> ...
>> I wouldn't do filters for something like that.  Can you guarantee that
>> the output from corresopnding smudge filter will load cleanly back to
>> the mysql database?
>
> The original poster said the date was an SQL comment, so, it should be
> safe to strip it. That said, precommit hook is probably a good or
> better solution. At least, if you're not sure you didn't make a
> mistake writting it, you'll notice either a good commit or no commit
> at all. With filters, you might well notice you corrupted the commit
> too late :-(.

Yeah. After writing the message you are responding to, I realized that I already do something like that to manage html/man branches that are autogenerated, and it is exactly the same situation as Gerald is in.

The autogeneration of documentation and updating of html/man branches is controlled by dodoc.sh script in 'todo' branch, installed as post-update hook in my public repository. It builds the documentation in a checkout of 'master' branch, installs the result into another checkout of 'html' and 'man' branches, and commits.

The twist is in the "install" step (this is different from my suggestion of preventing the commit in pre-commit hook). When the newly generated documentation files are different from the previously generated ones only by datestamp, they are not installed into 'html'/'man' checkouts, and such a change is not included in the commits.

So my updated suggestion would be:
 - Keep a checkout of that mysql dump;
 - Make the dump procedure to dump to that checkout area;
 - Run "git diff HEAD", perhaps with the external diff that filters out
   the cruft as suggested in the thread, and run "git checkout $path"
   for paths that had only meaningless changes;
 - Run "git commit" if the above step did not nuke all changes.
Previous: Matthieu MoyNext: Gerald Gutierrez
Message 7 of 24 in “git with custom diff for commits”
  1. Gerald GutierrezDec 17, 2007
  2. Johannes SchindelinDec 17, 2007
  3. Matthieu MoyDec 17, 2007
  4. Johannes SchindelinDec 17, 2007
  5. Junio C HamanoDec 17, 2007
  6. Matthieu MoyDec 18, 2007
  7. Junio C HamanoDec 18, 2007
  8. Gerald GutierrezDec 18, 2007
  9. Junio C HamanoDec 18, 2007
  10. Gerald GutierrezDec 18, 2007
  11. Johannes SchindelinDec 18, 2007
  12. Gerald GutierrezDec 18, 2007
  13. Johannes SchindelinDec 18, 2007
  14. Junio C HamanoDec 18, 2007
  15. Matthieu MoyDec 18, 2007
  16. Gerald GutierrezDec 18, 2007
  17. Johannes SchindelinDec 18, 2007
  18. Martin LanghoffDec 18, 2007
  19. Matthieu MoyDec 19, 2007
  20. Johannes SchindelinDec 19, 2007
  21. Matthieu MoyDec 19, 2007
  22. Matthieu MoyDec 19, 2007
  23. Gerald GutierrezDec 18, 2007
  24. Gerald GutierrezDec 17, 2007

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.