Re: [PATCH v7 25/31] merge-recursive: apply necessary modifications for directory renames
From: SZEDER Gábor <hidden>
Date: 2018-02-16 01:14:33
On Wed, Jan 31, 2018 at 12:25 AM, Elijah Newren [off-list ref] wrote:
quoted hunk ↗ jump to hunk
This commit hooks together all the directory rename logic by making the necessary changes to the rename struct, it's dst_entry, and the diff_filepair under consideration. Signed-off-by: Elijah Newren <redacted> --- merge-recursive.c | 187 +++++++++++++++++++++++++++++++++++- t/t6043-merge-rename-directories.sh | 50 +++++----- 2 files changed, 211 insertions(+), 26 deletions(-)diff --git a/merge-recursive.c b/merge-recursive.c index 38dc0eefaf..7c78dc2dc1 100644 --- a/merge-recursive.c +++ b/merge-recursive.c
quoted hunk ↗ jump to hunk
@@ -641,6 +643,27 @@ static int update_stages(struct merge_options *opt, const char *path, return 0; } +static int update_stages_for_stage_data(struct merge_options *opt, + const char *path, + const struct stage_data *stage_data) +{ + struct diff_filespec o, a, b; + + o.mode = stage_data->stages[1].mode; + oidcpy(&o.oid, &stage_data->stages[1].oid); + + a.mode = stage_data->stages[2].mode; + oidcpy(&a.oid, &stage_data->stages[2].oid); + + b.mode = stage_data->stages[3].mode; + oidcpy(&b.oid, &stage_data->stages[3].oid); + + return update_stages(opt, path, + is_null_sha1(o.oid.hash) ? NULL : &o, + is_null_sha1(a.oid.hash) ? NULL : &a, + is_null_sha1(b.oid.hash) ? NULL : &b);
Please use is_null_oid(&o.oid) etc. instead of is_null_sha1().