Commit a14d3869 authored by blam's avatar blam

Merge branch 'jb35155' into 'master'

[tools] Fix git-vault-export to read symbolic link names with spaces. Fixes JB#35155

If a file name in the backup has a space, the link is currently
expanded without quotation marks, causing the readlink operation to
fail, thus causing the file to be added to the backup as a symbolic
link rather than a hard link, and thus the file is not actually
added to the backup.

See merge request !3
parents 08459f9f 7ab0630f
......@@ -36,7 +36,7 @@ GIT_DIR=$(pwd)
find $DST -type l | grep '/blobs/' | while read -r LINK
do
NAME=$(readlink $LINK)
NAME=$(readlink "$LINK")
# match minimal relative blob ref (path inside the tree is unit/blobs/link)
if [[ $NAME =~ \.\./\.\./\.git/blobs/ ]]; then
FNAME=$(basename $NAME)
......@@ -44,7 +44,7 @@ do
[ -d $DNAME ] || error "There is no blob dir $DNAME for $LINK"
FNAME="$DNAME/$FNAME"
[ -f $FNAME ] || error "There is no blob file $FNAME for $LINK"
unlink $LINK || error "Can't unlink $LINK"
cp $FNAME $LINK || error "Can't copy $FNAME to $LINK"
unlink "$LINK" || error "Can't unlink $LINK"
cp $FNAME "$LINK" || error "Can't copy $FNAME to $LINK"
fi
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment