summaryrefslogtreecommitdiff
path: root/git-deltafy-script
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2005-05-20 21:00:23 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-20 22:41:45 (GMT)
commite002a16ba54096666c2d1768daa122e29fba11ee (patch)
tree58741c69570705801db4b785681790d636475695 /git-deltafy-script
parentd1af002dc608be3213ba18df1a99ced0ab42e6d6 (diff)
downloadgit-e002a16ba54096666c2d1768daa122e29fba11ee.zip
git-e002a16ba54096666c2d1768daa122e29fba11ee.tar.gz
git-e002a16ba54096666c2d1768daa122e29fba11ee.tar.bz2
[PATCH] delta creation
This adds the ability to actually create delta objects using a new tool: git-mkdelta. It uses an ordered list of potential objects to deltafy against earlier objects in the list. A cap on the depth of delta references can be provided as well, otherwise the default is to not have any limit. A limit of 0 will also undeltafy any given object. Also provided is the beginning of a script to deltafy an entire repository. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'git-deltafy-script')
-rw-r--r--git-deltafy-script39
1 files changed, 39 insertions, 0 deletions
diff --git a/git-deltafy-script b/git-deltafy-script
new file mode 100644
index 0000000..c23f215
--- /dev/null
+++ b/git-deltafy-script
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# Script to deltafy an entire GIT repository based on the commit list.
+# The most recent version of a file is the reference and previous versions
+# are made delta against the best earlier version available. And so on for
+# successive versions going back in time. This way the delta overhead is
+# pushed towards older version of any given file.
+#
+# NOTE: the "best earlier version" is not implemented in mkdelta yet
+# and therefore only the next eariler version is used at this time.
+#
+# TODO: deltafy tree objects as well.
+#
+# The -d argument allows to provide a limit on the delta chain depth.
+# If 0 is passed then everything is undeltafied.
+
+set -e
+
+depth=
+[ "$1" == "-d" ] && depth="--max-depth=$2" && shift 2
+
+curr_file=""
+
+git-rev-list HEAD |
+git-diff-tree -r --stdin |
+sed -n '/^\*/ s/^.*->\(.\{41\}\)\(.*\)$/\2 \1/p' | sort | uniq |
+while read file sha1; do
+ if [ "$file" == "$curr_file" ]; then
+ list="$list $sha1"
+ else
+ if [ "$list" ]; then
+ echo "Processing $curr_file"
+ echo "$head $list" | xargs git-mkdelta $depth -v
+ fi
+ curr_file="$file"
+ list=""
+ head="$sha1"
+ fi
+done