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

Re: [PATCH] fsck --lost-found: write blob's contents, not their SHA-1

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 22, 2007, 21:52 UTC
Message-ID
<Pine.LNX.4.64.0707222246220.14781@racer.site>
In-Reply-To
<7vodi4qfnx.fsf@assigned-by-dhcp.cox.net>
Hi,
On Sun, 22 Jul 2007, Junio C Hamano wrote:
Show 10 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > When looking for a lost blob, it is much nicer to be able to grep
> > through .git/lost-found/other/* than to write an inefficient loop
> > over the file names.  So write the contents of the dangling blobs,
> > not their object names.
> 
> I think this is an idea to solve a good problem, but if we go
> this route, the need for us to worry about expiring lost-found
> entries would become more urgent, I suspect.

Why? AFAICT lost+found/ has to be cleaned by people. So if you look for something, you say "git fsck --lost-found", and once you found it, it's time for "rm -rf .git/lost-found".

Show 8 quoted lines
> And when you think about expiring lost-found entries, another
> possible solution emerges.  If we teach git-prune to remove the
> corresponding entry from lost-found/other when it removes a
> loose blob from the object store, then we can easily and safely
> do this instead:
> 
> 	$ cat .git/lost-found/other/* |
> 	  xargs -r git grep 'the word to look for'
Well, it is not only for grepping.  In my case, I could get away by this:
$ ls -lrt $(grep -l filter_subdir .git/lost-found/other/* |
	sed "s/^.*other\/\(..\)/.git\/objects\/\1\//") 

IOW I found the loose dangling objects which matched a keyword, and sorted them by time.

In other cases, though, I wanted to see the size.

But what the whole thing boils down to: After finding dangling objects, you are much more likely using git tools on non-blobs than on blobs, and vice versa.

Ciao, Dscho

P.S.: I fully forgot to mention that happily, I did "git add -u" sometime before "git reset --hard", otherwise I would have been lost.

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “fsck --lost-found: write blob's contents, not their SHA-1”
  1. fsck --lost-found: write blob's contents, not their SHA-1Johannes Schindelin, Jul 22, 2007
  2. Junio C HamanoJul 22, 2007
  3. Johannes SchindelinJul 22, 2007
  4. Junio C HamanoJul 22, 2007

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.