diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-10-11 23:37:47 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-10-11 23:37:47 +0300 |
commit | b182658e3ed412e21a472db42ebc37130cee68e0 (patch) | |
tree | 1a74f07508285a4b649042d8ac622bee0938e919 /merge-recursive.h | |
parent | 6a4c9e7b32c4154345785bd7b8d4afee5fddcead (diff) |
merge: introduce {copy|clear}_merge_options()
When mostly the same set of options are to be used to perform
multiple merges, one instance of the merge_options structure may
want to be created and used by copying from the same template
instance. We saw such a use recently in "git merge-tree".
Let's make the pattern official by introducing copy_merge_options()
as a supported way to make a copy of the structure, and also give
clear_merge_options() to release any resources held by a copied
instance. Currently we only make a shallow copy, so the former is a
mere structure assignment while the latter is a no-op, but this may
change in the future as the members of merge_options structure
evolve.
Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.h')
-rw-r--r-- | merge-recursive.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/merge-recursive.h b/merge-recursive.h index b88000e3c2..3d3b3e3c29 100644 --- a/merge-recursive.h +++ b/merge-recursive.h @@ -55,6 +55,9 @@ struct merge_options { void init_merge_options(struct merge_options *opt, struct repository *repo); +void copy_merge_options(struct merge_options *dst, struct merge_options *src); +void clear_merge_options(struct merge_options *opt); + /* parse the option in s and update the relevant field of opt */ int parse_merge_opt(struct merge_options *opt, const char *s); |