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

[RFC] git-fetch - repack in the background after fetching

From
MLMartin Langhoff <martin@catalyst.net.nz>
Date
May 30, 2006, 04:42 UTC
Message-ID
<11489641631558-git-send-email-martin@catalyst.net.nz>

Check whether we have a large set of unpacked objects and repack after the fetch, but don't for the user to wait for us.

---

There's been some discussion about repacking proactively without preventing further work. But as Linus said, repacking on an active repo is _safe_, so repack in the background.

If we like this approach, we should at least respect a git-repo-config entry saying core.noautorepack for users who don't want it. I don't really know if there is any convention for us to check if we are in a resource-constrained situation (aka laptops on battery). If there is, we should respect that as well. I suspect anacron and others do this already but I can't find any references.

We can potentially do it on commit, merge and push as well. ---

 git-fetch.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
5498d015eb1062928a504af3c6b3cb9b776088e8
diff --git a/git-fetch.sh b/git-fetch.sh
index 69bd810..4d64cdb 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -424,3 +424,9 @@ case ",$update_head_ok,$orig_head," in
 	fi
 	;;
 esac
+
+if test $(git rev-list --unpacked --all | wc -l) -gt 1000
+then
+	echo "Repacking in the background"
+	nice git repack -a -d -q &
+fi
-- 
1.3.2.g82000
Next: Linus Torvalds
Message 1 of 5 in “[RFC] git-fetch - repack in the background after fetching”
  1. Martin LanghoffMay 30, 2006
  2. Linus TorvaldsMay 30, 2006
  3. Martin LanghoffMay 30, 2006
  4. Daniel BarkalowMay 30, 2006
  5. Linus TorvaldsMay 30, 2006

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.