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

Re: git fast-import: how to prevent incremental commit with no changes

From
Junio C Hamano <gitster@pobox.com>
Date
May 6, 2014, 19:18 UTC
Message-ID
<xmqqwqdyemx3.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140505115320.395edd2e@vostro>
Timo Teras <timo.teras@iki.fi> writes:
Show 12 quoted lines
> I'm trying to script a setup that would periodically import a tarball
> to git with fast-import. But things do not always change, so I'd like
> fast-import to be able to not do the commit in case there is no change.
>
> That is, I'm constructing the commit with "deleteall" + importing each
> object by mark after that. Now, in case nothing changed, fast-import
> will happily create an empty commit for me.
>
> Would it be possible to add some flag that would make commit fail in
> case nothing changed?
>
> Any suggestions how to do this?

I am not sure if such a conditional logically belongs to what fast-import does. Would it be an option for your script to rewind the HEAD after the import is done and it finds that the tarball did not have anything interesting new?

Previous: Timo TerasNext: Timo Teras
Message 2 of 3 in “git fast-import: how to prevent incremental commit with no changes”
  1. Timo TerasMay 5, 2014
  2. Junio C HamanoMay 6, 2014
  3. Timo TerasMay 7, 2014

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.