Welcome to CRUX bug tracking.

FS#1794 - git driver: keep only the desired branch, prune and garbage collect useless objects

Attached to Project: CRUX
Opened by Steffen Nurpmeso (steffen) - Tuesday, 10 March 2020, 20:27 GMT
Task Type Bug Report
Category ports
Status New
Assigned To Thomas Penteker (teK)
Operating System CRUX
Severity Medium
Priority Normal
Reported Version 3.5
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


How about this? In the normal case (without --aggressive) the cost is invisible in practice, even for elder boxes (which benefit the most from this change)

diff --git a/git/git b/git/git
index 654a8c770..51193dd2c 100644
--- a/git/git
+++ b/git/git
@@ -39,8 +39,15 @@ if [ $? -lt 1 ]; then
git diff --pretty=format: --name-status "$BRANCH" origin/"$BRANCH" | sed "s/M\t/ Edit /g; s/A\t/ Checkout /g; s/D\t/ Delete /g" | sort
git clean -q -f
git reset -q --hard origin/"$BRANCH"
+ i=`git branch | sed -e '/^*/d'`
+ if [ -n "$i" ]; then
+ git branch -q -d $i
+ i=--aggressive
+ fi
+ git gc --quiet $i --prune=all
- git clone -q -b "$BRANCH" "$URL" "$REPOSITORY"
+ git clone -q --single-branch -b "$BRANCH" "$URL" "$REPOSITORY"
+ git gc --quiet --aggressive --prune=all
ls -1 $REPOSITORY | sed "s/^/ Checkout /"
This task depends upon