From: Jeff King Date: Tue, 29 Jul 2014 17:53:40 +0000 (-0400) Subject: revision: drop useless string offset when parsing "--pretty" X-Git-Tag: v2.1.1~12^2~2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ae18165fbbf5e15ab2371d09f79cd12ee403c51e?hp=583b61c1af1bac12d6b48b2583ad508b5ab9964c revision: drop useless string offset when parsing "--pretty" Once upon a time, we parsed pretty options by looking for "--pretty" at the start of the string, and then feeding the rest (including an "=") to get_commit_format. Later, commit 48ded91 (log --pretty: do not accept bogus "--prettyshort", 2008-05-25) split this into a separate check for "--pretty" versus "--pretty=". However, when parsing "--pretty", we still passed "arg+8" to get_commit_format. This is useless, since it will always point to the NUL terminator at the end of the string. We can simply pass NULL instead; both parameters are treated the same by get_commit_format. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/revision.c b/revision.c index 2571ada6bf..615535c984 100644 --- a/revision.c +++ b/revision.c @@ -1825,7 +1825,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg } else if (!strcmp(arg, "--pretty")) { revs->verbose_header = 1; revs->pretty_given = 1; - get_commit_format(arg+8, revs); + get_commit_format(NULL, revs); } else if (starts_with(arg, "--pretty=") || starts_with(arg, "--format=")) { /* * Detached form ("--pretty X" as opposed to "--pretty=X")