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 /git-compat-util.h | |
parent | unpack-trees: factor out dup_entry (diff) | |
download | tgif-f2fa35420511cc49e85413a2932a1a2bac88cc1b.tar.xz |
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 'git-compat-util.h')
0 files changed, 0 insertions, 0 deletions