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

Re: Salvaging borked project history

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 26, 2015, 18:56 UTC
Message-ID
<xmqqh9u8mrha.fsf@gitster.dls.corp.google.com>
In-Reply-To
<54EF098B.4080803@free.fr>
Mason <slash.tmp@free.fr> writes:
Show 13 quoted lines
> Thanks! At least now, I see the light at the end of the tunnel.
>
> I fetched linux-stable.git inside our repo.
> I created ~300 patches using git format-patch -1 in a loop.
> I can now run 'git am --3way $IGNORE *.patch'
>
> IGNORE is used to --exclude the directories I'm not interested in.
>
> Note: it seems --exclude=arch/mips and --exclude=arch/mips/ are
> not sufficient, I need to write --exclude=arch/mips/* for git-apply
> to ignore changes to files inside arch/mips.
>
> Is that expected behavior?

I have no idea; at least to me, "--exclude" option to "git apply" was invented to name individual paths, not patterns, and I wouldn't be surprised if glob working were merely by accident not by design.

> Another nit: if a patch contains only changes to files inside arch/mips
> then git-apply will create an "empty commit" (one with no diff). Is there
> an option to say "skip empty patches"?
"git am --skip" perhaps?

"git am" may pass the "--exclude/--include" options to "git apply" but I wouldn't be surprised if that support was added without thinking. Perhaps the reason why you discovered that it needed a lot more thinking to properly integrate these options to "git am" only now is because hardly anybody uses it ;-). Not just passing these options, the code in "git am" to react to the result of patch application to avoid the issue you observed when these options are passed need to be adjusted by changes that started passing them, but I do not think they did, cf. 77e9e496 (am: pass exclude down to apply, 2011-08-03).

> One more thing: "regular" diff -q returns 0 when the files are identical,
> and 1 when they differ. It seems git diff -s does not have that behavior.
> Is that by design?

"diff -s" may be accepted but it is an idiotic thing for a user to say. The "-s" option is to squelch output from "log" and friends, and it is exposed to "diff" only because these two families of commands share the command line parser.

Previous: MasonNext: Mason
Message 4 of 9 in “Salvaging borked project history”
  1. MasonFeb 23, 2015
  2. Junio C HamanoFeb 23, 2015
  3. MasonFeb 26, 2015
  4. Junio C HamanoFeb 26, 2015
  5. MasonFeb 26, 2015
  6. Junio C HamanoFeb 26, 2015
  7. MasonFeb 26, 2015
  8. Junio C HamanoFeb 26, 2015
  9. MasonMar 4, 2015

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.