summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/archive.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/archive.sh b/scripts/archive.sh
new file mode 100755
index 00000000..d963e51e
--- /dev/null
+++ b/scripts/archive.sh
@@ -0,0 +1,14 @@
+#!/bin/bash -e
+
+TAG=`git tag -l --points-at HEAD`
+PREFIX=$(basename "$(pwd -P)")
+
+if [ ! -z $TAG ]; then
+    PREFIX=$(basename "$(pwd -P)").$TAG
+fi
+
+{
+  git ls-files
+  git submodule foreach --recursive --quiet \
+                'git ls-files --with-tree="$sha1" | sed "s#^#$path/#"'
+} | sed "s#^#$PREFIX/#" | xargs tar -c -C.. -f "$PREFIX.tar.bz2" --