Hi Johannes,
On Fri, Apr 27, 2018 at 3:30 PM, Johannes Schindelin
<[email protected]> wrote:
> This patch extracts the code from is_index_unchanged() to initialize or
> update the index' cache tree (i.e. a tree object reflecting the current
> index' top-level tree).
>
> The new helper will be used in the upcoming code to support `git rebase
> -i --root` via the sequencer.
>
> Signed-off-by: Johannes Schindelin <[email protected]>
> ---
> sequencer.c | 27 ++++++++++++++++++---------
> 1 file changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/sequencer.c b/sequencer.c
> index e2f83942843..90c8218aa9a 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -562,9 +562,23 @@ static int do_recursive_merge(struct commit *base,
> struct commit *next,
> return !clean;
> }
>
> +static struct object_id *get_cache_tree_oid(void)
> +{
> + if (!active_cache_tree)
> + active_cache_tree = cache_tree();
> +
> + if (!cache_tree_fully_valid(active_cache_tree))
> + if (cache_tree_update(&the_index, 0)) {
> + error(_("unable to update cache tree"));
> + return NULL;
> + }
This move is a verbatim move of the code below, except that
we need to add braces. For some reason I fantasize of using
the comma operator in C eventually (which we do not use in
our code base AFAICT), then we could leave out the braces
and have a
return error(...), NULL;
Anyway, this patch is
Reviewed-by: Stefan Beller <[email protected]>