Commit 3ee39a8
committed
revision: make get_commit_action() a pure predicate
get_commit_action() reads as a predicate that decides whether a commit
is shown or ignored, but for a line-level log without parent rewriting it
also called line_log_process_commit(), which mutates the tracked line
ranges. That hidden side effect made it unsafe to call as a plain query.
get_commit_action() has only two callers: simplify_commit(), the normal
walk driver, and graph_is_interesting() in graph.c. The latter runs only
under --graph, which forces rewrite_parents (and therefore
want_ancestry()), so the "-L without ancestry" branch that holds the side
effect was already unreachable from it.
Move the line-level processing to simplify_commit(), which runs it before
calling get_commit_action(). Extract the leading "ignore regardless of
content" checks into commit_early_ignore() so the same gate applies in
both places, and so the tracked ranges are still adjusted for a commit
that later, cheaper conditions will ignore. commit_early_ignore() only
reads object flags and pack membership, so running it again from
get_commit_action() is a harmless repeat.
get_commit_action() is now side-effect free and safe to use as a
predicate, independent of whether the line-level ranges were processed.
Update the line-log.c file header, which pointed the lazy walk at
get_commit_action(), to name simplify_commit().
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Montalbo <mmontalbo@gmail.com>1 parent 14d8c63 commit 3ee39a8
2 files changed
Lines changed: 47 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4159 | 4159 | | |
4160 | 4160 | | |
4161 | 4161 | | |
4162 | | - | |
| 4162 | + | |
| 4163 | + | |
| 4164 | + | |
| 4165 | + | |
| 4166 | + | |
| 4167 | + | |
| 4168 | + | |
4163 | 4169 | | |
4164 | 4170 | | |
4165 | | - | |
| 4171 | + | |
4166 | 4172 | | |
4167 | | - | |
| 4173 | + | |
4168 | 4174 | | |
4169 | | - | |
4170 | | - | |
4171 | | - | |
4172 | | - | |
4173 | | - | |
4174 | | - | |
| 4175 | + | |
| 4176 | + | |
| 4177 | + | |
| 4178 | + | |
| 4179 | + | |
4175 | 4180 | | |
| 4181 | + | |
| 4182 | + | |
| 4183 | + | |
| 4184 | + | |
| 4185 | + | |
| 4186 | + | |
| 4187 | + | |
| 4188 | + | |
| 4189 | + | |
| 4190 | + | |
| 4191 | + | |
| 4192 | + | |
| 4193 | + | |
| 4194 | + | |
4176 | 4195 | | |
4177 | | - | |
4178 | | - | |
4179 | | - | |
4180 | | - | |
4181 | | - | |
4182 | | - | |
4183 | | - | |
4184 | | - | |
4185 | | - | |
4186 | | - | |
4187 | | - | |
4188 | | - | |
4189 | | - | |
4190 | | - | |
4191 | | - | |
4192 | | - | |
4193 | 4196 | | |
4194 | 4197 | | |
4195 | 4198 | | |
| |||
4298 | 4301 | | |
4299 | 4302 | | |
4300 | 4303 | | |
4301 | | - | |
| 4304 | + | |
| 4305 | + | |
| 4306 | + | |
| 4307 | + | |
| 4308 | + | |
| 4309 | + | |
| 4310 | + | |
| 4311 | + | |
| 4312 | + | |
| 4313 | + | |
| 4314 | + | |
| 4315 | + | |
| 4316 | + | |
| 4317 | + | |
| 4318 | + | |
| 4319 | + | |
| 4320 | + | |
| 4321 | + | |
4302 | 4322 | | |
4303 | 4323 | | |
4304 | 4324 | | |
| |||
0 commit comments