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

Re: Problem with fsck and invalid submodule path in history

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Jul 29, 2019, 09:39 UTC
Message-ID
<20190729093928.GP20404@szeder.dev>
In-Reply-To
<9C668779-15AC-4099-AAFA-7FFF519D426F@puck.ch>
On Mon, Jul 29, 2019 at 09:58:52AM +0200, Olivier Bornet wrote:
> I have a git repository with an error in a submodule path in the history.
> The submodule path is “-f”, which is not allowed. But for some reason, it’s in the history of the git, and I’m trying to find a way to manage it without having to rewrite the full history on the main gitlab (if possible)...
> 
> To reproduce this unwanted history:
Show 7 quoted lines
> After that, even if the git is working correctly, we have a “bad” history if we check with fsck:
> 
>     $ git fsck
>     Checking object directories: 100% (256/256), done.
>     error in blob 19a97d3b70760c74b780c8134e33f5392292c2e6: gitmodulesPath: disallowed submodule path: -f
> 
> Is it possible to correct it? Must git handle this kind of errors?
To correct without rewriting history, no.

However, you can tell 'git fsck' to ignore it using the 'fsck.skipList' configuration variable (see 'git help config'; for some reason it's not included in 'git fsck's documentation):

  $ cat <<EOF >.git-fsck-skiplist
  > # invalid submodule path
  > 19a97d3b70760c74b780c8134e33f5392292c2e6
  > EOF
  $ git config fsck.skipList .git-fsck-skiplist
  $ git fsck
  Checking object directories: 100% (256/256), done.

It may or may not be worth committing this file, I'm not quite sure what the best practice is. By committing it others don't have to maintain such a skiplist file themselves, though they still have to set the config variable. OTOH, if anyone sets this config variable and attempts to run 'git fsck' while on a branch that doesn't contain this file, then they will get a 'fatal: could not open object name list: .git-fsck-skiplist' error.

And it won't help anyone cloning the repository with 'fetch.fsckObjects' enabled.

Previous: Olivier BornetNext: SZEDER Gábor
Message 2 of 8 in “Problem with fsck and invalid submodule path in history”
  1. Olivier BornetJul 29, 2019
  2. SZEDER GáborJul 29, 2019
  3. Documentation/git-fsck.txt: include fsck.* config variablesSZEDER Gábor, Jul 29, 2019
  4. Ævar Arnfjörð BjarmasonJul 29, 2019
  5. Junio C HamanoJul 29, 2019
  6. Jeff KingJul 29, 2019
  7. Junio C HamanoJul 29, 2019
  8. Olivier BornetJul 29, 2019

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.