git-deltafy-scripton commit [PATCH] Makefile: Solaris fix: call $(MAKE) instead of make for subdirectories (ca67f00)
   1#!/bin/bash
   2
   3# 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 delta overhead is
   7# pushed towards older version of any given file.
   8#
   9# NOTE: the "best earlier version" is not implemented in mkdelta yet
  10#       and therefore only the next eariler version is used at this time.
  11#
  12# TODO: deltafy tree objects as well.
  13#
  14# The -d argument allows to provide a limit on the delta chain depth.
  15# If 0 is passed then everything is undeltafied.
  16
  17set -e
  18
  19depth=
  20[ "$1" == "-d" ] && depth="--max-depth=$2" && shift 2
  21
  22curr_file=""
  23
  24git-rev-list HEAD |
  25git-diff-tree -r --stdin |
  26sed -n '/^\*/ s/^.*->\(.\{41\}\)\(.*\)$/\2 \1/p' | sort | uniq |
  27while read file sha1; do
  28        if [ "$file" == "$curr_file" ]; then
  29                list="$list $sha1"
  30        else
  31                if [ "$list" ]; then
  32                        echo "Processing $curr_file"
  33                        echo "$head $list" | xargs git-mkdelta $depth -v
  34                fi
  35                curr_file="$file"
  36                list=""
  37                head="$sha1"
  38        fi
  39done