Merge branch 'maint'
authorJunio C Hamano <junkio@cox.net>
Tue, 20 Feb 2007 02:29:41 +0000 (18:29 -0800)
committerJunio C Hamano <junkio@cox.net>
Tue, 20 Feb 2007 02:29:41 +0000 (18:29 -0800)
* maint:
Obey NO_C99_FORMAT in fast-import.c.
Add a compat/strtoumax.c for Solaris 8.
git-clone: Sync documentation to usage note.

1  2 
Makefile
fast-import.c
diff --combined Makefile
index ebecbbd9c28390654ed9fea2ff4ebf6a5a317c70,f85fb7c197a6c9c12d0388c385f7583de7cd0f51..289decddc8865143896ff10fc3248ae460ef0b30
+++ b/Makefile
@@@ -28,6 -28,10 +28,10 @@@ all:
  #
  # Define NO_STRLCPY if you don't have strlcpy.
  #
+ # Define NO_STRTOUMAX if you don't have strtoumax in the C library.
+ # If your compiler also does not support long long or does not have
+ # strtoull, define NO_STRTOULL.
+ #
  # Define NO_SETENV if you don't have setenv in the C library.
  #
  # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
@@@ -172,7 -176,7 +176,7 @@@ SCRIPT_SH = 
        git-merge-one-file.sh git-parse-remote.sh \
        git-pull.sh git-rebase.sh \
        git-repack.sh git-request-pull.sh git-reset.sh \
 -      git-resolve.sh git-revert.sh git-sh-setup.sh \
 +      git-revert.sh git-sh-setup.sh \
        git-tag.sh git-verify-tag.sh \
        git-applymbox.sh git-applypatch.sh git-am.sh \
        git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
@@@ -280,6 -284,7 +284,6 @@@ BUILTIN_OBJS = 
        builtin-diff.o \
        builtin-diff-files.o \
        builtin-diff-index.o \
 -      builtin-diff-stages.o \
        builtin-diff-tree.o \
        builtin-fmt-merge-msg.o \
        builtin-for-each-ref.o \
        builtin-ls-tree.o \
        builtin-mailinfo.o \
        builtin-mailsplit.o \
 +      builtin-merge-base.o \
        builtin-merge-file.o \
        builtin-mv.o \
        builtin-name-rev.o \
