Re: [PATCH v2 1/1] unpack-trees: exit check_updates() early if updates are not wanted
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 12 quoted lines
> From: Elijah Newren <newren@gmail.com>
>
> check_updates() has a lot of code that repeatedly checks whether
> o->update or o->dry_run are set. (Note that o->dry_run is a
> near-synonym for !o->update, but not quite as per commit 2c9078d05bf2
> ("unpack-trees: add the dry_run flag to unpack_trees_options",
> 2011-05-25).) In fact, this function almost turns into a no-op whenever
> the condition
> !o->update || o->dry_run
> is met. Simplify the code by checking this condition at the beginning
> of the function, and when it is true, do the few things that are
> relevant and return early.