summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-10-20 19:23:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-10-20 19:23:48 (GMT)
commitb94657683996402228abb1694a5db4792c424f9e (patch)
treea553b8703be639bf1af8c74946337a5ebe08529f /builtin/commit.c
parentb67588d018441d1485378a7d9b460401ba8b76a5 (diff)
parentf6c5a2968c103621adf6928a29e4895361eaa23b (diff)
downloadgit-b94657683996402228abb1694a5db4792c424f9e.zip
git-b94657683996402228abb1694a5db4792c424f9e.tar.gz
git-b94657683996402228abb1694a5db4792c424f9e.tar.bz2
Merge branch 'jn/parse-config-slot'
Code cleanup. * jn/parse-config-slot: color_parse: do not mention variable name in error message pass config slots as pointers instead of offsets
Diffstat (limited to 'builtin/commit.c')
-rw-r--r--builtin/commit.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 81dc622..60d35d0 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1272,22 +1272,21 @@ static int dry_run_commit(int argc, const char **argv, const char *prefix,
return commitable ? 0 : 1;
}
-static int parse_status_slot(const char *var, int offset)
+static int parse_status_slot(const char *slot)
{
- if (!strcasecmp(var+offset, "header"))
+ if (!strcasecmp(slot, "header"))
return WT_STATUS_HEADER;
- if (!strcasecmp(var+offset, "branch"))
+ if (!strcasecmp(slot, "branch"))
return WT_STATUS_ONBRANCH;
- if (!strcasecmp(var+offset, "updated")
- || !strcasecmp(var+offset, "added"))
+ if (!strcasecmp(slot, "updated") || !strcasecmp(slot, "added"))
return WT_STATUS_UPDATED;
- if (!strcasecmp(var+offset, "changed"))
+ if (!strcasecmp(slot, "changed"))
return WT_STATUS_CHANGED;
- if (!strcasecmp(var+offset, "untracked"))
+ if (!strcasecmp(slot, "untracked"))
return WT_STATUS_UNTRACKED;
- if (!strcasecmp(var+offset, "nobranch"))
+ if (!strcasecmp(slot, "nobranch"))
return WT_STATUS_NOBRANCH;
- if (!strcasecmp(var+offset, "unmerged"))
+ if (!strcasecmp(slot, "unmerged"))
return WT_STATUS_UNMERGED;
return -1;
}
@@ -1327,13 +1326,12 @@ static int git_status_config(const char *k, const char *v, void *cb)
}
if (skip_prefix(k, "status.color.", &slot_name) ||
skip_prefix(k, "color.status.", &slot_name)) {
- int slot = parse_status_slot(k, slot_name - k);
+ int slot = parse_status_slot(slot_name);
if (slot < 0)
return 0;
if (!v)
return config_error_nonbool(k);
- color_parse(v, k, s->color_palette[slot]);
- return 0;
+ return color_parse(v, s->color_palette[slot]);
}
if (!strcmp(k, "status.relativepaths")) {
s->relative_paths = git_config_bool(k, v);