summary refs log tree commit diff
path: root/scripts/archive.sh
blob: d963e51ebb91118b31fabc5d38bbd9ea99ce5fb1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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" --