Thomas Rast <[email protected]> writes:
> +define_commit_slab(saved_parents, struct commit_list *);
> +struct saved_parents saved_parents_slab;
> +static int saved_parents_initialized;
> +
> +void save_parents(struct commit *commit)
> +{
> + struct commit_list **pp;
> +
> + if (!saved_parents_initialized) {
> + init_saved_parents(&saved_parents_slab);
> + saved_parents_initialized = 1;
> + }
> +
> + pp = saved_parents_at(&saved_parents_slab, commit);
> + assert(*pp == NULL);
> + *pp = copy_commit_list(commit->parents);
> +}
> +
> +struct commit_list *get_saved_parents(struct commit *commit)
Use "const struct commit *" here, as combine-diff.c has a const pointer.
> +{
> + if (!saved_parents_initialized)
> + return commit->parents;
> +
> + return *saved_parents_at(&saved_parents_slab, commit);
> +}
clear_commit_slab() is not used, failing -Wunused -Werror compilation.
> diff --git a/revision.h b/revision.h
> index 95859ba..0717518 100644
> --- a/revision.h
> +++ b/revision.h
> @@ -273,4 +273,19 @@ enum rewrite_result {
>
> extern int rewrite_parents(struct rev_info *revs, struct commit *commit,
> rewrite_parent_fn_t rewrite_parent);
> +
> +/*
> + * Save a copy of the parent list, and return the saved copy. This is
> + * used by the log machinery to retrieve the original parents when
> + * commit->parents has been modified by history simpification.
> + *
> + * You may only call save_parents() once per commit (this is checked
> + * for non-root commits).
> + *
> + * get_original_parents() will transparently return commit->parents if
> + * history simplification is off.
> + */
> +extern void save_parents(struct commit *commit);
> +extern struct commit_list *get_original_parents(struct commit *commit);
> +
s/_original/_saved/ here, and "const struct commit *".
By the way, when the only single parameter is a named type, you can
safely omit the name of the parameter from the declaration without
losing clarity.
> #endif
> diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh
> index 57ce239..fde5e71 100755
> --- a/t/t6012-rev-list-simplify.sh
> +++ b/t/t6012-rev-list-simplify.sh
> @@ -127,4 +127,10 @@ test_expect_success 'full history simplification without
> parent' '
> }
> '
>
> +test_expect_success '--full-diff is not affected by --parents' '
> + git log -p --pretty="%H" --full-diff -- file >expected &&
> + git log -p --pretty="%H" --full-diff --parents -- file >actual &&
> + test_cmp expected actual
> +'
> +
> test_done
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html