X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-log.c;h=911fd659906ebe87bf0adcd17519dd97777fb948;hb=d36f8679e94c2a0d4d15d6adcea434634af6d627;hp=9817d6fbeb69393ed321e71b6211a8630b982fab;hpb=8bb65883d164843d5bb7475281af09bae18ab22d;p=git.git diff --git a/builtin-log.c b/builtin-log.c index 9817d6fbe..911fd6599 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -234,12 +234,8 @@ static int git_log_config(const char *var, const char *value, void *cb) { if (!strcmp(var, "format.pretty")) return git_config_string(&fmt_pretty, var, value); - if (!strcmp(var, "format.subjectprefix")) { - if (!value) - config_error_nonbool(var); - fmt_patch_subject_prefix = xstrdup(value); - return 0; - } + if (!strcmp(var, "format.subjectprefix")) + return git_config_string(&fmt_patch_subject_prefix, var, value); if (!strcmp(var, "log.date")) return git_config_string(&default_date_mode, var, value); if (!strcmp(var, "log.showroot")) { @@ -317,7 +313,7 @@ static int show_object(const unsigned char *sha1, int show_tag_object, static int show_tree_object(const unsigned char *sha1, const char *base, int baselen, - const char *pathname, unsigned mode, int stage) + const char *pathname, unsigned mode, int stage, void *context) { printf("%s%s\n", pathname, S_ISDIR(mode) ? "/" : ""); return 0; @@ -360,7 +356,7 @@ int cmd_show(int argc, const char **argv, const char *prefix) t->tag, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); ret = show_object(o->sha1, 1, &rev); - objects[i].item = (struct object *)t->tagged; + objects[i].item = parse_object(t->tagged->sha1); i--; break; } @@ -370,7 +366,7 @@ int cmd_show(int argc, const char **argv, const char *prefix) name, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); read_tree_recursive((struct tree *)o, "", 0, 0, NULL, - show_tree_object); + show_tree_object, NULL); break; case OBJ_COMMIT: rev.pending.nr = rev.pending.alloc = 0; @@ -465,7 +461,7 @@ static int extra_cc_alloc; static void add_header(const char *value) { int len = strlen(value); - while (value[len - 1] == '\n') + while (len && value[len - 1] == '\n') len--; if (!strncasecmp(value, "to: ", 4)) { ALLOC_GROW(extra_to, extra_to_nr + 1, extra_to_alloc); @@ -489,12 +485,8 @@ static int git_format_config(const char *var, const char *value, void *cb) add_header(value); return 0; } - if (!strcmp(var, "format.suffix")) { - if (!value) - return config_error_nonbool(var); - fmt_patch_suffix = xstrdup(value); - return 0; - } + if (!strcmp(var, "format.suffix")) + return git_config_string(&fmt_patch_suffix, var, value); if (!strcmp(var, "format.cc")) { if (!value) return config_error_nonbool(var); @@ -1090,7 +1082,7 @@ static int add_pending_commit(const char *arg, struct rev_info *revs, int flags) } static const char cherry_usage[] = -"git-cherry [-v] [] []"; +"git cherry [-v] [] []"; int cmd_cherry(int argc, const char **argv, const char *prefix) { struct rev_info revs;