diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2013-06-02 17:46:54 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-02 15:31:13 -0700 |
commit | f2fa35420511cc49e85413a2932a1a2bac88cc1b (patch) | |
tree | b168a221fccdbb082dd9eb02958b085a99293129 /diff-lib.c | |
parent | a33bd4d34def15d12372aeb8c59a7465416f9f66 (diff) | |
download | git-f2fa35420511cc49e85413a2932a1a2bac88cc1b.tar.gz |
unpack-trees: create working copy of merge entry in merged_entry
Duplicate the merge entry right away and work with that instead of
modifying the entry we got and duplicating it only at the end of
the function. Then mark that pointer const to document that we
don't modify the referenced cache_entry.
This change is safe because all existing merge functions call
merged_entry just before returning (or not at all), i.e. they don't
care about changes to the referenced cache_entry after the call.
unpack_nondirectories and unpack_index_entry, which call the merge
functions through call_unpack_fn, aren't interested in such changes
neither.
The change complicates merged_entry a bit because we have to free the
copy if we error out, but allows callers to pass a const pointer.
Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-lib.c')
0 files changed, 0 insertions, 0 deletions