Skip to content

Commit

Permalink
tg: tickle gc --auto when appropriate
Browse files Browse the repository at this point in the history
Any of tg import, tg export or tg update could potentially result
in creation of a fair number of new loose objects as part of their
normal operation.

Run the "git gc --auto" command at the end of these commands to
hint to Git that it's a good time to check and see if any automatic
gc might need to be performed.

Be careful to first clean up any TopGit temporary directory before
running "git gc --auto" to avoid having it hanging around during
any automatic gc operation.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
  • Loading branch information
mackyle committed Jan 13, 2018
1 parent 0dec5f9 commit f3c584a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tg-export.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# TopGit - A different patch queue manager
# Copyright (C) 2008 Petr Baudis <pasky@suse.cz>
# Copyright (C) 2015-2017 Kyle J. McKay <mackyle@gmail.com>
# Copyright (C) 2015-2018 Kyle J. McKay <mackyle@gmail.com>
# All rights reserved
# GPLv2

Expand Down Expand Up @@ -502,3 +502,7 @@ elif [ "$driver" = "linearize" ]; then
fi
fi
ec=$?
tmpdir_cleanup || :
git gc --auto || :
exit $ec
6 changes: 5 additions & 1 deletion tg-import.sh
Expand Up @@ -2,7 +2,7 @@
# TopGit - A different patch queue manager
# Copyright (C) 2008 Petr Baudis <pasky@suse.cz>
# Copyright (C) 2008 Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
# Copyright (C) 2015,2017 Kyle J. McKay <mackyle@gmail.com>
# Copyright (C) 2015,2017,2018 Kyle J. McKay <mackyle@gmail.com>
# All rights reserved.
# GPLv2

Expand Down Expand Up @@ -197,3 +197,7 @@ for revpair in $ranges; do
}
test $? -eq 0
done
ec=$?
tmpdir_cleanup || :
git gc --auto || :
exit $ec
4 changes: 4 additions & 0 deletions tg-update.sh
Expand Up @@ -1268,3 +1268,7 @@ info "Returning to ${current#refs/heads/}..."
checkout_symref_full "$current"
! [ -f "$git_dir/TGMERGE_MSG" ] || [ -e "$git_dir/MERGE_MSG" ] ||
mv -f "$git_dir/TGMERGE_MSG" "$git_dir/MERGE_MSG" || :
ec=$?
tmpdir_cleanup || :
git gc --auto || :
exit $ec

0 comments on commit f3c584a

Please sign in to comment.