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

Re: git fsck messages - what to do about it?

From
Junio C Hamano <junkio@cox.net>
Date
Sep 16, 2005, 17:02 UTC
Message-ID
<7vll1xndxi.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20050916110310.90115352B7B@atlas.denx.de>
Wolfgang Denk <wd@denx.de> writes:
> Ummm.... I hesitate to  do  this  before  understanding  where  these
> messages come from and what sort of data is affected.

Does git-fsck-cache without --unreachable report dangling commits? If so I would do something like this (this is my 'git-lost-found' script):

        #!/bin/sh
        . git-sh-setup-script || die "Not a git archive."
        laf="$GIT_DIR/refs/lost-found"
        mkdir -p "$laf" || exit
        git fsck-cache |
        while read dangling type sha1
        do
                case "$dangling" in
                dangling)
                        echo "$sha1" >"$laf/$sha1"
                        case "$type" in
                        commit)
                                git-show-branch "$sha1" ;;
                        esac
                        ;;
                esac
        done

and run 'gitk --all' to see what these dangling commits are, and where in your commit ancestry mesh they fit in.

After you understand what they are, do not forget to "rm -f $GIT_DIR/refs/lost-found/*"; you made them reachable just to make inspecting them easier, but you probably do not want them.

I can sort of understand dangling blobs can come from manually resolved merges, but I do not think that would create dangling commits.

Have you rewound and rebased your history? 'git reset --hard' obviously throws the tip of the current branch away and 'git rebase' does it in order to recreate an alternate history. If that is the case, and if you are satisfied with the history your repository currently have, then obviously these can be safely pruned.

Another possibility is what Pasky suggested -- do you have a symlink .git/objects in another repository that points at the .git/objects directory of this repository? These dangling things may be objects the other repository needs. If that is the case you obviously cannot prune them -- you would corrupt the other repository.

Previous: Wolfgang DenkNext: Petr Baudis
Message 4 of 9 in “git fsck messages - what to do about it?”
  1. Wolfgang DenkSep 16, 2005
  2. Catalin MarinasSep 16, 2005
  3. Wolfgang DenkSep 16, 2005
  4. Junio C HamanoSep 16, 2005
  5. Petr BaudisSep 16, 2005
  6. Linus TorvaldsSep 16, 2005
  7. Linus TorvaldsSep 16, 2005
  8. Linus TorvaldsSep 18, 2005
  9. Junio C HamanoSep 18, 2005

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.