Merge branch 'jc/add'
authorJunio C Hamano <junkio@cox.net>
Thu, 16 Feb 2006 03:42:15 +0000 (19:42 -0800)
committerJunio C Hamano <junkio@cox.net>
Thu, 16 Feb 2006 03:42:15 +0000 (19:42 -0800)
* jc/add:
  Detect misspelled pathspec to git-add

Makefile
cache.h
git-checkout.sh
git-clone.sh
pack-check.c
sha1_file.c

index d40aa6a..648469e 100644 (file)
--- 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/cache.h b/cache.h
index c255421..b5db01f 100644 (file)
--- 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);
index 6a87c71..463ed2e 100755 (executable)
@@ -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
@@ -165,8 +172,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
 
index 47f3ec9..e192b08 100755 (executable)
@@ -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
index 67a7ecd..eca32b6 100644 (file)
@@ -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));
        }
 
index 3d11a9b..64cf245 100644 (file)
@@ -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;