Merge part of 'js/fmt-patch' for RFC2822 dates into 'sp/reflog'
authorJunio C Hamano <junkio@cox.net>
Fri, 19 May 2006 22:25:57 +0000 (15:25 -0700)
committerJunio C Hamano <junkio@cox.net>
Fri, 19 May 2006 22:25:57 +0000 (15:25 -0700)
An earlier patch from Shawn Pearce dependes on a change that is
only in "next".  I do not want to make this series hostage to
the yet-to-graduate js/fmt-patch branch, but let's try fixing it
by merging the early parts of the branch to see what happens.

Right now, 'sp/reflog' will not be in "next" for now, so I won't
have to regret this -- if this merge causes problem down the road
merging I can always rebuild the topic branch ;-).

1  2 
builtin.h
cache.h
commit.c
git.c
log-tree.c

diff --cc builtin.h
index 7744f7d2f64185ceac6fc79afa64f1318f9984d4,94dc0732f9f42069f375673ce1b26aa0b43c26e6..97e24644687d819fddf57beaaddf4bdda731bb82
+++ b/builtin.h
@@@ -19,10 -19,6 +19,11 @@@ extern int cmd_version(int argc, const 
  extern int cmd_whatchanged(int argc, const char **argv, char **envp);
  extern int cmd_show(int argc, const char **argv, char **envp);
  extern int cmd_log(int argc, const char **argv, char **envp);
 +extern int cmd_diff(int argc, const char **argv, char **envp);
+ extern int cmd_format_patch(int argc, const char **argv, char **envp);
 +extern int cmd_count_objects(int argc, const char **argv, char **envp);
 +
 +extern int cmd_push(int argc, const char **argv, char **envp);
 +extern int cmd_grep(int argc, const char **argv, char **envp);
  
  #endif
diff --cc cache.h
Simple merge
diff --cc commit.c
index 4a26070c137243bf099cf10415b2910eca230368,42b44bba52b3bcf8545f7e7753d5ebb755155163..8317f6d26da8bc684c020a3116cb5685916f278d
+++ b/commit.c
@@@ -22,33 -22,25 +22,34 @@@ struct sort_nod
  
  const char *commit_type = "commit";
  
 +struct cmt_fmt_map {
 +      const char *n;
 +      size_t cmp_len;
 +      enum cmit_fmt v;
 +} cmt_fmts[] = {
 +      { "raw",        1,      CMIT_FMT_RAW },
 +      { "medium",     1,      CMIT_FMT_MEDIUM },
 +      { "short",      1,      CMIT_FMT_SHORT },
++      { "email",      1,      CMIT_FMT_EMAIL },
 +      { "full",       5,      CMIT_FMT_FULL },
 +      { "fuller",     5,      CMIT_FMT_FULLER },
 +      { "oneline",    1,      CMIT_FMT_ONELINE },
 +};
 +
  enum cmit_fmt get_commit_format(const char *arg)
  {
 -      if (!*arg)
 +      int i;
 +
 +      if (!arg || !*arg)
                return CMIT_FMT_DEFAULT;
 -      if (!strcmp(arg, "=raw"))
 -              return CMIT_FMT_RAW;
 -      if (!strcmp(arg, "=medium"))
 -              return CMIT_FMT_MEDIUM;
 -      if (!strcmp(arg, "=short"))
 -              return CMIT_FMT_SHORT;
 -      if (!strcmp(arg, "=full"))
 -              return CMIT_FMT_FULL;
 -      if (!strcmp(arg, "=fuller"))
 -              return CMIT_FMT_FULLER;
 -      if (!strcmp(arg, "=email"))
 -              return CMIT_FMT_EMAIL;
 -      if (!strcmp(arg, "=oneline"))
 -              return CMIT_FMT_ONELINE;
 -      die("invalid --pretty format");
 +      if (*arg == '=')
 +              arg++;
 +      for (i = 0; i < ARRAY_SIZE(cmt_fmts); i++) {
 +              if (!strncmp(arg, cmt_fmts[i].n, cmt_fmts[i].cmp_len))
 +                      return cmt_fmts[i].v;
 +      }
 +
 +      die("invalid --pretty format: %s", arg);
  }
  
  static struct commit *check_commit(struct object *obj,
diff --cc git.c
index a94d9ee5a73bc5f81982f49c06293df5bcf2d8cc,619c6654e45d0208adefc6aecf723c5c25fd4a7b..84803a62e6c4dc6b64aaf5d1fda9991be535048a
--- 1/git.c
--- 2/git.c
+++ b/git.c
@@@ -46,10 -47,7 +46,11 @@@ static void handle_internal_command(in
                { "log", cmd_log },
                { "whatchanged", cmd_whatchanged },
                { "show", cmd_show },
 +              { "push", cmd_push },
+               { "fmt-patch", cmd_format_patch },
 +              { "count-objects", cmd_count_objects },
 +              { "diff", cmd_diff },
 +              { "grep", cmd_grep },
        };
        int i;
  
diff --cc log-tree.c
index b90ba6762ad0aa469a19c42cf8d53f7a79db02d5,aaf2b9423f01243584e15e6c93007a3f42c9d917..2bcf2dfaaa483362b3cc4beb0ae73f3e6fabe764
@@@ -49,14 -37,20 +49,22 @@@ void show_log(struct rev_info *opt, str
        /*
         * Print header line of header..
         */
-       printf("%s%s",
-               opt->commit_format == CMIT_FMT_ONELINE ? "" : "commit ",
-               diff_unique_abbrev(commit->object.sha1, abbrev_commit));
-       if (opt->parents)
-               show_parents(commit, abbrev_commit);
-       if (parent)
-               printf(" (from %s)", diff_unique_abbrev(parent->object.sha1, abbrev_commit));
-       putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n');
+       if (opt->commit_format == CMIT_FMT_EMAIL)
+               printf("From %s  Thu Apr 7 15:13:13 2005\n",
+                      sha1_to_hex(commit->object.sha1));
+       else {
+               printf("%s%s",
+                      opt->commit_format == CMIT_FMT_ONELINE ? "" : "commit ",
+                      diff_unique_abbrev(commit->object.sha1, abbrev_commit));
 -              if (parent) 
++              if (opt->parents)
++                      show_parents(commit, abbrev_commit);
++              if (parent)
+                       printf(" (from %s)",
+                              diff_unique_abbrev(parent->object.sha1,
+                                                 abbrev_commit));
+               putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n');
+       }
  
        /*
         * And then the pretty-printed message itself