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

Re: git gc & deleted branches

From
Jeff King <peff@peff.net>
Date
May 9, 2008, 04:19 UTC
Message-ID
<20080509041921.GA14773@sigill.intra.peff.net>
In-Reply-To
<loom.20080509T011318-478@post.gmane.org>
On Fri, May 09, 2008 at 01:41:30AM +0000, Brandon Casey wrote:
Show 6 quoted lines
> Here's what I was thinking (posted using gmane):
> 
> diff --git a/git-repack.sh b/git-repack.sh
> index e18eb3f..064c331 100755
> --- a/git-repack.sh
> +++ b/git-repack.sh

I like it. It makes an easy rule to say "packed objects _never_ get pruned, they only get demoted to loose objects." And then of course we have sane rules for pruning loose objects.

Show 16 quoted lines
> -       rm -f "$PACKDIR/old-pack-$name.pack" "$PACKDIR/old-pack-$name.idx"
> +       rm -f "$PACKDIR/old-pack-$name.idx"
> +       test -z "$keep_unreachable" ||
> +         ! test -f "$PACKDIR/old-pack-$name.pack" ||
> +         git unpack-objects < "$PACKDIR/old-pack-$name.pack" || {
> +               echo >&2 "Failed unpacking unreachable objects from old pack"
> +               echo >&2 "saved as old-pack-$name.pack in $PACKDIR."
> +               exit 1
> +       }
> +       rm -f "$PACKDIR/old-pack-$name.pack"
> [...]
> 
> Is the first invocation of unpack-objects necessary? pack-objects has created
> a pack which hashes to the same name of a pack we already have, and we replace
> the original with the new one. Is that what is happening? They will be
> identical right?

Yeah, that's what it looks like to me (that the first unpack is unnecessary, because we will just be putting the new pack into place that has all the same objects). AIUI, two packs with identical hashes must contain the exact same objects.

Show 5 quoted lines
> Of course this won't set the timestamp on the created objects based on the
> timestamp of the pack file, but this was easy. Setting the timestamp would be
> proper, but what's another two weeks. Besides, for those users not manually
> running git-gc, this code path won't even be executed until there are enough
> pack files for git-gc to add -A to the repack options.
I think the extra two weeks is fine.
-Peff
Previous: drafnel@gmail.comNext: Geert Bosch
Message 26 of 50 in “git gc & deleted branches”
  1. Guido OstkampMay 8, 2008
  2. Jeff KingMay 8, 2008
  3. Guido OstkampMay 8, 2008
  4. Brandon CaseyMay 8, 2008
  5. Guido OstkampMay 8, 2008
  6. Jeff KingMay 8, 2008
  7. Nicolas PitreMay 8, 2008
  8. Jeff KingMay 8, 2008
  9. Brandon CaseyMay 8, 2008
  10. Jeff KingMay 8, 2008
  11. Brandon CaseyMay 8, 2008
  12. Jeff KingMay 8, 2008
  13. Brandon CaseyMay 8, 2008
  14. Jeff KingMay 8, 2008
  15. Brandon CaseyMay 9, 2008
  16. Junio C HamanoMay 9, 2008
  17. 0/3 leave unreferenced objects unpackeddrafnel@gmail.com, May 10, 2008
  18. 1/3 repack: modify behavior of -A option to leave unreferenced objects unpackeddrafnel@gmail.com, May 10, 2008
  19. Jeff KingMay 10, 2008
  20. Nicolas PitreMay 11, 2008
  21. Junio C HamanoMay 11, 2008
  22. Brandon CaseyMay 11, 2008
  23. Brandon CaseyMay 11, 2008
  24. 2/3 git-gc: always use -A when manually repackingdrafnel@gmail.com, May 10, 2008
  25. 3/3 builtin-gc.c: deprecate --prune, it now really has no effectdrafnel@gmail.com, May 10, 2008
  26. Jeff KingMay 9, 2008
  27. Geert BoschMay 9, 2008
  28. Brandon CaseyMay 9, 2008
  29. Jeff KingMay 9, 2008
  30. Brandon CaseyMay 9, 2008
  31. Nicolas PitreMay 9, 2008
  32. Brandon CaseyMay 9, 2008
  33. Junio C HamanoMay 9, 2008
  34. Updating documentation to match Brandon Casey's proposed git-repack patch.Chris Frey, May 9, 2008
  35. Jeremy Maitin-ShepardMay 10, 2008
  36. Shawn O. PearceMay 10, 2008
  37. Jeremy Maitin-ShepardMay 10, 2008
  38. Junio C HamanoMay 10, 2008
  39. Jeremy Maitin-ShepardMay 10, 2008
  40. Jeff KingMay 10, 2008
  41. Jeremy Maitin-ShepardMay 10, 2008
  42. Johannes SchindelinMay 10, 2008
  43. Jeremy Maitin-ShepardMay 10, 2008
  44. Johannes SchindelinMay 11, 2008
  45. Junio C HamanoMay 11, 2008
  46. Guido OstkampMay 8, 2008
  47. Jeff KingMay 8, 2008
  48. Jeff KingMay 8, 2008
  49. Brandon CaseyMay 10, 2008
  50. Brandon CaseyMay 10, 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.