Skip to content

Commit ae18165

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 583b61c commit ae18165

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

revision.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1825,7 +1825,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
18251825
} else if (!strcmp(arg, "--pretty")) {
18261826
revs->verbose_header = 1;
18271827
revs->pretty_given = 1;
1828-
get_commit_format(arg+8, revs);
1828+
get_commit_format(NULL, revs);
18291829
} else if (starts_with(arg, "--pretty=") || starts_with(arg, "--format=")) {
18301830
/*
18311831
* Detached form ("--pretty X" as opposed to "--pretty=X")

0 commit comments

Comments
 (0)