commit bddcf71f0809a39d7f4fa1d057fede99ffe898c0
parent a24f7aad32dd629200eb5358ad4c19d45e086c27
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 5 Feb 2024 21:59:08 +0100
Fixed the wad_objects function
The function could return an error if the working tree did not have
blobs or WAD files. It used grep to check their presence while grep
returns an error if it finds nothing that matches the submitted
expression. We replaced it with a sed that filters all the lines except
those that match the desired expression.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-wad b/git-wad
@@ -97,10 +97,10 @@ wad_objects() # [--all]
git rev-list --objects "${rev}" \
| cut -d' ' -f1 \
| git cat-file --batch-check \
- | grep -e "[a-z0-9]\{40\} blob [0-9]\{1,\}" \
+ | sed -n "/^[a-z0-9]\{40\} blob [0-9]\{1,\}$/p" \
| cut -d' ' -f1 \
| git cat-file --batch \
- | grep -e "^${GIT_WAD_HEADER} [0-9a-z]\{64\} [0-9]\{1,\}$" \
+ | sed -n "/^${GIT_WAD_HEADER} [0-9a-z]\{64\} [0-9]\{1,\}$/p" \
| sed "s/^${GIT_WAD_HEADER} \([0-9a-z]\{64\}\) [0-9]\{1,\}$/\1/"
}