From f8f135c9bae74f846a92e1f1f1fea8308802ace5 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 15 Feb 2006 12:47:43 -0800 Subject: [PATCH 1/3] packed objects: minor cleanup The delta depth is unsigned. Signed-off-by: Junio C Hamano --- cache.h | 2 +- pack-check.c | 4 ++-- sha1_file.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cache.h b/cache.h index c255421ab9..b5db01f28d 100644 --- a/cache.h +++ b/cache.h @@ -322,7 +322,7 @@ extern int num_packed_objects(const struct packed_git *p); extern int nth_packed_object_sha1(const struct packed_git *, int, unsigned char*); extern int find_pack_entry_one(const unsigned char *, struct pack_entry *, struct packed_git *); extern void *unpack_entry_gently(struct pack_entry *, char *, unsigned long *); -extern void packed_object_info_detail(struct pack_entry *, char *, unsigned long *, unsigned long *, int *, unsigned char *); +extern void packed_object_info_detail(struct pack_entry *, char *, unsigned long *, unsigned long *, unsigned int *, unsigned char *); /* Dumb servers support */ extern int update_server_info(int); diff --git a/pack-check.c b/pack-check.c index 67a7ecdf16..eca32b6cab 100644 --- a/pack-check.c +++ b/pack-check.c @@ -84,7 +84,7 @@ static void show_pack_info(struct packed_git *p) char type[20]; unsigned long size; unsigned long store_size; - int delta_chain_length; + unsigned int delta_chain_length; if (nth_packed_object_sha1(p, i, sha1)) die("internal error pack-check nth-packed-object"); @@ -98,7 +98,7 @@ static void show_pack_info(struct packed_git *p) if (!delta_chain_length) printf("%-6s %lu %u\n", type, size, e.offset); else - printf("%-6s %lu %u %d %s\n", type, size, e.offset, + printf("%-6s %lu %u %u %s\n", type, size, e.offset, delta_chain_length, sha1_to_hex(base_sha1)); } diff --git a/sha1_file.c b/sha1_file.c index 3d11a9bfdc..64cf245418 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -830,7 +830,7 @@ void packed_object_info_detail(struct pack_entry *e, char *type, unsigned long *size, unsigned long *store_size, - int *delta_chain_length, + unsigned int *delta_chain_length, unsigned char *base_sha1) { struct packed_git *p = e->p; @@ -844,7 +844,7 @@ void packed_object_info_detail(struct pack_entry *e, if (kind != OBJ_DELTA) *delta_chain_length = 0; else { - int chain_length = 0; + unsigned int chain_length = 0; memcpy(base_sha1, pack, 20); do { struct pack_entry base_ent; 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