@@@ -353,11 -357,13 +357,13 @@@ ifeq ($(uname_S),SunOS
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
                NO_C99_FORMAT = YesPlease
+               NO_STRTOUMAX = YesPlease
        endif
        ifeq ($(uname_R),5.9)
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
                NO_C99_FORMAT = YesPlease
+               NO_STRTOUMAX = YesPlease
        endif
        INSTALL = ginstall
        TAR = gtar
@@@ -517,6 -523,13 +523,13 @@@ ifdef NO_STRLCP
        COMPAT_CFLAGS += -DNO_STRLCPY
        COMPAT_OBJS += compat/strlcpy.o
  endif
+ ifdef NO_STRTOUMAX
+       COMPAT_CFLAGS += -DNO_STRTOUMAX
+       COMPAT_OBJS += compat/strtoumax.o
+ endif
+ ifdef NO_STRTOULL
+       COMPAT_CFLAGS += -DNO_STRTOULL
+ endif
  ifdef NO_SETENV
        COMPAT_CFLAGS += -DNO_SETENV
        COMPAT_OBJS += compat/setenv.o
diff --combined fast-import.c
index 404d911390bdb4700d0ee0df46bd7849c1890016,8720090a3e54f09d31ef447cc143c39f75c5c365..ad32300f4dda7f7dae1bf9f9f2010eb975fdbcf7
@@@ -133,6 -133,15 +133,15 @@@ Format of STDIN stream
  #define PACK_ID_BITS 16
  #define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
  
+ #if !defined(NO_C99_FORMAT)
+ #define UM_FMT "%ju"
+ #define UM10_FMT "%10ju"
+ #else
+ /* Assumes unsigned long long exists. */
+ #define UM_FMT "%llu"
+ #define UM10_FMT "%10llu"
+ #endif
  struct object_entry
  {
        struct object_entry *next;
@@@ -475,7 -484,7 +484,7 @@@ static struct object_entry *find_mark(u
                        oe = s->data.marked[idnum];
        }
        if (!oe)
-               die("mark :%ju not declared", orig_idnum);
+               die("mark :" UM_FMT " not declared", orig_idnum);
        return oe;
  }
  
@@@ -1308,7 -1317,7 +1317,7 @@@ static int update_branch(struct branch 
                        return error("Branch %s is missing commits.", b->name);
                }
  
 -              if (!in_merge_bases(old_cmit, new_cmit)) {
 +              if (!in_merge_bases(old_cmit, &new_cmit, 1)) {
                        unlock_ref(lock);
                        warn("Not updating %s"
                                " (new tip %s does not contain %s)",
@@@ -1361,7 -1370,7 +1370,7 @@@ static void dump_marks_helper(FILE *f
        } else {
                for (k = 0; k < 1024; k++) {
                        if (m->data.marked[k])
-                               fprintf(f, ":%ju %s\n", base + k,
+                               fprintf(f, ":" UM_FMT " %s\n", base + k,
                                        sha1_to_hex(m->data.marked[k]->sha1));
                }
        }
@@@ -1687,7 -1696,7 +1696,7 @@@ static void cmd_from(struct branch *b
                unsigned long size;
                char *buf;
                if (oe->type != OBJ_COMMIT)
-                       die("Mark :%ju not a commit", idnum);
+                       die("Mark :" UM_FMT " not a commit", idnum);
                hashcpy(b->sha1, oe->sha1);
                buf = gfi_unpack_entry(oe, &size);
                if (!buf || size < 46)
@@@ -1740,7 -1749,7 +1749,7 @@@ static struct hash_list *cmd_merge(unsi
                        uintmax_t idnum = strtoumax(from + 1, NULL, 10);
                        struct object_entry *oe = find_mark(idnum);
                        if (oe->type != OBJ_COMMIT)
-                               die("Mark :%ju not a commit", idnum);
+                               die("Mark :" UM_FMT " not a commit", idnum);
                        hashcpy(n->sha1, oe->sha1);
                } else if (get_sha1(from, n->sha1))
                        die("Invalid ref name or SHA1 expression: %s", from);
@@@ -1884,7 -1893,7 +1893,7 @@@ static void cmd_new_tag(void
                from_mark = strtoumax(from + 1, NULL, 10);
                oe = find_mark(from_mark);
                if (oe->type != OBJ_COMMIT)
-                       die("Mark :%ju not a commit", from_mark);
+                       die("Mark :" UM_FMT " not a commit", from_mark);
                hashcpy(sha1, oe->sha1);
        } else if (!get_sha1(from, sha1)) {
                unsigned long size;
@@@ -2059,18 -2068,18 +2068,18 @@@ int main(int argc, const char **argv
  
                fprintf(stderr, "%s statistics:\n", argv[0]);
                fprintf(stderr, "---------------------------------------------------------------------\n");
-               fprintf(stderr, "Alloc'd objects: %10ju\n", alloc_count);
-               fprintf(stderr, "Total objects:   %10ju (%10ju duplicates                  )\n", total_count, duplicate_count);
-               fprintf(stderr, "      blobs  :   %10ju (%10ju duplicates %10ju deltas)\n", object_count_by_type[OBJ_BLOB], duplicate_count_by_type[OBJ_BLOB], delta_count_by_type[OBJ_BLOB]);
-               fprintf(stderr, "      trees  :   %10ju (%10ju duplicates %10ju deltas)\n", object_count_by_type[OBJ_TREE], duplicate_count_by_type[OBJ_TREE], delta_count_by_type[OBJ_TREE]);
-               fprintf(stderr, "      commits:   %10ju (%10ju duplicates %10ju deltas)\n", object_count_by_type[OBJ_COMMIT], duplicate_count_by_type[OBJ_COMMIT], delta_count_by_type[OBJ_COMMIT]);
-               fprintf(stderr, "      tags   :   %10ju (%10ju duplicates %10ju deltas)\n", object_count_by_type[OBJ_TAG], duplicate_count_by_type[OBJ_TAG], delta_count_by_type[OBJ_TAG]);
+               fprintf(stderr, "Alloc'd objects: " UM10_FMT "\n", alloc_count);
+               fprintf(stderr, "Total objects:   " UM10_FMT " (" UM10_FMT " duplicates                  )\n", total_count, duplicate_count);
+               fprintf(stderr, "      blobs  :   " UM10_FMT " (" UM10_FMT " duplicates " UM10_FMT " deltas)\n", object_count_by_type[OBJ_BLOB], duplicate_count_by_type[OBJ_BLOB], delta_count_by_type[OBJ_BLOB]);
+               fprintf(stderr, "      trees  :   " UM10_FMT " (" UM10_FMT " duplicates " UM10_FMT " deltas)\n", object_count_by_type[OBJ_TREE], duplicate_count_by_type[OBJ_TREE], delta_count_by_type[OBJ_TREE]);
+               fprintf(stderr, "      commits:   " UM10_FMT " (" UM10_FMT " duplicates " UM10_FMT " deltas)\n", object_count_by_type[OBJ_COMMIT], duplicate_count_by_type[OBJ_COMMIT], delta_count_by_type[OBJ_COMMIT]);
+               fprintf(stderr, "      tags   :   " UM10_FMT " (" UM10_FMT " duplicates " UM10_FMT " deltas)\n", object_count_by_type[OBJ_TAG], duplicate_count_by_type[OBJ_TAG], delta_count_by_type[OBJ_TAG]);
                fprintf(stderr, "Total branches:  %10lu (%10lu loads     )\n", branch_count, branch_load_count);
-               fprintf(stderr, "      marks:     %10ju (%10ju unique    )\n", (((uintmax_t)1) << marks->shift) * 1024, marks_set_count);
+               fprintf(stderr, "      marks:     " UM10_FMT " (" UM10_FMT " unique    )\n", (((uintmax_t)1) << marks->shift) * 1024, marks_set_count);
                fprintf(stderr, "      atoms:     %10u\n", atom_cnt);
-               fprintf(stderr, "Memory total:    %10ju KiB\n", (total_allocd + alloc_count*sizeof(struct object_entry))/1024);
+               fprintf(stderr, "Memory total:    " UM10_FMT " KiB\n", (total_allocd + alloc_count*sizeof(struct object_entry))/1024);
                fprintf(stderr, "       pools:    %10lu KiB\n", (unsigned long)(total_allocd/1024));
-               fprintf(stderr, "     objects:    %10ju KiB\n", (alloc_count*sizeof(struct object_entry))/1024);
+               fprintf(stderr, "     objects:    " UM10_FMT " KiB\n", (alloc_count*sizeof(struct object_entry))/1024);
                fprintf(stderr, "---------------------------------------------------------------------\n");
                pack_report();
                fprintf(stderr, "---------------------------------------------------------------------\n");