Merge branch 'nd/status-auto-comment-char'
authorJunio C Hamano <gitster@pobox.com>
Fri, 6 Jun 2014 18:36:10 +0000 (11:36 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Jun 2014 18:36:10 +0000 (11:36 -0700)
* nd/status-auto-comment-char:
commit: allow core.commentChar=auto for character auto selection
config: be strict on core.commentChar

1  2 
Documentation/config.txt
builtin/commit.c
cache.h
config.c
environment.c
t/t7502-commit.sh
Simple merge
index d28505a857dad9e897896473a88e05f32f56bfb2,515c4c4c0553c00c0ad6d577af192a96cf1bc60a..99c20446352edb477d19122fae2b2821e10d689f
@@@ -608,18 -585,45 +608,48 @@@ static void determine_author_info(struc
        }
  }
  
 -static char *cut_ident_timestamp_part(char *string)
 +static void split_ident_or_die(struct ident_split *id, const struct strbuf *buf)
 +{
 +      if (split_ident_line(id, buf->buf, buf->len) ||
 +          !sane_ident_split(id))
 +              die(_("Malformed ident string: '%s'"), buf->buf);
 +}
 +
 +static int author_date_is_interesting(void)
  {
 -      char *ket = strrchr(string, '>');
 -      if (!ket || ket[1] != ' ')
 -              die(_("Malformed ident string: '%s'"), string);
 -      *++ket = '\0';
 -      return ket;
 +      return author_message || force_date;
  }
  
+ static void adjust_comment_line_char(const struct strbuf *sb)
+ {
+       char candidates[] = "#;@!$%^&|:";
+       char *candidate;
+       const char *p;
+       comment_line_char = candidates[0];
+       if (!memchr(sb->buf, comment_line_char, sb->len))
+               return;
+       p = sb->buf;
+       candidate = strchr(candidates, *p);
+       if (candidate)
+               *candidate = ' ';
+       for (p = sb->buf; *p; p++) {
+               if ((p[0] == '\n' || p[0] == '\r') && p[1]) {
+                       candidate = strchr(candidates, p[1]);
+                       if (candidate)
+                               *candidate = ' ';
+               }
+       }
+       for (p = candidates; *p == ' '; p++)
+               ;
+       if (!*p)
+               die(_("unable to select a comment character that is not used\n"
+                     "in the current commit message"));
+       comment_line_char = *p;
+ }
  static int prepare_to_commit(const char *index_file, const char *prefix,
                             struct commit *current_head,
                             struct wt_status *s,
diff --cc cache.h
Simple merge
diff --cc config.c
Simple merge
diff --cc environment.c
Simple merge
Simple merge