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

git-repack.sh not server/multiuse safe?

From
MFMartin Fick <mfick@codeaurora.org>
Date
Sep 5, 2012, 21:18 UTC
Message-ID
<201209051518.34009.mfick@codeaurora.org>

I have been reading the git-repack.sh script and I have found a piece that I am concerned with. It looks like after repacking there is a place when packfiles could be temporarily unaccessible making the objects within temporarily unaccessible. If my evaluation is true, it would seem like git repacking is not "server" safe?

In particular, I am talking about this loop:
 # Ok we have prepared all new packfiles.
 # First see if there are packs of the same name and if so
 # if we can move them out of the way (this can happen if we
 # repacked immediately after packing fully.
 rollback=
 failed=
 for name in $names
 do
        for sfx in pack idx
        do
                file=pack-$name.$sfx
                test -f "$PACKDIR/$file" || continue
                rm -f "$PACKDIR/old-$file" &&
                mv "$PACKDIR/$file" "$PACKDIR/old-$file" ||  
{
                        failed=t
                        break
                }
                rollback="$rollback $file"
        done
        test -z "$failed" || break
 done

It would seem that one way to avoid this (at least on systems supporting hardlinks), would be to instead link the original packfile to old-file first, then move the new packfile in place without ever deleting the original one (from its original name), only delete the old-file link. Does that make sense at all?

Thanks,
-Martin
-- 
Employee of Qualcomm Innovation Center, Inc. which is a 
member of Code Aurora Forum
Message 1 of 1 in “git-repack.sh not server/multiuse safe?”
  1. Martin FickSep 5, 2012

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.