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

Re: fsck --full is Ok, but clones are not, "missing commits"?!

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Apr 16, 2008, 16:11 UTC
Message-ID
<48062515.50903@nrlssc.navy.mil>
In-Reply-To
<480619AE.8010506@viscovery.net>
Johannes Sixt wrote:
Show 21 quoted lines
> Brian Foster schrieb:
>>  at toplevel of a (not-bare) clone, with  info/grafts  in-place,
>>  and a happy `fsck -full' (same machine so same git version):
>>
>> 	$ git filter-branch --tag-name-filter cat -- --all  # at not-bare toplevel
>> 	Rewrite 7df30811617517bc4d5ec7c190a435667228320c (168/168)
>> 	Ref 'refs/heads/master' was rewritten
>> 	Ref 'refs/remotes/origin/HEAD' was rewritten
>> 	WARNING: Ref 'refs/remotes/origin/master' is unchanged
>> 	Ref 'refs/tags/linux-2.6.15' was rewritten
>> 	error: Ref refs/tags/linux-2.6.15 is at \
>> 		26a33413c95dfda6c70ca4a83da49cddb7b236b9 but expected \
>> 		2dcaaf2decd31ac9a21d616604c0a7c1fa65d5a4
>> 	fatal: refs/tags/linux-2.6.15: cannot lock the ref
>> 	Could not rewrite refs/tags/linux-2.6.15
>> 	$
> 
> Actually, I don't know how to overcome this situation; maybe forget about
> the tags and remove the '--tag-name-filter cat' part. They wouldn't have
> been rewritten correctly anyway (annotated tags loose the message and
> become unannotated).
I don't think the tag-name-filter section has been reached yet.

I think the problem is the --all option to rev-parse. This adds everything under .git/refs to the list of heads to rewrite. Just a guess, but possibly the linux-2.6.15 is an annotated tag, which is dereferenced to a commit (the oldsha1), and then when update-ref is called with the newsha1 and the oldsha1, the oldsha1 doesn't match what is in refs/tags/linux-2.6.15 since that points to the sha1 of the tag object.

Try --branches instead of --all. Or leave it blank if you just want to filter the current branch.

Also, if you're interested in retaining the annotations from the tags, search the list for '[PATCH v4] filter-branch.sh: support nearly proper tag name filtering' or grab the patch from git's pu branch.

-brandon
Previous: Johannes SixtNext: Dmitry Potapov
Message 3 of 9 in “Re: fsck --full is Ok, but clones are not, "missing commits"?!”
  1. Brian FosterApr 16, 2008
  2. Johannes SixtApr 16, 2008
  3. Brandon CaseyApr 16, 2008
  4. Dmitry PotapovApr 16, 2008
  5. Brian FosterApr 17, 2008
  6. Brandon CaseyApr 17, 2008
  7. Brian FosterApr 18, 2008
  8. Johannes SixtApr 18, 2008
  9. Brian FosterApr 18, 2008

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.