]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/spht'
authorJunio C Hamano <gitster@pobox.com>
Sun, 9 Dec 2007 09:23:48 +0000 (01:23 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sun, 9 Dec 2007 09:23:48 +0000 (01:23 -0800)
* jc/spht:
  Use gitattributes to define per-path whitespace rule
  core.whitespace: documentation updates.
  builtin-apply: teach whitespace_rules
  builtin-apply: rename "whitespace" variables and fix styles
  core.whitespace: add test for diff whitespace error highlighting
  git-diff: complain about >=8 consecutive spaces in initial indent
  War on whitespace: first, a bit of retreat.

Conflicts:

cache.h
config.c
diff.c

1  2 
Documentation/config.txt
Documentation/gitattributes.txt
Makefile
builtin-apply.c
cache.h
config.c
diff.c
environment.c

index 79d51f26ccfa69a3785e6bebcbdce9b320d96e6d,0e711374dd99e5be07e17bae1b37c81e9062fd66..fabe7f859f32aa53ae86244f014e58bd3aa5ee3d
@@@ -387,22 -392,10 +401,22 @@@ color.diff.<slot>:
        which part of the patch to use the specified color, and is one
        of `plain` (context text), `meta` (metainformation), `frag`
        (hunk header), `old` (removed lines), `new` (added lines),
-       `commit` (commit headers), or `whitespace` (highlighting dubious
-       whitespace).  The values of these variables may be specified as
+       `commit` (commit headers), or `whitespace` (highlighting
+       whitespace errors). The values of these variables may be specified as
        in color.branch.<slot>.
  
 +color.interactive::
 +      When set to `always`, always use colors in `git add --interactive`.
 +      When false (or `never`), never.  When set to `true` or `auto`, use
 +      colors only when the output is to the terminal. Defaults to false.
 +
 +color.interactive.<slot>::
 +      Use customized color for `git add --interactive`
 +      output. `<slot>` may be `prompt`, `header`, or `help`, for
 +      three distinct types of normal output from interactive
 +      programs.  The values of these variables may be specified as
 +      in color.branch.<slot>.
 +
  color.pager::
        A boolean to enable/disable colored output when the pager is in
        use (default is true).
Simple merge
diff --cc Makefile
Simple merge
diff --cc builtin-apply.c
Simple merge
diff --cc cache.h
index c6142e9b7a8effbe31b5dcca3035d32138de84cf,9cc6268d4531f17703268f49057e4c9f284f0331..1bcb3df7a20b7eb90c15807b92ae0e016266d5fd
+++ b/cache.h
@@@ -644,9 -602,16 +644,21 @@@ extern int diff_auto_refresh_index
  /* match-trees.c */
  void shift_tree(const unsigned char *, const unsigned char *, unsigned char *, int);
  
+ /*
+  * whitespace rules.
+  * used by both diff and apply
+  */
+ #define WS_TRAILING_SPACE     01
+ #define WS_SPACE_BEFORE_TAB   02
+ #define WS_INDENT_WITH_NON_TAB        04
+ #define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB)
+ extern unsigned whitespace_rule_cfg;
+ extern unsigned whitespace_rule(const char *);
+ extern unsigned parse_whitespace_rule(const char *);
 +/* ls-files */
 +int pathspec_match(const char **spec, char *matched, const char *filename, int skiplen);
 +int report_path_error(const char *ps_matched, const char **pathspec, int prefix_offset);
 +void overlay_tree_on_cache(const char *tree_name, const char *prefix);
 +
  #endif /* CACHE_H */
diff --cc config.c
index 15b3d07349b246d3a46721c5d84c65a2093d9ad3,2500e0d59a6b772966e07c8b9ad15f36cc8000d4..49d2b427e52008e612b534f0c567e9fadaeab6e3
+++ b/config.c
@@@ -432,13 -431,11 +432,18 @@@ int git_default_config(const char *var
                return 0;
        }
  
 +      if (!strcmp(var, "core.excludesfile")) {
 +              if (!value)
 +                      die("core.excludesfile without value");
 +              excludes_file = xstrdup(value);
 +              return 0;
 +      }
 +
+       if (!strcmp(var, "core.whitespace")) {
+               whitespace_rule_cfg = parse_whitespace_rule(value);
+               return 0;
+       }
        /* Add other config variables here and to Documentation/config.txt. */
        return 0;
  }
diff --cc diff.c
index be6cf687a4421acdc127df73aafef4aa9cf4daac,c3a1942bbb7da298cfbe2cb23c97fe361c9400ae..f780e3e8e67f4b1e07ef1d70ab3b9f101ff6b868
--- 1/diff.c
--- 2/diff.c
+++ b/diff.c
@@@ -1315,8 -1331,9 +1331,9 @@@ static void builtin_diff(const char *na
                memset(&xecfg, 0, sizeof(xecfg));
                memset(&ecbdata, 0, sizeof(ecbdata));
                ecbdata.label_path = lbl;
 -              ecbdata.color_diff = o->color_diff;
 +              ecbdata.color_diff = DIFF_OPT_TST(o, COLOR_DIFF);
                ecbdata.found_changesp = &o->found_changes;
+               ecbdata.ws_rule = whitespace_rule(name_b ? name_b : name_a);
                xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;
                xecfg.ctxlen = o->context;
                xecfg.flags = XDL_EMIT_FUNCNAMES;
@@@ -1409,7 -1426,8 +1426,8 @@@ static void builtin_checkdiff(const cha
        data.xm.consume = checkdiff_consume;
        data.filename = name_b ? name_b : name_a;
        data.lineno = 0;
 -      data.color_diff = o->color_diff;
 +      data.color_diff = DIFF_OPT_TST(o, COLOR_DIFF);
+       data.ws_rule = whitespace_rule(data.filename);
  
        if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
                die("unable to read files to diff");
diff --cc environment.c
index 1dab72ec1525ca6dd15ca20666cd91506b85890c,2fbbc8e430cb6cd331f6835e07ede7c1e7d2a45a..f3e3d4138d463520dbe6d709dfbe0803b619456d
@@@ -34,8 -34,8 +34,9 @@@ char *pager_program
  int pager_in_use;
  int pager_use_color = 1;
  char *editor_program;
 +char *excludes_file;
  int auto_crlf = 0;    /* 1: both ways, -1: only when adding git objects */
+ unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
  
  /* This is set by setup_git_dir_gently() and/or git_default_config() */
  char *git_work_tree_cfg;