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
Jun 24, 2006, 11:30 UTC
Message-ID
<11511486003924-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. Conditional on core.autorepack =! no.

Having ' handle concurrent pruning of packed objects' (637cdd9d1d997fca34a1fc668fed1311e30fe95f) from Jeff King it should be safe to repack and prune in the background.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
---

This is a follow up to a similar patch earlier http://www.gelato.unsw.edu.au/archives/git/0605/21401.html -- is there interest in making GIT more friendly to users who don't know or care about packing and repacking their repos?

I loathe to do this conditionally only on the count of unpacked objects. If there's a quick'n'dirty way of asking portably whether the machine is busy or otherwise resource-constrained (ie: on battery) it should use it to avoid running repack at inconvenient times.

---
 git-fetch.sh |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/git-fetch.sh b/git-fetch.sh
index 48818f8..7211318 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -427,3 +427,12 @@ case ",$update_head_ok,$orig_head," in
 	fi
 	;;
 esac
+
+if test "$(git-repo-config --get core.autorepack)" != 'no'
+then
+	if test $(git rev-list --unpacked --all | wc -l) -gt 1000
+	then
+		echo "Repacking in the background"
+		nice git repack -a -d -q &
+	fi
+fi
-- 
1.4.1.rc1.g59c8
Next: Junio C Hamano
Message 1 of 7 in “[RFC] git-fetch - repack in the background after fetching”
  1. Martin LanghoffJun 24, 2006
  2. Junio C HamanoJun 25, 2006
  3. Repack should try to prevent itself from running twice, concurrently.Ryan Anderson, Jun 25, 2006
  4. Johannes SchindelinJun 25, 2006
  5. Linus TorvaldsJun 25, 2006
  6. Johannes SchindelinJun 25, 2006
  7. Linus TorvaldsJun 25, 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.