3 # Example script to deltafy an entire GIT repository based on the commit list.
4 # The most recent version of a file is the reference and previous versions
5 # are made delta against the best earlier version available. And so on for
6 # successive versions going back in time. This way the increasing delta
7 # overhead is pushed towards older versions of any given file.
9 # The -d argument allows to provide a limit on the delta chain depth.
10 # If 0 is passed then everything is undeltafied. Limiting the delta
11 # depth is meaningful for subsequent access performance to old revisions.
12 # A value of 16 might be a good compromize between performance and good
13 # space saving. Current default is unbounded.
15 # The --max-behind=30 argument is passed to git-mkdelta so to keep
16 # combinations and memory usage bounded a bit. If you have lots of memory
17 # and CPU power you may remove it (or set to 0) to let git-mkdelta find the
18 # best delta match regardless of the number of revisions for a given file.
19 # You can also make the value smaller to make it faster and less
20 # memory hungry. A value of 5 ought to still give pretty good results.
21 # When set to 0 or ommitted then look behind is unbounded. Note that
22 # git-mkdelta might die with a segmentation fault in that case if it
23 # runs out of memory. Note that the GIT repository will still be consistent
24 # even if git-mkdelta dies unexpectedly.
29 [ "$1" == "-d" ] && depth="--max-depth=$2" && shift 2
31 function process_list() {
33 echo "Processing $curr_file"
34 echo "$head $list" | xargs git-mkdelta $depth --max-behind=30 -v
41 git-diff-tree -r -t --stdin |
42 awk '/^:/ { if ($5 == "M" || $5 == "N") print $4, $6;
43 if ($5 == "M") print $3, $6 }' |
44 LC_ALL=C sort -s -k 2 | uniq |
45 while read sha1 file; do
46 if [ "$file" == "$curr_file" ]; then
57 curr_file="root directory"
62 git-cat-file commit $commit |