Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
merge-recursive: cleanup handle_rename_* function signatures
author
Elijah Newren
<newren@gmail.com>
Fri, 5 Apr 2019 15:00:21 +0000
(08:00 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 8 Apr 2019 07:02:07 +0000
(16:02 +0900)
Instead of passing various bits and pieces of 'ci', just pass it
directly.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
c336ab8
)
diff --git
a/merge-recursive.c
b/merge-recursive.c
index f85c276f35b3629d3626ea176ac9a604408d4f2d..ada1c19ed2d1625479e95ac0bf651e8da4bd82d9 100644
(file)
--- a/
merge-recursive.c
+++ b/
merge-recursive.c
@@
-1357,8
+1357,7
@@
static int merge_mode_and_contents(struct merge_options *opt,
}
static int handle_rename_via_dir(struct merge_options *opt,
}
static int handle_rename_via_dir(struct merge_options *opt,
- struct diff_filepair *pair,
- const char *rename_branch)
+ struct rename_conflict_info *ci)
{
/*
* Handle file adds that need to be renamed due to directory rename
{
/*
* Handle file adds that need to be renamed due to directory rename
@@
-1366,10
+1365,11
@@
static int handle_rename_via_dir(struct merge_options *opt,
* there is no content merge to do; just move the file into the
* desired final location.
*/
* there is no content merge to do; just move the file into the
* desired final location.
*/
- const struct diff_filespec *dest = pair->two;
+ const struct rename *ren = ci->ren1;
+ const struct diff_filespec *dest = ren->pair->two;
if (!opt->call_depth && would_lose_untracked(opt, dest->path)) {
if (!opt->call_depth && would_lose_untracked(opt, dest->path)) {
- char *alt_path = unique_path(opt, dest->path, ren
ame_
branch);
+ char *alt_path = unique_path(opt, dest->path, ren
->
branch);
output(opt, 1, _("Error: Refusing to lose untracked file at %s; "
"writing to %s instead."),
output(opt, 1, _("Error: Refusing to lose untracked file at %s; "
"writing to %s instead."),
@@
-1383,8
+1383,8
@@
static int handle_rename_via_dir(struct merge_options *opt,
return -1;
free(alt_path);
return update_stages(opt, dest->path, NULL,
return -1;
free(alt_path);
return update_stages(opt, dest->path, NULL,
- ren
ame_
branch == opt->branch1 ? dest : NULL,
- ren
ame_
branch == opt->branch1 ? NULL : dest);
+ ren
->
branch == opt->branch1 ? dest : NULL,
+ ren
->
branch == opt->branch1 ? NULL : dest);
}
/* Update dest->path both in index and in worktree */
}
/* Update dest->path both in index and in worktree */
@@
-1476,12
+1476,14
@@
static int handle_change_delete(struct merge_options *opt,
}
static int handle_rename_delete(struct merge_options *opt,
}
static int handle_rename_delete(struct merge_options *opt,
- struct diff_filepair *pair,
- const char *rename_branch,
- const char *delete_branch)
+ struct rename_conflict_info *ci)
{
{
- const struct diff_filespec *orig = pair->one;
- const struct diff_filespec *dest = pair->two;
+ const struct rename *ren = ci->ren1;
+ const struct diff_filespec *orig = ren->pair->one;
+ const struct diff_filespec *dest = ren->pair->two;
+ const char *rename_branch = ren->branch;
+ const char *delete_branch = (opt->branch1 == ren->branch ?
+ opt->branch2 : opt->branch1);
if (handle_change_delete(opt,
opt->call_depth ? orig->path : dest->path,
if (handle_change_delete(opt,
opt->call_depth ? orig->path : dest->path,
@@
-3184,8
+3186,7
@@
static int process_entry(struct merge_options *opt,
break;
case RENAME_VIA_DIR:
clean_merge = 1;
break;
case RENAME_VIA_DIR:
clean_merge = 1;
- if (handle_rename_via_dir(opt, ci->ren1->pair,
- ci->ren1->branch))
+ if (handle_rename_via_dir(opt, ci))
clean_merge = -1;
break;
case RENAME_ADD:
clean_merge = -1;
break;
case RENAME_ADD:
@@
-3199,9
+3200,7
@@
static int process_entry(struct merge_options *opt,
break;
case RENAME_DELETE:
clean_merge = 0;
break;
case RENAME_DELETE:
clean_merge = 0;
- if (handle_rename_delete(opt, ci->ren1->pair,
- ci->ren1->branch,
- ci->ren1->branch == opt->branch1 ? opt->branch2 : opt->branch1))
+ if (handle_rename_delete(opt, ci))
clean_merge = -1;
break;
case RENAME_ONE_FILE_TO_TWO:
clean_merge = -1;
break;
case RENAME_ONE_FILE_TO_TWO: