[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] git-checkout.sh: handle running git-checkout from a different directory



commit 4834dd5521a36cec118ed84b7c09a509edaafa6b
Author:     Anthony PERARD <anthony.perard@xxxxxxxxxx>
AuthorDate: Thu Oct 13 14:05:04 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Oct 14 20:56:57 2022 +0100

    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@xxxxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Release-acked-by: Henry Wang <Henry.Wang@xxxxxxx>
---
 scripts/git-checkout.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/git-checkout.sh b/scripts/git-checkout.sh
index 20ae31ff23..fd4425ac4e 100755
--- a/scripts/git-checkout.sh
+++ b/scripts/git-checkout.sh
@@ -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
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.