summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 67a4b58)
raw | patch | inline | side by side (parent: 67a4b58)
author | Nazri Ramliy <ayiehere@gmail.com> | |
Thu, 24 Jun 2010 00:21:16 +0000 (08:21 +0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 24 Jun 2010 19:57:34 +0000 (12:57 -0700) |
Signed-off-by: Nazri Ramliy <ayiehere@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config.txt | patch | blob | history | |
builtin/log.c | patch | blob | history | |
log-tree.c | patch | blob | history | |
log-tree.h | patch | blob | history |
index 7afd0a333f5e67fcfcc5c5277c3a871f6825ea83..89cb487bd1dd79768e7bfb48e7cd1efbd86e74ea 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
(highlighting whitespace errors). The values of these variables may be
specified as in color.branch.<slot>.
+color.decorate.<slot>::
+ Use customized color for 'git log --decorate' output. `<slot>` is one
+ of `branch`, `remoteBranch`, `tag`, `stash` or `HEAD` for local
+ branches, remote tracking branches, tags, stash and HEAD, respectively.
+
color.grep::
When set to `always`, always highlight matches. When `false` (or
`never`), never. When set to `true` or `auto`, use color only
diff --git a/builtin/log.c b/builtin/log.c
index 976e16f9f2e6e5f8e2229d90caae9f7df4d75309..0835866b153599ce504e32f5e7231b305718d4e9 100644 (file)
--- a/builtin/log.c
+++ b/builtin/log.c
default_show_root = git_config_bool(var, value);
return 0;
}
+ if (!prefixcmp(var, "color.decorate."))
+ return parse_decorate_color_config(var, 15, value);
+
return git_diff_ui_config(var, value, cb);
}
diff --git a/log-tree.c b/log-tree.c
index 61680f4664e5be109b9e1471ea18ee1818f2f9c9..b46ed3baef7d9d9971a3886d700059217fbe974a 100644 (file)
--- a/log-tree.c
+++ b/log-tree.c
return "";
}
+static int parse_decorate_color_slot(const char *slot)
+{
+ /*
+ * We're comparing with 'ignore-case' on
+ * (because config.c sets them all tolower),
+ * but let's match the letters in the literal
+ * string values here with how they are
+ * documented in Documentation/config.txt, for
+ * consistency.
+ *
+ * We love being consistent, don't we?
+ */
+ if (!strcasecmp(slot, "branch"))
+ return DECORATION_REF_LOCAL;
+ if (!strcasecmp(slot, "remoteBranch"))
+ return DECORATION_REF_REMOTE;
+ if (!strcasecmp(slot, "tag"))
+ return DECORATION_REF_TAG;
+ if (!strcasecmp(slot, "stash"))
+ return DECORATION_REF_STASH;
+ if (!strcasecmp(slot, "HEAD"))
+ return DECORATION_REF_HEAD;
+ return -1;
+}
+
+int parse_decorate_color_config(const char *var, const int ofs, const char *value)
+{
+ int slot = parse_decorate_color_slot(var + ofs);
+ if (slot < 0)
+ return 0;
+ if (!value)
+ return config_error_nonbool(var);
+ color_parse(value, var, decoration_colors[slot]);
+ return 0;
+}
+
/*
* log-tree.c uses DIFF_OPT_TST for determining whether to use color
* for showing the commit sha1, use the same check for --decorate
diff --git a/log-tree.h b/log-tree.h
index 3f7b40027b7203985f018e43ab72a6cfc233e8d7..5c4cf7cac3327e2ef6000dff414680cd5c4c0e1e 100644 (file)
--- a/log-tree.h
+++ b/log-tree.h
struct commit *commit, *parent;
};
+int parse_decorate_color_config(const char *var, const int ofs, const char *value);
void init_log_tree_opt(struct rev_info *);
int log_tree_diff_flush(struct rev_info *);
int log_tree_commit(struct rev_info *, struct commit *);