commit - 1af628f4bfa50c224b392a774e72a213c97f6009
commit + 54d5be07768d1e312078b5eb60f0e32738a1631a
blob - 555aa43713a57ed7659077b033dc3e9e0df572bf
blob + 13cc9fbaca9c08dbb86084c978e908bee7eebe17
--- lib/worktree.c
+++ lib/worktree.c
merge_file(int *local_changes_subsumed, struct got_worktree *worktree,
FILE *f_orig, FILE *f_deriv, FILE *f_deriv2, const char *ondisk_path,
const char *path, uint16_t st_mode,
- const char *label_orig, const char *label_deriv,
+ const char *label_orig, const char *label_deriv, const char *label_deriv2,
struct got_repository *repo,
got_worktree_checkout_cb progress_cb, void *progress_arg)
{
goto done;
err = got_merge_diff3(&overlapcnt, merged_fd, f_deriv, f_orig,
- f_deriv2, label_deriv, label_orig, NULL);
+ f_deriv2, label_deriv, label_orig, label_deriv2);
if (err)
goto done;
err = merge_file(local_changes_subsumed, worktree, f_orig, f_deriv,
f_deriv2, ondisk_path, path, st_mode, label_orig, label_deriv,
- repo, progress_cb, progress_arg);
+ NULL, repo, progress_cb, progress_arg);
done:
if (f_orig && fclose(f_orig) == EOF && err == NULL)
err = got_error_from_errno("fclose");
unsigned char status;
int local_changes_subsumed;
FILE *f_orig = NULL, *f_deriv = NULL, *f_deriv2 = NULL;
- char *id_str = NULL, *label_deriv = NULL;
+ char *id_str = NULL, *label_deriv2 = NULL;
if (blob1 && blob2) {
ie = got_fileindex_entry_get(a->fileindex, path2,
if (err)
goto done;
- f_deriv = got_opentemp();
- if (f_deriv == NULL)
+ f_deriv2 = got_opentemp();
+ if (f_deriv2 == NULL)
goto done;
err = got_object_blob_dump_to_file(NULL, NULL, NULL,
- f_deriv, blob2);
+ f_deriv2, blob2);
if (err)
goto done;
ondisk_path);
goto done;
}
- f_deriv2 = fdopen(fd, "r");
- if (f_deriv2 == NULL) {
+ f_deriv = fdopen(fd, "r");
+ if (f_deriv == NULL) {
err = got_error_from_errno2("fdopen",
ondisk_path);
close(fd);
err = got_object_id_str(&id_str, a->commit_id2);
if (err)
goto done;
- if (asprintf(&label_deriv, "%s: commit %s",
+ if (asprintf(&label_deriv2, "%s: commit %s",
GOT_MERGE_LABEL_MERGED, id_str) == -1) {
err = got_error_from_errno("asprintf");
goto done;
}
err = merge_file(&local_changes_subsumed, a->worktree,
f_orig, f_deriv, f_deriv2, ondisk_path, path2,
- sb.st_mode, a->label_orig, label_deriv, repo,
- a->progress_cb, a->progress_arg);
+ sb.st_mode, a->label_orig, NULL, label_deriv2,
+ repo, a->progress_cb, a->progress_arg);
}
} else if (blob1) {
ie = got_fileindex_entry_get(a->fileindex, path1,
if (f_deriv2 && fclose(f_deriv2) == EOF && err == NULL)
err = got_error_from_errno("fclose");
free(id_str);
- free(label_deriv);
+ free(label_deriv2);
free(ondisk_path);
return err;
}
err = merge_file(&local_changes_subsumed, worktree,
f_base, f, f_deriv2, ondisk_path, ie->path,
got_fileindex_perms_to_st(ie),
- label_orig, "unstaged",
+ label_orig, "unstaged", NULL,
repo, progress_cb, progress_arg);
}
if (err)
blob - 516a404d1faaff893383511507cf22857a894374
blob + 5bfd952f5935c646f1b615cefc0ffb3b07d24e4a
--- regress/cmdline/cherrypick.sh
+++ regress/cmdline/cherrypick.sh
cmp -s $testroot/stdout.expected $testroot/stdout
ret="$?"
if [ "$ret" != "0" ]; then
- #diff -u $testroot/stdout.expected $testroot/stdout
- ret="xfail $(head -n 1 $testroot/stderr)"
+ diff -u $testroot/stdout.expected $testroot/stdout
fi
test_done "$testroot" "$ret"
}
cmp -s $testroot/diff.expected $testroot/diff
ret="$?"
if [ "$ret" != "0" ]; then
- #diff -u $testroot/diff.expected $testroot/diff
- ret="xfail cherrypick results in unexpected diff"
+ diff -u $testroot/diff.expected $testroot/diff
fi
test_done "$testroot" "$ret"
blob - 432e94f7e99b6fbf303f9d9ec0b7e9656d912a6a
blob + a1f81c4a5bbd0d9e60e07289ec4e53d119b78dd6
--- regress/cmdline/rebase.sh
+++ regress/cmdline/rebase.sh
return 1
fi
- echo "<<<<<<< merged change: commit $orig_commit1" \
- > $testroot/content.expected
- echo "modified alpha on branch" >> $testroot/content.expected
+ echo '<<<<<<<' > $testroot/content.expected
+ echo "modified alpha on master" >> $testroot/content.expected
echo "||||||| 3-way merge base: commit $init_commit" \
>> $testroot/content.expected
echo "alpha" >> $testroot/content.expected
echo "=======" >> $testroot/content.expected
- echo "modified alpha on master" >> $testroot/content.expected
- echo '>>>>>>>' >> $testroot/content.expected
+ echo "modified alpha on branch" >> $testroot/content.expected
+ echo ">>>>>>> merged change: commit $orig_commit1" \
+ >> $testroot/content.expected
cat $testroot/wt/alpha > $testroot/content
cmp -s $testroot/content.expected $testroot/content
ret="$?"
return 1
fi
- echo "<<<<<<< merged change: commit $orig_commit1" \
- > $testroot/content.expected
- echo "modified alpha on branch" >> $testroot/content.expected
+ echo '<<<<<<<' > $testroot/content.expected
+ echo "modified alpha on master" >> $testroot/content.expected
echo "||||||| 3-way merge base: commit $init_commit" \
>> $testroot/content.expected
echo "alpha" >> $testroot/content.expected
echo "=======" >> $testroot/content.expected
- echo "modified alpha on master" >> $testroot/content.expected
- echo '>>>>>>>' >> $testroot/content.expected
+ echo "modified alpha on branch" >> $testroot/content.expected
+ echo ">>>>>>> merged change: commit $orig_commit1" \
+ >> $testroot/content.expected
cat $testroot/wt/alpha > $testroot/content
cmp -s $testroot/content.expected $testroot/content
ret="$?"
return 1
fi
- echo "<<<<<<< merged change: commit $orig_commit1" \
- > $testroot/content.expected
- echo "modified alpha on branch" >> $testroot/content.expected
+ echo '<<<<<<<' > $testroot/content.expected
+ echo "modified alpha on master" >> $testroot/content.expected
echo "||||||| 3-way merge base: commit $init_commit" \
>> $testroot/content.expected
echo "alpha" >> $testroot/content.expected
echo "=======" >> $testroot/content.expected
- echo "modified alpha on master" >> $testroot/content.expected
- echo '>>>>>>>' >> $testroot/content.expected
+ echo "modified alpha on branch" >> $testroot/content.expected
+ echo ">>>>>>> merged change: commit $orig_commit1" \
+ >> $testroot/content.expected
cat $testroot/wt/alpha > $testroot/content
cmp -s $testroot/content.expected $testroot/content
ret="$?"
return 1
fi
- echo "<<<<<<< merged change: commit $orig_commit1" \
- > $testroot/content.expected
- echo "modified alpha on branch" >> $testroot/content.expected
+ echo '<<<<<<<' > $testroot/content.expected
+ echo "modified alpha on master" >> $testroot/content.expected
echo "||||||| 3-way merge base: commit $init_commit" \
>> $testroot/content.expected
echo "alpha" >> $testroot/content.expected
echo "=======" >> $testroot/content.expected
- echo "modified alpha on master" >> $testroot/content.expected
- echo '>>>>>>>' >> $testroot/content.expected
+ echo "modified alpha on branch" >> $testroot/content.expected
+ echo ">>>>>>> merged change: commit $orig_commit1" \
+ >> $testroot/content.expected
cat $testroot/wt/alpha > $testroot/content
cmp -s $testroot/content.expected $testroot/content
ret="$?"