From 504fe714fe642b375992bb913075bee0d0bc1bbd Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 14 Feb 2006 16:05:57 -0800 Subject: [PATCH 1/3] checkout: fix dirty-file display. When we refused to switch branches, we incorrectly showed differences from the branch we would have switched to. Signed-off-by: Junio C Hamano --- git-checkout.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/git-checkout.sh b/git-checkout.sh index 6a87c717e9..76e7f55226 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -165,8 +165,10 @@ else exit 0 ) saved_err=$? - test "$new" = "$old" || - git diff-index --name-status "$new" + if test "$saved_err" = 0 + then + test "$new" = "$old" || git diff-index --name-status "$new" + fi (exit $saved_err) fi From 6c5c62f3401dc8f4b567af46582c112f6a859b5e Mon Sep 17 00:00:00 2001 From: "Fernando J. Pereda" Date: Wed, 15 Feb 2006 12:37:30 +0100 Subject: [PATCH 2/3] Print an error if cloning a http repo and NO_CURL is set If Git is compiled with NO_CURL=YesPlease and one tries to clone a http repository, git-clone tries to call the curl binary. This trivial patch prints an error instead in such situation. Signed-off-by: Fernando J. Pereda Signed-off-by: Junio C Hamano --- Makefile | 1 + git-clone.sh | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d40aa6a7d8..648469e625 100644 --- a/Makefile +++ b/Makefile @@ -419,6 +419,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh rm -f $@ sed -e '1s|#!.*/sh|#!$(call shq,$(SHELL_PATH))|' \ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ + -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ $@.sh >$@ chmod +x $@ diff --git a/git-clone.sh b/git-clone.sh index 47f3ec9761..e192b08c0d 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -206,7 +206,13 @@ yes,yes) fi ;; http://*) - clone_dumb_http "$repo" "$D" + if test -z "@@NO_CURL@@" + then + clone_dumb_http "$repo" "$D" + else + echo >&2 "http transport not supported, rebuild Git with curl support" + exit 1 + fi ;; *) cd "$D" && case "$upload_pack" in From babfaf8dee0baa09c56d1a2ec5623b60d900518b Mon Sep 17 00:00:00 2001 From: Josef Weidendorfer Date: Wed, 15 Feb 2006 20:22:11 +0100 Subject: [PATCH 3/3] More useful/hinting error messages in git-checkout Signed-off-by: Josef Weidendorfer Signed-off-by: Junio C Hamano --- git-checkout.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/git-checkout.sh b/git-checkout.sh index 76e7f55226..463ed2eaff 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -22,7 +22,7 @@ while [ "$#" != "0" ]; do [ -e "$GIT_DIR/refs/heads/$newbranch" ] && die "git checkout: branch $newbranch already exists" git-check-ref-format "heads/$newbranch" || - die "we do not like '$newbranch' as a branch name." + die "git checkout: we do not like '$newbranch' as a branch name." ;; "-f") force=1 @@ -75,9 +75,15 @@ done if test "$#" -ge 1 then + hint= + if test "$#" -eq 1 + then + hint=" +Did you intend to checkout '$@' which can not be resolved as commit?" + fi if test '' != "$newbranch$force$merge" then - die "updating paths and switching branches or forcing are incompatible." + die "git checkout: updating paths is incompatible with switching branches/forcing$hint" fi if test '' != "$new" then @@ -117,7 +123,8 @@ fi [ -z "$branch$newbranch" ] && [ "$new" != "$old" ] && - die "git checkout: you need to specify a new branch name" + die "git checkout: to checkout the requested commit you need to specify + a name for a new branch which is created and switched to" if [ "$force" ] then