Make git_status_config() file scope static to builtin-commit.c
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Aug 9, 2009 at 23:12 UTC
f766b36783c7ceeb0427f5e1af862b9a67ae1c4c
3 files changed
+60
-61
builtin-commit.c
+60
@@ -826,6 +826,66 @@ static int dry_run_commit(int argc, const char **argv, const char *prefix,
826
return commitable ? 0 : 1;
827
}
828
829
+static int parse_status_slot(const char *var, int offset)
830
+{
831
+ if (!strcasecmp(var+offset, "header"))
832
+ return WT_STATUS_HEADER;
833
+ if (!strcasecmp(var+offset, "updated")
834
+ || !strcasecmp(var+offset, "added"))
835
+ return WT_STATUS_UPDATED;
836
+ if (!strcasecmp(var+offset, "changed"))
837
+ return WT_STATUS_CHANGED;
838
+ if (!strcasecmp(var+offset, "untracked"))
839
+ return WT_STATUS_UNTRACKED;
840
+ if (!strcasecmp(var+offset, "nobranch"))
841
+ return WT_STATUS_NOBRANCH;
842
+ if (!strcasecmp(var+offset, "unmerged"))
843
+ return WT_STATUS_UNMERGED;
844
+ die("bad config variable '%s'", var);
845
+}
846
+
847
+static int git_status_config(const char *k, const char *v, void *cb)
848
+{
849
+ struct wt_status *s = cb;
850
+
851
+ if (!strcmp(k, "status.submodulesummary")) {
852
+ int is_bool;
853
+ s->submodule_summary = git_config_bool_or_int(k, v, &is_bool);
854
+ if (is_bool && s->submodule_summary)
855
+ s->submodule_summary = -1;
856
+ return 0;
857
+ }
858
+ if (!strcmp(k, "status.color") || !strcmp(k, "color.status")) {
859
+ s->use_color = git_config_colorbool(k, v, -1);
860
+ return 0;
861
+ }
862
+ if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
863
+ int slot = parse_status_slot(k, 13);
864
+ if (!v)
865
+ return config_error_nonbool(k);
866
+ color_parse(v, k, s->color_palette[slot]);
867
+ return 0;
868
+ }
869
+ if (!strcmp(k, "status.relativepaths")) {
870
+ s->relative_paths = git_config_bool(k, v);
871
+ return 0;
872
+ }
873
+ if (!strcmp(k, "status.showuntrackedfiles")) {
874
+ if (!v)
875
+ return config_error_nonbool(k);
876
+ else if (!strcmp(v, "no"))
877
+ s->show_untracked_files = SHOW_NO_UNTRACKED_FILES;
878
+ else if (!strcmp(v, "normal"))
879
+ s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
880
+ else if (!strcmp(v, "all"))
881
+ s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
882
+ else
883
+ return error("Invalid untracked files mode '%s'", v);
884
+ return 0;
885
+ }
886
+ return git_diff_ui_config(k, v, NULL);
887
+}
888
+
889
int cmd_status(int argc, const char **argv, const char *prefix)
890
{
891
struct wt_status s;
wt-status.c
-60
@@ -19,24 +19,6 @@ static char default_wt_status_colors[][COLOR_MAXLEN] = {
19
GIT_COLOR_RED, /* WT_STATUS_UNMERGED */
20
};
21
22
-static int parse_status_slot(const char *var, int offset)
23
-{
24
- if (!strcasecmp(var+offset, "header"))
25
- return WT_STATUS_HEADER;
26
- if (!strcasecmp(var+offset, "updated")
27
- || !strcasecmp(var+offset, "added"))
28
- return WT_STATUS_UPDATED;
29
- if (!strcasecmp(var+offset, "changed"))
30
- return WT_STATUS_CHANGED;
31
- if (!strcasecmp(var+offset, "untracked"))
32
- return WT_STATUS_UNTRACKED;
33
- if (!strcasecmp(var+offset, "nobranch"))
34
- return WT_STATUS_NOBRANCH;
35
- if (!strcasecmp(var+offset, "unmerged"))
36
- return WT_STATUS_UNMERGED;
37
- die("bad config variable '%s'", var);
38
-}
39
-
22
static const char *color(int slot, struct wt_status *s)
23
{
24
return s->use_color > 0 ? s->color_palette[slot] : "";
@@ -594,45 +576,3 @@ void wt_status_print(struct wt_status *s)
576
printf("nothing to commit (working directory clean)\n");
577
}
578
}
597
-
598
-int git_status_config(const char *k, const char *v, void *cb)
599
-{
600
- struct wt_status *s = cb;
601
-
602
- if (!strcmp(k, "status.submodulesummary")) {
603
- int is_bool;
604
- s->submodule_summary = git_config_bool_or_int(k, v, &is_bool);
605
- if (is_bool && s->submodule_summary)
606
- s->submodule_summary = -1;
607
- return 0;
608
- }
609
- if (!strcmp(k, "status.color") || !strcmp(k, "color.status")) {
610
- s->use_color = git_config_colorbool(k, v, -1);
611
- return 0;
612
- }
613
- if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
614
- int slot = parse_status_slot(k, 13);
615
- if (!v)
616
- return config_error_nonbool(k);
617
- color_parse(v, k, s->color_palette[slot]);
618
- return 0;
619
- }
620
- if (!strcmp(k, "status.relativepaths")) {
621
- s->relative_paths = git_config_bool(k, v);
622
- return 0;
623
- }
624
- if (!strcmp(k, "status.showuntrackedfiles")) {
625
- if (!v)
626
- return config_error_nonbool(k);
627
- else if (!strcmp(v, "no"))
628
- s->show_untracked_files = SHOW_NO_UNTRACKED_FILES;
629
- else if (!strcmp(v, "normal"))
630
- s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
631
- else if (!strcmp(v, "all"))
632
- s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
633
- else
634
- return error("Invalid untracked files mode '%s'", v);
635
- return 0;
636
- }
637
- return git_diff_ui_config(k, v, NULL);
638
-}
wt-status.h
-1
@@ -50,7 +50,6 @@ struct wt_status {
50
struct string_list change;
51
};
52
53
-int git_status_config(const char *var, const char *value, void *cb);
53
void wt_status_prepare(struct wt_status *s);
54
void wt_status_print(struct wt_status *s);
55
void wt_status_collect_changes(struct wt_status *s);