From: Junio C Hamano Date: Wed, 16 May 2007 19:43:05 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.5.2~20 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/fdcb769916c93b53517ef1b4cae447a3333c9b86?ds=inline;hp=-c Merge branch 'maint' * maint: format-patch: add MIME-Version header when we add content-type. Fixed link in user-manual import-tars: Use the "Link indicator" to identify directories git name-rev writes beyond the end of malloc() with large generations Documentation/branch: fix small typo in -D example --- fdcb769916c93b53517ef1b4cae447a3333c9b86 diff --combined Documentation/user-manual.txt index a7abeaa1d7,dd1578dc8d..8d66886335 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@@ -1357,7 -1357,7 +1357,7 @@@ $ gitk --merg These will display all commits which exist only on HEAD or on MERGE_HEAD, and which touch an unmerged file. - You may also use gitlink:git-mergetool, which lets you merge the + You may also use gitlink:git-mergetool[1], which lets you merge the unmerged files using external tools such as emacs or kdiff3. Each time you resolve the conflicts in a file and update the index: @@@ -1875,7 -1875,7 +1875,7 @@@ $ chmod a+x hooks/post-updat (For an explanation of the last two lines, see gitlink:git-update-server-info[1], and the documentation -link:hooks.txt[Hooks used by git].) +link:hooks.html[Hooks used by git].) Advertise the url of proj.git. Anybody else should then be able to clone or pull from that url, for example with a commandline like: @@@ -1959,7 -1959,7 +1959,7 @@@ Setting up a shared repositor Another way to collaborate is by using a model similar to that commonly used in CVS, where several developers with special rights all push to and pull from a single shared repository. See -link:cvs-migration.txt[git for CVS users] for instructions on how to +link:cvs-migration.html[git for CVS users] for instructions on how to set this up. [[setting-up-gitweb]] diff --combined commit.c index d01833d813,43b767ce53..bee066fa32 --- a/commit.c +++ b/commit.c @@@ -4,8 -4,6 +4,8 @@@ #include "pkt-line.h" #include "utf8.h" #include "interpolate.h" +#include "diff.h" +#include "revision.h" int save_commit_buffer = 1; @@@ -98,8 -96,12 +98,8 @@@ struct commit *lookup_commit_reference( struct commit *lookup_commit(const unsigned char *sha1) { struct object *obj = lookup_object(sha1); - if (!obj) { - struct commit *ret = alloc_commit_node(); - created_object(sha1, &ret->object); - ret->object.type = OBJ_COMMIT; - return ret; - } + if (!obj) + return create_object(sha1, OBJ_COMMIT, alloc_commit_node()); if (!obj->type) obj->type = OBJ_COMMIT; return check_commit(obj, sha1, 0); @@@ -526,7 -528,7 +526,7 @@@ static int add_rfc2047(char *buf, cons } static int add_user_info(const char *what, enum cmit_fmt fmt, char *buf, - const char *line, int relative_date, + const char *line, enum date_mode dmode, const char *encoding) { char *date; @@@ -569,7 -571,7 +569,7 @@@ switch (fmt) { case CMIT_FMT_MEDIUM: ret += sprintf(buf + ret, "Date: %s\n", - show_date(time, tz, relative_date)); + show_date(time, tz, dmode)); break; case CMIT_FMT_EMAIL: ret += sprintf(buf + ret, "Date: %s\n", @@@ -577,7 -579,7 +577,7 @@@ break; case CMIT_FMT_FULLER: ret += sprintf(buf + ret, "%sDate: %s\n", what, - show_date(time, tz, relative_date)); + show_date(time, tz, dmode)); break; default: /* notin' */ @@@ -800,8 -802,7 +800,8 @@@ static long format_commit_message(cons { "%Cgreen" }, /* green */ { "%Cblue" }, /* blue */ { "%Creset" }, /* reset color */ - { "%n" } /* newline */ + { "%n" }, /* newline */ + { "%m" }, /* left/right/bottom */ }; enum interp_index { IHASH = 0, IHASH_ABBREV, @@@ -817,15 -818,14 +817,15 @@@ ISUBJECT, IBODY, IRED, IGREEN, IBLUE, IRESET_COLOR, - INEWLINE + INEWLINE, + ILEFT_RIGHT, }; struct commit_list *p; char parents[1024]; int i; enum { HEADER, SUBJECT, BODY } state; - if (INEWLINE + 1 != ARRAY_SIZE(table)) + if (ILEFT_RIGHT + 1 != ARRAY_SIZE(table)) die("invalid interp table!"); /* these are independent of the commit */ @@@ -846,12 -846,6 +846,12 @@@ interp_set_entry(table, ITREE_ABBREV, find_unique_abbrev(commit->tree->object.sha1, DEFAULT_ABBREV)); + interp_set_entry(table, ILEFT_RIGHT, + (commit->object.flags & BOUNDARY) + ? "-" + : (commit->object.flags & SYMMETRIC_LEFT) + ? "<" + : ">"); parents[1] = 0; for (i = 0, p = commit->parents; @@@ -913,7 -907,7 +913,7 @@@ unsigned long pretty_print_commit(enum char *buf, unsigned long space, int abbrev, const char *subject, const char *after_subject, - int relative_date) + enum date_mode dmode) { int hdr = 1, body = 0, seen_title = 0; unsigned long offset = 0; @@@ -1017,14 -1011,14 +1017,14 @@@ offset += add_user_info("Author", fmt, buf + offset, line + 7, - relative_date, + dmode, encoding); if (!memcmp(line, "committer ", 10) && (fmt == CMIT_FMT_FULL || fmt == CMIT_FMT_FULLER)) offset += add_user_info("Commit", fmt, buf + offset, line + 10, - relative_date, + dmode, encoding); continue; } @@@ -1063,6 -1057,7 +1063,7 @@@ int sz; char header[512]; const char *header_fmt = + "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=%s\n" "Content-Transfer-Encoding: 8bit\n"; sz = snprintf(header, sizeof(header), header_fmt, diff --combined contrib/fast-import/import-tars.perl index 1e6fa5a15c,5bfd205225..23aeb257b9 --- a/contrib/fast-import/import-tars.perl +++ b/contrib/fast-import/import-tars.perl @@@ -75,7 -75,7 +75,7 @@@ foreach my $tar_file (@ARGV $mode = oct $mode; $size = oct $size; $mtime = oct $mtime; - next if $mode & 0040000; + next if $typeflag == 5; # directory print FI "blob\n", "mark :$next_mark\n", "data $size\n"; while ($size > 0 && read(I, $_, 512) == 512) { @@@ -84,12 -84,7 +84,12 @@@ } print FI "\n"; - my $path = "$prefix$name"; + my $path; + if ($prefix) { + $path = "$prefix/$name"; + } else { + $path = "$name"; + } $files{$path} = [$next_mark++, $mode]; $commit_time = $mtime if $mtime > $commit_time; diff --combined git-compat-util.h index c08688c8f3,7ed8b88b1f..6bd8987b27 --- a/git-compat-util.h +++ b/git-compat-util.h @@@ -13,14 -13,9 +13,17 @@@ #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) +#ifdef __GNUC__ +#define TYPEOF(x) (__typeof__(x)) +#else +#define TYPEOF(x) +#endif + +#define MSB(x, bits) ((x) & TYPEOF(x)(~0ULL << (sizeof(x) * 8 - (bits)))) + + /* Approximation of the length of the decimal representation of this type. */ + #define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1) + #if !defined(__APPLE__) && !defined(__FreeBSD__) #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */ #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */