Code

pretty: initialize new cmt_fmt_map to 0
authorJonathan Nieder <jrnieder@gmail.com>
Sat, 8 May 2010 21:07:39 +0000 (16:07 -0500)
committerJunio C Hamano <gitster@pobox.com>
Sat, 8 May 2010 23:09:31 +0000 (16:09 -0700)
Without this change, is_alias is likely to happen to be nonzero,
resulting in "fatal: invalid --pretty format" when the fake alias
cannot be resolved.

Use memset instead of initializing the members one by one to make it
easier to expand the struct in the future if needed.

t4205 (log --pretty) does not pass for me without this fix.

Cc: Will Palmer <wmpalmer@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pretty.c

index aaf80207c94e18524559b65e7bb9aff97513faa8..4784f676faeea6365be76fb8b8f122c8bb69fd04 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -59,6 +59,7 @@ static int git_pretty_formats_config(const char *var, const char *value, void *c
                ALLOC_GROW(commit_formats, commit_formats_len+1,
                           commit_formats_alloc);
                commit_format = &commit_formats[commit_formats_len];
+               memset(commit_format, 0, sizeof(*commit_format));
                commit_formats_len++;
        }