summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 23900a9)
raw | patch | inline | side by side (parent: 23900a9)
author | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 Aug 2009 06:12:19 +0000 (23:12 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 Aug 2009 19:56:36 +0000 (12:56 -0700) |
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-commit.c | patch | blob | history | |
wt-status.c | patch | blob | history | |
wt-status.h | patch | blob | history |
diff --git a/builtin-commit.c b/builtin-commit.c
index 716eec832d527feada6b02727e3b72f438b6acf8..1c200eb9631c983dbde1a150497b0308eb1809d4 100644 (file)
--- a/builtin-commit.c
+++ b/builtin-commit.c
return commitable ? 0 : 1;
}
+static int parse_status_slot(const char *var, int offset)
+{
+ if (!strcasecmp(var+offset, "header"))
+ return WT_STATUS_HEADER;
+ if (!strcasecmp(var+offset, "updated")
+ || !strcasecmp(var+offset, "added"))
+ return WT_STATUS_UPDATED;
+ if (!strcasecmp(var+offset, "changed"))
+ return WT_STATUS_CHANGED;
+ if (!strcasecmp(var+offset, "untracked"))
+ return WT_STATUS_UNTRACKED;
+ if (!strcasecmp(var+offset, "nobranch"))
+ return WT_STATUS_NOBRANCH;
+ if (!strcasecmp(var+offset, "unmerged"))
+ return WT_STATUS_UNMERGED;
+ die("bad config variable '%s'", var);
+}
+
+static int git_status_config(const char *k, const char *v, void *cb)
+{
+ struct wt_status *s = cb;
+
+ if (!strcmp(k, "status.submodulesummary")) {
+ int is_bool;
+ s->submodule_summary = git_config_bool_or_int(k, v, &is_bool);
+ if (is_bool && s->submodule_summary)
+ s->submodule_summary = -1;
+ return 0;
+ }
+ if (!strcmp(k, "status.color") || !strcmp(k, "color.status")) {
+ s->use_color = git_config_colorbool(k, v, -1);
+ return 0;
+ }
+ if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
+ int slot = parse_status_slot(k, 13);
+ if (!v)
+ return config_error_nonbool(k);
+ color_parse(v, k, s->color_palette[slot]);
+ return 0;
+ }
+ if (!strcmp(k, "status.relativepaths")) {
+ s->relative_paths = git_config_bool(k, v);
+ return 0;
+ }
+ if (!strcmp(k, "status.showuntrackedfiles")) {
+ if (!v)
+ return config_error_nonbool(k);
+ else if (!strcmp(v, "no"))
+ s->show_untracked_files = SHOW_NO_UNTRACKED_FILES;
+ else if (!strcmp(v, "normal"))
+ s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
+ else if (!strcmp(v, "all"))
+ s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
+ else
+ return error("Invalid untracked files mode '%s'", v);
+ return 0;
+ }
+ return git_diff_ui_config(k, v, NULL);
+}
+
int cmd_status(int argc, const char **argv, const char *prefix)
{
struct wt_status s;
diff --git a/wt-status.c b/wt-status.c
index cfbaf309ad1716a820a1d73b9fba889a1e530285..4cbe03a70a2eef6bd67cc7ed3ee0ed32ab575493 100644 (file)
--- a/wt-status.c
+++ b/wt-status.c
GIT_COLOR_RED, /* WT_STATUS_UNMERGED */
};
-static int parse_status_slot(const char *var, int offset)
-{
- if (!strcasecmp(var+offset, "header"))
- return WT_STATUS_HEADER;
- if (!strcasecmp(var+offset, "updated")
- || !strcasecmp(var+offset, "added"))
- return WT_STATUS_UPDATED;
- if (!strcasecmp(var+offset, "changed"))
- return WT_STATUS_CHANGED;
- if (!strcasecmp(var+offset, "untracked"))
- return WT_STATUS_UNTRACKED;
- if (!strcasecmp(var+offset, "nobranch"))
- return WT_STATUS_NOBRANCH;
- if (!strcasecmp(var+offset, "unmerged"))
- return WT_STATUS_UNMERGED;
- die("bad config variable '%s'", var);
-}
-
static const char *color(int slot, struct wt_status *s)
{
return s->use_color > 0 ? s->color_palette[slot] : "";
printf("nothing to commit (working directory clean)\n");
}
}
-
-int git_status_config(const char *k, const char *v, void *cb)
-{
- struct wt_status *s = cb;
-
- if (!strcmp(k, "status.submodulesummary")) {
- int is_bool;
- s->submodule_summary = git_config_bool_or_int(k, v, &is_bool);
- if (is_bool && s->submodule_summary)
- s->submodule_summary = -1;
- return 0;
- }
- if (!strcmp(k, "status.color") || !strcmp(k, "color.status")) {
- s->use_color = git_config_colorbool(k, v, -1);
- return 0;
- }
- if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
- int slot = parse_status_slot(k, 13);
- if (!v)
- return config_error_nonbool(k);
- color_parse(v, k, s->color_palette[slot]);
- return 0;
- }
- if (!strcmp(k, "status.relativepaths")) {
- s->relative_paths = git_config_bool(k, v);
- return 0;
- }
- if (!strcmp(k, "status.showuntrackedfiles")) {
- if (!v)
- return config_error_nonbool(k);
- else if (!strcmp(v, "no"))
- s->show_untracked_files = SHOW_NO_UNTRACKED_FILES;
- else if (!strcmp(v, "normal"))
- s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
- else if (!strcmp(v, "all"))
- s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
- else
- return error("Invalid untracked files mode '%s'", v);
- return 0;
- }
- return git_diff_ui_config(k, v, NULL);
-}
diff --git a/wt-status.h b/wt-status.h
index 0297fabdc199c5e369674d564c9c1404156e1a11..95f5af8902bf57cc67bcb84296934dec64d6ac0e 100644 (file)
--- a/wt-status.h
+++ b/wt-status.h
struct string_list change;
};
-int git_status_config(const char *var, const char *value, void *cb);
void wt_status_prepare(struct wt_status *s);
void wt_status_print(struct wt_status *s);
void wt_status_collect_changes(struct wt_status *s);