git-checkout.sh: handle running git-checkout from a different directory

"$DIR" might not be a full path and it might not have `pwd` as ".."
directory. So use `cd -` to undo the first `cd` command.

Also, use `basename` to make a symbolic link with a relative path.

This doesn't matter yet but it will when for example the commands to
clone OVMF is been run from tools/ rather than tools/firmware/.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Henry Wang <Henry.Wang@arm.com>
This commit is contained in:
Anthony PERARD authored and Andrew Cooper committed 2022-10-14 20:56:57 +01:00
1 parent 4c1a3cca79
commit 4834dd5521
1 file changed
+2 -2
+2 -2
View File
@@ -19,9 +19,9 @@ if test \! -d $DIR-remote; then
cd $DIR-remote.tmp
$GIT branch -D dummy >/dev/null 2>&1 ||:
$GIT checkout -b dummy $TAG
cd ..
cd -
fi
mv $DIR-remote.tmp $DIR-remote
fi
rm -f $DIR
ln -sf $DIR-remote $DIR
ln -sf $(basename $DIR-remote) $DIR
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.