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
Dmitry Potapov <dpotapov@gmail.com>
Date
Apr 16, 2008, 16:17 UTC
Message-ID
<20080416161742.GC3133@dpotapov.dyndns.org>
In-Reply-To
<48061388.6090705@viscovery.net>
On Wed, Apr 16, 2008 at 04:56:08PM +0200, Johannes Sixt wrote:
Show 5 quoted lines
> 
> No. The reason why git clone'd repositories have problems is that
> git-upload-pack sends a pack that does not contain the hidden objects; but
> since the cloned repository doesn't have the info/grafts, it tries to look
> up the hidden, now missing, objects, and fails.

In my experiment, there was no problem with hidden commits and objects as long as they presented in the original repository. Maybe, it is because I cloned it as locally using:

   git clone PATH-TO-ORIG-REPO PATH-TO-DEST-REPO
Maybe things would be as you say if I used git://
Show 6 quoted lines
> 
> Actually, no. The trouble is that *all* tools obey grafts. Hence,
> git-repack -f -d -a will remove the hidden objects. But a subsequent fsck
> won't notice, because it *also* obeys the grafts. git prune will remove
> hidden objects only as long as they are loose; if they are already packed,
> then only a repack -f will remove them.

I use git 1.5.5 and I have a script that creates are repo with a hidden commit and then it cleans the reflog cleaned (as it would be happen after expiration of gc.reflogExpire). Then I run 'git-repack -f -d -a' and the hidden commit still presents, but when I run 'git prune' then the hidden object disappear. You can try it for yourself. Here is the script, I used:

=== #!/bin/sh

set -e

mkdir t5 cd t5 git init

echo 1 > foo git add foo git commit -m 'add foo' R1=$(git rev-parse HEAD)

echo 2 >> foo git commit -m 'edit foo' -a R2=$(git rev-parse HEAD)

echo 3 >> foo git commit -m 'edit foo again' -a R3=$(git rev-parse HEAD)

set -x git log echo "$R3 $R1" > .git/info/grafts git log git-fsck --unreachable : > .git/logs/HEAD : > .git/logs/refs/heads/master git-fsck --unreachable git gc git-fsck --unreachable

git-repack -f -d -a git-fsck --unreachable

git prune git-fsck --unreachable ===

Dmitry
Previous: Johannes SixtNext: Jakub Narebski
Message 8 of 10 in “Re: Re: Re: fsck --full is Ok, but clones are not, "missing commits"?!”
  1. Brian FosterApr 16, 2008
  2. Dmitry PotapovApr 16, 2008
  3. Petr BaudisApr 16, 2008
  4. Dmitry PotapovApr 16, 2008
  5. Johannes SixtApr 16, 2008
  6. Dmitry PotapovApr 16, 2008
  7. Johannes SixtApr 16, 2008
  8. Dmitry PotapovApr 16, 2008
  9. Jakub NarebskiApr 16, 2008
  10. Johannes SixtApr 17, 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.