From f496454e0fd22d003e9c9b5c3742b12d526bc0a4 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Mon, 19 Feb 2007 13:35:35 +0100 Subject: git-clone: Sync documentation to usage note. Documentation advertises the new `--depth ' parameter with an equal sign, while the usage notes (shown after `git-clone --help') do not. If I understood git-clone's source code correctly, the version without the equal sign is correct, which is why this patch syncs documentation to the usage note. Signed-off-by: Christian Schlotter Signed-off-by: Junio C Hamano --- Documentation/RelNotes-1.5.0.txt | 2 +- Documentation/git-clone.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/RelNotes-1.5.0.txt b/Documentation/RelNotes-1.5.0.txt index 599efb8c90..daf4bdb0d7 100644 --- a/Documentation/RelNotes-1.5.0.txt +++ b/Documentation/RelNotes-1.5.0.txt @@ -448,7 +448,7 @@ Updates in v1.5.0 since v1.4.4 series - There is a partial support for 'shallow' repositories that keeps only recent history. A 'shallow clone' is created by specifying how deep that truncated history should be - (e.g. "git clone --depth=5 git://some.where/repo.git"). + (e.g. "git clone --depth 5 git://some.where/repo.git"). Currently a shallow repository has number of limitations: diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt index 707376f22c..6d32c491a5 100644 --- a/Documentation/git-clone.txt +++ b/Documentation/git-clone.txt @@ -11,7 +11,7 @@ SYNOPSIS [verse] 'git-clone' [--template=] [-l [-s]] [-q] [-n] [--bare] [-o ] [-u ] [--reference ] - [--depth=] [] + [--depth ] [] DESCRIPTION ----------- @@ -96,7 +96,7 @@ OPTIONS if unset the templates are taken from the installation defined default, typically `/usr/share/git-core/templates`. ---depth=:: +--depth :: Create a 'shallow' clone with a history truncated to the specified number of revs. A shallow repository has number of limitations (you cannot clone or fetch from -- cgit v1.2.3 From bc6b4f52fc79712db637ff90a472b82b32695e11 Mon Sep 17 00:00:00 2001 From: Jason Riedy Date: Mon, 19 Feb 2007 16:22:56 -0800 Subject: Add a compat/strtoumax.c for Solaris 8. Solaris 8 was pre-c99, and they weren't willing to commit to the strtoumax definition according to /usr/include/inttypes.h. This adds NO_STRTOUMAX and NO_STRTOULL for ancient systems. If NO_STRTOUMAX is defined, the routine in compat/strtoumax.c will be used instead. That routine passes its arguments to strtoull unless NO_STRTOULL is defined. If NO_STRTOULL, then the routine uses strtoul (unsigned long). Signed-off-by: Jason Riedy Acked-by: Shawn O Pearce Signed-off-by: Junio C Hamano --- Makefile | 13 +++++++++++++ compat/strtoumax.c | 10 ++++++++++ git-compat-util.h | 5 +++++ 3 files changed, 28 insertions(+) create mode 100644 compat/strtoumax.c diff --git a/Makefile b/Makefile index dae2919965..f85fb7c197 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +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. @@ -353,11 +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 @@ ifdef NO_STRLCPY 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 --git a/compat/strtoumax.c b/compat/strtoumax.c new file mode 100644 index 0000000000..5541353a77 --- /dev/null +++ b/compat/strtoumax.c @@ -0,0 +1,10 @@ +#include "../git-compat-util.h" + +uintmax_t gitstrtoumax (const char *nptr, char **endptr, int base) +{ +#if defined(NO_STRTOULL) + return strtoul(nptr, endptr, base); +#else + return strtoull(nptr, endptr, base); +#endif +} diff --git a/git-compat-util.h b/git-compat-util.h index 105ac28f97..9863cf671f 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -139,6 +139,11 @@ extern char *gitstrcasestr(const char *haystack, const char *needle); extern size_t gitstrlcpy(char *, const char *, size_t); #endif +#ifdef NO_STRTOUMAX +#define strtoumax gitstrtoumax +extern uintmax_t gitstrtoumax(const char *, char **, int); +#endif + extern void release_pack_memory(size_t); static inline char* xstrdup(const char *str) -- cgit v1.2.3 From e326bce65c2a8b10f40c1869e13c7450a243b109 Mon Sep 17 00:00:00 2001 From: Jason Riedy Date: Mon, 19 Feb 2007 16:27:09 -0800 Subject: Obey NO_C99_FORMAT in fast-import.c. Define UM_FMT and UM10_FMT and use in place of %ju and %10ju, respectively. Both format as unsigned long long, so this assumes the compiler supports long long. Signed-off-by: Jason Riedy Signed-off-by: Junio C Hamano --- fast-import.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/fast-import.c b/fast-import.c index fd3b117574..8720090a3e 100644 --- a/fast-import.c +++ b/fast-import.c @@ -133,6 +133,15 @@ Format of STDIN stream: #define PACK_ID_BITS 16 #define MAX_PACK_ID ((1<data.marked[idnum]; } if (!oe) - die("mark :%ju not declared", orig_idnum); + die("mark :" UM_FMT " not declared", orig_idnum); return oe; } @@ -1361,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 @@ 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 @@ static struct hash_list *cmd_merge(unsigned int *count) 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 @@ 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 @@ 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"); -- cgit v1.2.3