Re: [PATCH 2/2] git-gc: skip stashes when expiring reflogs
From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:44:46
Hi, On Sun, 15 Jun 2008, しらいしななこ wrote:
quoted hunk
The following is a trial patch to change how a stash is recorded. With this patch I do not think we will keep unnecessary commits behind H in the repository even when a stash is kept forever.diff --git a/git-stash.sh b/git-stash.sh index 4938ade..f4c4236 100755 --- a/git-stash.sh +++ b/git-stash.sh@@ -54,6 +54,9 @@ create_stash () { fi msg=$(printf '%s: %s' "$branch" "$head") + # create the base commit that is parentless + b_commit=$(printf 'base of %s\n' "$msg" | git commit-tree "HEAD:") +
I think that this does not help the case of Wincent (which I do not agree
with), as it does not prevent the stashes from expiring.
What your patch does, however, might be something people need to prevent
unnecessary bloat of the object database, if they choose never to expire
stashes.
However, it makes it harder to see where the stashed revision came from.
Besides, I think that your printf would look nicer as
b_commit=$(echo "base of $msg" | git commit-tree HEAD^{tree})
Ciao,
Dscho