Merge branch 'maint'
authorJunio C Hamano <junkio@cox.net>
Wed, 16 May 2007 19:43:05 +0000 (12:43 -0700)
committerJunio C Hamano <junkio@cox.net>
Wed, 16 May 2007 19:43:05 +0000 (12:43 -0700)
* 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

1  2 
Documentation/user-manual.txt
commit.c
contrib/fast-import/import-tars.perl
git-compat-util.h
index a7abeaa1d78beb26d6b293eede8f18cd22c8f509,dd1578dc8d7fd7ef0a965e15d352023f95f19b20..8d66886335ae74677a41b0ff1a653a9649c5ca42
@@@ -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 d01833d8137ece2f4a1d95d8b85d8ed54ecbd16b,43b767ce5342624f98603e83ba3ec263ea8a7dda..bee066fa3227c876022424bd0e6238c1053e1231
+++ 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;
        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",
                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,
                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 */
        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;
                                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;
                }
                        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,
index 1e6fa5a15cce13a4bc679dd41f8723d244afa980,5bfd205225a65bb4909cb44c305fb6235518d52a..23aeb257b9557cb146586868084ce1b20d7e7ac8
@@@ -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) {
                }
                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 c08688c8f355ccf61a746bbe1ac9a6788bdea7e3,7ed8b88b1f3cef2562693bbf6d68e2e4cef9465b..6bd8987b2774774fbbd3747a2b571b66ad78727b
  
  #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 */