git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Olivier Bornet <olivier.bornet@puck.ch>
Cc: git@vger.kernel.org
Subject: Re: Problem with fsck and invalid submodule path in history
Date: Mon, 29 Jul 2019 11:39:28 +0200	[thread overview]
Message-ID: <20190729093928.GP20404@szeder.dev> (raw)
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:

> 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.


  reply	other threads:[~2019-07-29  9:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-29  7:58 Problem with fsck and invalid submodule path in history Olivier Bornet
2019-07-29  9:39 ` SZEDER Gábor [this message]
2019-07-29  9:59   ` [PATCH] Documentation/git-fsck.txt: include fsck.* config variables SZEDER Gábor
2019-07-29 15:33     ` Ævar Arnfjörð Bjarmason
2019-07-29 15:48       ` Junio C Hamano
2019-07-29 20:12         ` Jeff King
2019-07-29 21:32           ` Junio C Hamano
2019-07-29 14:31   ` Problem with fsck and invalid submodule path in history Olivier Bornet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190729093928.GP20404@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=olivier.bornet@puck.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).