From: Junio C Hamano Date: Fri, 23 Dec 2005 22:10:16 +0000 (-0800) Subject: Adjust to ls-tree --full-name when run from a subdirectory. X-Git-Tag: v1.1.0~24^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d0d14cf33d0e4446ed98b03ac5f81367d368e557?hp=-c Adjust to ls-tree --full-name when run from a subdirectory. A proposed change to show cwd relative paths by default from ls-tree when run from a subdirectory means we would need to give --full-name option to it. Signed-off-by: Junio C Hamano --- d0d14cf33d0e4446ed98b03ac5f81367d368e557 diff --combined git-checkout.sh index 1219ea0b0e,36308d22c6..3bbd111773 --- a/git-checkout.sh +++ b/git-checkout.sh @@@ -1,7 -1,6 +1,7 @@@ #!/bin/sh USAGE='[-f] [-b ] [] [...]' +SUBDIRECTORY_OK=Sometimes . git-sh-setup old=$(git-rev-parse HEAD) @@@ -80,7 -79,7 +80,7 @@@ the # from a specific tree-ish; note that this is for # rescuing paths and is never meant to remove what # is not in the named tree-ish. -- git-ls-tree -r "$new" "$@" | ++ git-ls-tree --full-name -r "$new" "$@" | git-update-index --index-info || exit $? fi git-checkout-index -f -u -- "$@" @@@ -96,14 -95,6 +96,14 @@@ els fi fi +# We are switching branches and checking out trees, so +# we *NEED* to be at the toplevel. +cdup=$(git-rev-parse --show-cdup) +if test ! -z "$cdup" +then + cd "$cdup" +fi + [ -z "$new" ] && new=$old # If we don't have an old branch that we're switching to,