Skip to content

Commit b65affb

Browse files
authored
Merge pull request #47 from hyperupcall/fix-path-quoting
chore: Improve path quoting
2 parents 85aee80 + ef10174 commit b65affb

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

git-clone.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function clone {
1919
$GIT clone -q $1 $2
2020
res=$?
2121

22-
cd $2
22+
cd "$2"
2323

2424
$GIT pull --all
2525

@@ -29,4 +29,4 @@ function clone {
2929
}
3030

3131
echo "cloning repository into ... $2"
32-
clone $1 $2
32+
clone $1 "$2"

git-filemerge

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ OLD="$1"; shift
1111
fi
1212
test $# -gt 0 && test -z "$CACHED" && NEW="$1"
1313
TMPDIR1=`mktemp -d`
14-
git archive --format=tar $OLD | (cd $TMPDIR1; tar xf -)
14+
git archive --format=tar $OLD | (cd "$TMPDIR1"; tar xf -)
1515
if test -z "$NEW"; then
1616
TMPDIR2=$(git rev-parse --show-cdup)
1717
test -z "$cdup" && TMPDIR2=.
1818
else
1919
TMPDIR2=`mktemp -d`
20-
git archive --format=tar $NEW | (cd $TMPDIR2; tar xf -)
20+
git archive --format=tar $NEW | (cd "$TMPDIR2"; tar xf -)
2121
fi
2222

23-
opendiff $TMPDIR1 $TMPDIR2 | cat
24-
rm -rf $TMPDIR1
25-
test ! -z "$NEW" && rm -rf $TMPDIR2
23+
opendiff "$TMPDIR1" "$TMPDIR2" | cat
24+
rm -rf "$TMPDIR1"
25+
test ! -z "$NEW" && rm -rf "$TMPDIR2"
2626

git-remote-in-sync.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ ret=0
1818

1919
if [ -z "`git branch`" ]
2020
then
21-
if [ $(cd $(git root) && ls -Al | egrep -v "^(.git|total)" | wc -l) -gt 0 ]
21+
if [ $(cd "$(git root)" && ls -Al | egrep -v "^(.git|total)" | wc -l) -gt 0 ]
2222
then
2323
echo "WARN: This repo doesn't contain any branch, but contains a bunch of files!" >&2
24-
ls -Alh $(git root)
24+
ls -Alh "$(git root)"
2525
ret=1
2626
else
2727
echo "INFO: This repo doesn't contain any branch, and is empty"

git-root

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ if [ -n "$1" ]
66
then
77
if [ -d "$1" ]
88
then
9-
cd $1
9+
cd "$1"
1010
else
11-
cd `dirname $1`
11+
cd "`dirname $1`"
1212
fi
1313
fi
1414
exec git rev-parse --show-toplevel

pre-commit.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ MIRROR=$HOME/Products/ledger-pre-commit-mirror
1212
set -e
1313

1414
# Checkout a copy of the current index into MIRROR
15-
git checkout-index --prefix=$MIRROR/ -af
15+
git checkout-index --prefix="$MIRROR/" -af
1616

1717
# Remove files from MIRROR which are no longer present in the index
1818
git diff-index --cached --name-only --diff-filter=D -z HEAD | \
19-
(cd $MIRROR && xargs -0 rm -f --)
19+
(cd "$MIRROR" && xargs -0 rm -f --)
2020

2121
# Copy only _changed files_ from MIRROR to TMPDIR, without copying timestamps.
2222
# This includes copying over new files, and deleting removed ones. This way,
2323
# "make check" will only rebuild what is necessary to validate the commit.
24-
rsync -rlpgoDOc --delete --exclude-from=tools/excludes $MIRROR/ $TMPDIR/
24+
rsync -rlpgoDOc --delete --exclude-from=tools/excludes "$MIRROR/" "$TMPDIR/"
2525

2626
# Everything else happens in the temporary build tree
27-
if [ ! -f $TMPDIR/lib/utfcpp/source/utf8.h ]; then
28-
rsync -a --delete lib/utfcpp/ $TMPDIR/lib/utfcpp/
27+
if [ ! -f "$TMPDIR/lib/utfcpp/source/utf8.h" ]; then
28+
rsync -a --delete lib/utfcpp/ "$TMPDIR/lib/utfcpp/"
2929
fi
30-
cd $TMPDIR
30+
cd "$TMPDIR"
3131

3232
# Make sure there is a current Makefile. Regeneration of Makefile happens
3333
# automatically, but if myacprep or acprep changes, we want to regenerate

0 commit comments

Comments
 (0)