]> git.armaanb.net Git - stagit.git/commitdiff
README: improve tarball generation by tag example
authorHiltjo Posthuma <hiltjo@codemadness.org>
Sun, 28 Jan 2018 15:27:10 +0000 (16:27 +0100)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Sun, 28 Jan 2018 15:27:10 +0000 (16:27 +0100)
- set the project name + '-' + tag name as prefix.
- allow '/' in the tag name.
- allow '-' as suffix in the tag.

README

diff --git a/README b/README
index d916cc8c5487b7bf23e1d819ced9f872bca370f6..6354725d21504e3b56b64d4c611859b12aea23c7 100644 (file)
--- a/README
+++ b/README
@@ -123,8 +123,14 @@ Create .tar.gz archives by tag
        name="stagit"
        mkdir -p archives
        git tag -l | while read -r t; do
-               f="archives/$name-$t.tar.gz"
-               test -f "$f" || git archive --format tar.gz "$t" -o "$f"
+               f="archives/${name}-$(echo "${t}" | tr '/' '_').tar.gz"
+               test -f "${f}" && continue
+               git archive \
+                       --format tar.gz \
+                       --prefix "${t}/" \
+                       -o "${f}" \
+                       -- \
+                       "${t}"
        done