show base commit hash and omit filenames in conflict markers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555
diff --git a/lib/diff3.c b/lib/diff3.c
index d8e2403..4e9889d 100644
--- a/lib/diff3.c
+++ b/lib/diff3.c
@@ -146,7 +146,9 @@ struct diff3_state {
* is stored in last[1-3];
*/
int last[4];
- char f1mark[PATH_MAX], f3mark[PATH_MAX]; /* markers for -E and -X */
+ char f1mark[PATH_MAX];
+ char f2mark[PATH_MAX];
+ char f3mark[PATH_MAX];
char *buf;
@@ -173,7 +175,7 @@ static const struct got_error *repos(int, struct diff3_state *);
static const struct got_error *increase(struct diff3_state *);
static const struct got_error *diff3_internal(char *, char *, char *,
char *, char *, const char *, const char *, struct diff3_state *,
- const char *, const char *);
+ const char *, const char *, const char *);
static const struct got_error *
diff_output(BUF *diffbuf, const char *fmt, ...)
@@ -269,7 +271,7 @@ done:
*/
const struct got_error *
got_merge_diff3(int *overlapcnt, int outfd, const char *p1, const char *p2,
- const char *p3, const char *label1, const char *label3)
+ const char *p3, const char *label1, const char *label2, const char *label3)
{
const struct got_error *err = NULL;
char *dp13, *dp23, *path1, *path2, *path3;
@@ -367,7 +369,7 @@ got_merge_diff3(int *overlapcnt, int outfd, const char *p1, const char *p2,
d3s->diffbuf = diffb;
err = diff3_internal(dp13, dp23, path1, path2, path3,
- label1, label3, d3s, label1, label3);
+ label1, label3, d3s, label1, label2, label3);
if (err) {
buf_free(diffb);
diffb = NULL;
@@ -422,19 +424,27 @@ out:
static const struct got_error *
diff3_internal(char *dp13, char *dp23, char *path1, char *path2, char *path3,
const char *fmark, const char *rmark, struct diff3_state *d3s,
- const char *label1, const char *label3)
+ const char *label1, const char *label2, const char *label3)
{
const struct got_error *err = NULL;
ssize_t m, n;
int i;
i = snprintf(d3s->f1mark, sizeof(d3s->f1mark),
- "%s %s", GOT_DIFF_CONFLICT_MARKER_BEGIN, label1);
+ "%s%s%s", GOT_DIFF_CONFLICT_MARKER_BEGIN,
+ label1 ? " " : "", label1 ? label1 : "");
if (i < 0 || i >= (int)sizeof(d3s->f1mark))
return got_error(GOT_ERR_NO_SPACE);
+ i = snprintf(d3s->f2mark, sizeof(d3s->f2mark),
+ "%s%s%s", GOT_DIFF_CONFLICT_MARKER_ORIG,
+ label2 ? " " : "", label2 ? label2 : "");
+ if (i < 0 || i >= (int)sizeof(d3s->f2mark))
+ return got_error(GOT_ERR_NO_SPACE);
+
i = snprintf(d3s->f3mark, sizeof(d3s->f3mark),
- "%s %s", GOT_DIFF_CONFLICT_MARKER_END, label3);
+ "%s%s%s", GOT_DIFF_CONFLICT_MARKER_END,
+ label3 ? " " : "", label3 ? label3 : "");
if (i < 0 || i >= (int)sizeof(d3s->f3mark))
return got_error(GOT_ERR_NO_SPACE);
@@ -983,8 +993,7 @@ edscript(int n, struct diff3_state *d3s)
} else if (d3s->de[n].oldo.from < d3s->de[n].oldo.to) {
/* Output a block of 3-way diff base file content. */
err = diff_output(d3s->diffbuf, "%da\n%s\n",
- d3s->de[n].old.to -1,
- GOT_DIFF_CONFLICT_MARKER_ORIG);
+ d3s->de[n].old.to - 1, d3s->f2mark);
if (err)
return err;
if (fseeko(d3s->fp[1], d3s->de[n].oldo.from, SEEK_SET)
diff --git a/lib/got_lib_diff.h b/lib/got_lib_diff.h
index 0d74b1b..ace2137 100644
--- a/lib/got_lib_diff.h
+++ b/lib/got_lib_diff.h
@@ -150,7 +150,7 @@ const struct got_error *got_diff_blob_file_lines_changed(struct got_diff_changes
void got_diff_free_changes(struct got_diff_changes *);
const struct got_error *got_merge_diff3(int *, int, const char *, const char *,
- const char *, const char *, const char *);
+ const char *, const char *, const char *, const char *);
const struct got_error *got_diff_files(struct got_diff_changes **,
struct got_diff_state **, struct got_diff_args **, int *, FILE *, size_t,
diff --git a/lib/worktree.c b/lib/worktree.c
index e289542..c4df32a 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -60,6 +60,9 @@
#define MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))
#endif
+#define GOT_MERGE_LABEL_MERGED "merged change"
+#define GOT_MERGE_LABEL_BASE "3-way merge base"
+
static const struct got_error *
create_meta_file(const char *path_got, const char *name, const char *content)
{
@@ -728,7 +731,8 @@ static const struct got_error *
merge_file(int *local_changes_subsumed, struct got_worktree *worktree,
struct got_blob_object *blob_orig, const char *ondisk_path,
const char *path, uint16_t st_mode, const char *deriv_path,
- const char *label_deriv, struct got_repository *repo,
+ const char *label_orig, const char *label_deriv,
+ struct got_repository *repo,
got_worktree_checkout_cb progress_cb, void *progress_arg)
{
const struct got_error *err = NULL;
@@ -776,7 +780,7 @@ merge_file(int *local_changes_subsumed, struct got_worktree *worktree,
}
err = got_merge_diff3(&overlapcnt, merged_fd, deriv_path,
- blob_orig_path, ondisk_path, label_deriv, path);
+ blob_orig_path, ondisk_path, label_deriv, label_orig, NULL);
if (err)
goto done;
@@ -832,10 +836,10 @@ done:
static const struct got_error *
merge_blob(int *local_changes_subsumed, struct got_worktree *worktree,
struct got_blob_object *blob_orig, const char *ondisk_path,
- const char *path, uint16_t st_mode, struct got_blob_object *blob_deriv,
- struct got_object_id *deriv_base_commit_id,
- struct got_repository *repo, got_worktree_checkout_cb progress_cb,
- void *progress_arg)
+ const char *path, uint16_t st_mode, const char *label_orig,
+ struct got_blob_object *blob_deriv,
+ struct got_object_id *deriv_base_commit_id, struct got_repository *repo,
+ got_worktree_checkout_cb progress_cb, void *progress_arg)
{
const struct got_error *err = NULL;
FILE *f_deriv = NULL;
@@ -866,14 +870,15 @@ merge_blob(int *local_changes_subsumed, struct got_worktree *worktree,
err = got_object_id_str(&id_str, deriv_base_commit_id);
if (err)
goto done;
- if (asprintf(&label_deriv, "commit %s", id_str) == -1) {
+ if (asprintf(&label_deriv, "%s: commit %s",
+ GOT_MERGE_LABEL_MERGED, id_str) == -1) {
err = got_error_from_errno("asprintf");
goto done;
}
err = merge_file(local_changes_subsumed, worktree, blob_orig,
- ondisk_path, path, st_mode, blob_deriv_path, label_deriv,
- repo, progress_cb, progress_arg);
+ ondisk_path, path, st_mode, blob_deriv_path, label_orig,
+ label_deriv, repo, progress_cb, progress_arg);
done:
if (f_deriv && fclose(f_deriv) != 0 && err == NULL)
err = got_error_from_errno("fclose");
@@ -1280,6 +1285,7 @@ update_blob(struct got_worktree *worktree,
if (status == GOT_STATUS_MODIFY || status == GOT_STATUS_ADD) {
int update_timestamps;
struct got_blob_object *blob2 = NULL;
+ char *label_orig = NULL;
if (got_fileindex_entry_has_blob(ie)) {
struct got_object_id id2;
memcpy(id2.sha1, ie->blob_sha1, SHA1_DIGEST_LENGTH);
@@ -1287,10 +1293,24 @@ update_blob(struct got_worktree *worktree,
if (err)
goto done;
}
+ if (got_fileindex_entry_has_commit(ie)) {
+ char id_str[SHA1_DIGEST_STRING_LENGTH];
+ if (got_sha1_digest_to_str(ie->commit_sha1, id_str,
+ sizeof(id_str)) == NULL) {
+ err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
+ goto done;
+ }
+ if (asprintf(&label_orig, "%s: commit %s",
+ GOT_MERGE_LABEL_BASE, id_str) == -1) {
+ err = got_error_from_errno("asprintf");
+ goto done;
+ }
+ }
err = merge_blob(&update_timestamps, worktree, blob2,
- ondisk_path, path, sb.st_mode, blob,
+ ondisk_path, path, sb.st_mode, label_orig, blob,
worktree->base_commit_id, repo,
progress_cb, progress_arg);
+ free(label_orig);
if (blob2)
got_object_blob_close(blob2);
if (err)
@@ -1979,6 +1999,7 @@ struct merge_file_cb_arg {
void *progress_arg;
got_cancel_cb cancel_cb;
void *cancel_arg;
+ const char *label_orig;
struct got_object_id *commit_id2;
};
@@ -2025,8 +2046,8 @@ merge_file_cb(void *arg, struct got_blob_object *blob1,
}
err = merge_blob(&local_changes_subsumed, a->worktree, blob1,
- ondisk_path, path2, sb.st_mode, blob2, a->commit_id2, repo,
- a->progress_cb, a->progress_arg);
+ ondisk_path, path2, sb.st_mode, a->label_orig, blob2,
+ a->commit_id2, repo, a->progress_cb, a->progress_arg);
} else if (blob1) {
ie = got_fileindex_entry_get(a->fileindex, path1,
strlen(path1));
@@ -2099,9 +2120,10 @@ merge_file_cb(void *arg, struct got_blob_object *blob1,
goto done;
}
err = merge_blob(&local_changes_subsumed, a->worktree,
- NULL, ondisk_path, path2, sb.st_mode, blob2,
- a->commit_id2, repo,
- a->progress_cb, a->progress_arg);
+ NULL, ondisk_path, path2, sb.st_mode,
+ a->label_orig, blob2, a->commit_id2, repo,
+ a->progress_cb,
+ a->progress_arg);
if (status == GOT_STATUS_DELETE) {
err = update_blob_fileindex_entry(a->worktree,
a->fileindex, ie, ondisk_path, ie->path,
@@ -2178,8 +2200,11 @@ merge_files(struct got_worktree *worktree, struct got_fileindex *fileindex,
struct got_object_id *tree_id1 = NULL, *tree_id2 = NULL;
struct got_tree_object *tree1 = NULL, *tree2 = NULL;
struct merge_file_cb_arg arg;
+ char *label_orig = NULL;
if (commit_id1) {
+ char *id_str;
+
err = got_object_id_by_path(&tree_id1, repo, commit_id1,
worktree->path_prefix);
if (err)
@@ -2188,6 +2213,18 @@ merge_files(struct got_worktree *worktree, struct got_fileindex *fileindex,
err = got_object_open_as_tree(&tree1, repo, tree_id1);
if (err)
goto done;
+
+ err = got_object_id_str(&id_str, commit_id1);
+ if (err)
+ goto done;
+
+ if (asprintf(&label_orig, "%s: commit %s",
+ GOT_MERGE_LABEL_BASE, id_str) == -1) {
+ err = got_error_from_errno("asprintf");
+ free(id_str);
+ goto done;
+ }
+ free(id_str);
}
err = got_object_id_by_path(&tree_id2, repo, commit_id2,
@@ -2205,6 +2242,7 @@ merge_files(struct got_worktree *worktree, struct got_fileindex *fileindex,
arg.progress_arg = progress_arg;
arg.cancel_cb = cancel_cb;
arg.cancel_arg = cancel_arg;
+ arg.label_orig = label_orig;
arg.commit_id2 = commit_id2;
err = got_diff_tree(tree1, tree2, "", "", repo, merge_file_cb, &arg, 1);
sync_err = sync_fileindex(fileindex, fileindex_path);
@@ -2215,6 +2253,7 @@ done:
got_object_tree_close(tree1);
if (tree2)
got_object_tree_close(tree2);
+ free(label_orig);
return err;
}
@@ -6227,6 +6266,7 @@ unstage_path(void *arg, unsigned char status,
struct got_blob_object *blob_base = NULL, *blob_staged = NULL;
char *ondisk_path = NULL, *path_unstaged_content = NULL;
char *path_new_staged_content = NULL;
+ char *id_str = NULL, *label_orig = NULL;
int local_changes_subsumed;
struct stat sb;
@@ -6243,6 +6283,16 @@ unstage_path(void *arg, unsigned char status,
== -1)
return got_error_from_errno("asprintf");
+ err = got_object_id_str(&id_str,
+ commit_id ? commit_id : a->worktree->base_commit_id);
+ if (err)
+ goto done;
+ if (asprintf(&label_orig, "%s: commit %s", GOT_MERGE_LABEL_BASE,
+ id_str) == -1) {
+ err = got_error_from_errno("asprintf");
+ goto done;
+ }
+
switch (staged_status) {
case GOT_STATUS_MODIFY:
err = got_object_open_as_blob(&blob_base, a->repo,
@@ -6282,8 +6332,9 @@ unstage_path(void *arg, unsigned char status,
err = merge_file(&local_changes_subsumed,
a->worktree, blob_base, ondisk_path,
relpath, got_fileindex_perms_to_st(ie),
- path_unstaged_content, "unstaged",
- a->repo, a->progress_cb, a->progress_arg);
+ path_unstaged_content, label_orig,
+ "unstaged", a->repo, a->progress_cb,
+ a->progress_arg);
if (err == NULL &&
path_new_staged_content == NULL)
got_fileindex_entry_stage_set(ie,
@@ -6297,7 +6348,7 @@ unstage_path(void *arg, unsigned char status,
break;
err = merge_blob(&local_changes_subsumed, a->worktree,
blob_base, ondisk_path, relpath,
- got_fileindex_perms_to_st(ie), blob_staged,
+ got_fileindex_perms_to_st(ie), label_orig, blob_staged,
commit_id ? commit_id : a->worktree->base_commit_id,
a->repo, a->progress_cb, a->progress_arg);
if (err == NULL)
@@ -6325,7 +6376,7 @@ unstage_path(void *arg, unsigned char status,
err = (*a->progress_cb)(a->progress_arg, status, relpath);
break;
}
-
+done:
free(ondisk_path);
if (path_unstaged_content &&
unlink(path_unstaged_content) == -1 && err == NULL)
@@ -6339,6 +6390,8 @@ unstage_path(void *arg, unsigned char status,
got_object_blob_close(blob_base);
if (blob_staged)
got_object_blob_close(blob_staged);
+ free(id_str);
+ free(label_orig);
return err;
}
diff --git a/regress/cmdline/diff.sh b/regress/cmdline/diff.sh
index 31587c1..43a0f3a 100755
--- a/regress/cmdline/diff.sh
+++ b/regress/cmdline/diff.sh
@@ -102,6 +102,7 @@ function test_diff_shows_conflict {
echo "8" >> $testroot/repo/numbers
(cd $testroot/repo && git add numbers)
git_commit $testroot/repo -m "added numbers file"
+ local base_commit=`git_show_head $testroot/repo`
got checkout $testroot/repo $testroot/wt > /dev/null
ret="$?"
@@ -142,25 +143,29 @@ function test_diff_shows_conflict {
echo '+++ numbers' >> $testroot/stdout.expected
echo '@@ -1,8 +1,20 @@' >> $testroot/stdout.expected
echo ' 1' >> $testroot/stdout.expected
- echo "+<<<<<<< commit $head_rev" >> $testroot/stdout.expected
+ echo "+<<<<<<< merged change: commit $head_rev" \
+ >> $testroot/stdout.expected
echo ' 22' >> $testroot/stdout.expected
- echo '+|||||||' >> $testroot/stdout.expected
+ echo "+||||||| 3-way merge base: commit $base_commit" \
+ >> $testroot/stdout.expected
echo '+2' >> $testroot/stdout.expected
echo '+=======' >> $testroot/stdout.expected
echo '+77' >> $testroot/stdout.expected
- echo '+>>>>>>> numbers' >> $testroot/stdout.expected
+ echo '+>>>>>>>' >> $testroot/stdout.expected
echo ' 3' >> $testroot/stdout.expected
echo ' 4' >> $testroot/stdout.expected
echo ' 5' >> $testroot/stdout.expected
echo ' 6' >> $testroot/stdout.expected
echo ' 7' >> $testroot/stdout.expected
- echo "+<<<<<<< commit $head_rev" >> $testroot/stdout.expected
+ echo "+<<<<<<< merged change: commit $head_rev" \
+ >> $testroot/stdout.expected
echo ' 33' >> $testroot/stdout.expected
- echo '+|||||||' >> $testroot/stdout.expected
+ echo "+||||||| 3-way merge base: commit $base_commit" \
+ >> $testroot/stdout.expected
echo '+8' >> $testroot/stdout.expected
echo '+=======' >> $testroot/stdout.expected
echo '+88' >> $testroot/stdout.expected
- echo '+>>>>>>> numbers' >> $testroot/stdout.expected
+ echo '+>>>>>>>' >> $testroot/stdout.expected
(cd $testroot/wt && got diff > $testroot/stdout)
diff --git a/regress/cmdline/rebase.sh b/regress/cmdline/rebase.sh
old mode 100744
new mode 100755
index c94727a..62a0455
--- a/regress/cmdline/rebase.sh
+++ b/regress/cmdline/rebase.sh
@@ -176,6 +176,7 @@ function test_rebase_ancestry_check {
function test_rebase_continue {
local testroot=`test_init rebase_continue`
+ local init_commit=`git_show_head $testroot/repo`
(cd $testroot/repo && git checkout -q -b newbranch)
echo "modified alpha on branch" > $testroot/repo/alpha
@@ -216,13 +217,15 @@ function test_rebase_continue {
return 1
fi
- echo "<<<<<<< commit $orig_commit1" > $testroot/content.expected
+ echo "<<<<<<< merged change: commit $orig_commit1" \
+ > $testroot/content.expected
echo "modified alpha on branch" >> $testroot/content.expected
- echo "|||||||" >> $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 '>>>>>>> alpha' >> $testroot/content.expected
+ echo '>>>>>>>' >> $testroot/content.expected
cat $testroot/wt/alpha > $testroot/content
cmp -s $testroot/content.expected $testroot/content
ret="$?"
@@ -347,13 +350,15 @@ function test_rebase_abort {
return 1
fi
- echo "<<<<<<< commit $orig_commit1" > $testroot/content.expected
+ echo "<<<<<<< merged change: commit $orig_commit1" \
+ > $testroot/content.expected
echo "modified alpha on branch" >> $testroot/content.expected
- echo "|||||||" >> $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 '>>>>>>> alpha' >> $testroot/content.expected
+ echo '>>>>>>>' >> $testroot/content.expected
cat $testroot/wt/alpha > $testroot/content
cmp -s $testroot/content.expected $testroot/content
ret="$?"
@@ -457,13 +462,15 @@ function test_rebase_no_op_change {
return 1
fi
- echo "<<<<<<< commit $orig_commit1" > $testroot/content.expected
+ echo "<<<<<<< merged change: commit $orig_commit1" \
+ > $testroot/content.expected
echo "modified alpha on branch" >> $testroot/content.expected
- echo "|||||||" >> $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 '>>>>>>> alpha' >> $testroot/content.expected
+ echo '>>>>>>>' >> $testroot/content.expected
cat $testroot/wt/alpha > $testroot/content
cmp -s $testroot/content.expected $testroot/content
ret="$?"
@@ -564,13 +571,15 @@ function test_rebase_in_progress {
return 1
fi
- echo "<<<<<<< commit $orig_commit1" > $testroot/content.expected
+ echo "<<<<<<< merged change: commit $orig_commit1" \
+ > $testroot/content.expected
echo "modified alpha on branch" >> $testroot/content.expected
- echo "|||||||" >> $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 '>>>>>>> alpha' >> $testroot/content.expected
+ echo '>>>>>>>' >> $testroot/content.expected
cat $testroot/wt/alpha > $testroot/content
cmp -s $testroot/content.expected $testroot/content
ret="$?"
diff --git a/regress/cmdline/update.sh b/regress/cmdline/update.sh
index 4aa5679..2225b5a 100755
--- a/regress/cmdline/update.sh
+++ b/regress/cmdline/update.sh
@@ -642,6 +642,7 @@ function test_update_merges_file_edits {
echo "8" >> $testroot/repo/numbers
(cd $testroot/repo && git add numbers)
git_commit $testroot/repo -m "added numbers file"
+ local base_commit=`git_show_head $testroot/repo`
got checkout $testroot/repo $testroot/wt > /dev/null
ret="$?"
@@ -676,15 +677,16 @@ function test_update_merges_file_edits {
return 1
fi
- echo -n "<<<<<<< commit " > $testroot/content.expected
+ echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
git_show_head $testroot/repo >> $testroot/content.expected
echo >> $testroot/content.expected
echo "modified alpha" >> $testroot/content.expected
- echo "|||||||" >> $testroot/content.expected
+ echo "||||||| 3-way merge base: commit $base_commit" \
+ >> $testroot/content.expected
echo "alpha" >> $testroot/content.expected
echo "=======" >> $testroot/content.expected
echo "modified alpha, too" >> $testroot/content.expected
- echo '>>>>>>> alpha' >> $testroot/content.expected
+ echo '>>>>>>>' >> $testroot/content.expected
echo "modified beta" >> $testroot/content.expected
echo "1" >> $testroot/content.expected
echo "22" >> $testroot/content.expected
@@ -881,13 +883,13 @@ function test_update_conflict_wt_add_vs_repo_add {
return 1
fi
- echo -n "<<<<<<< commit " > $testroot/content.expected
+ echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
git_show_head $testroot/repo >> $testroot/content.expected
echo >> $testroot/content.expected
echo "new" >> $testroot/content.expected
echo "=======" >> $testroot/content.expected
echo "also new" >> $testroot/content.expected
- echo '>>>>>>> gamma/new' >> $testroot/content.expected
+ echo '>>>>>>>' >> $testroot/content.expected
cat $testroot/wt/gamma/new > $testroot/content
@@ -1323,6 +1325,7 @@ function test_update_moved_branch_ref {
function test_update_to_another_branch {
local testroot=`test_init update_to_another_branch`
+ local base_commit=`git_show_head $testroot/repo`
got checkout $testroot/repo $testroot/wt > /dev/null
ret="$?"
@@ -1362,15 +1365,16 @@ function test_update_to_another_branch {
return 1
fi
- echo -n "<<<<<<< commit " > $testroot/content.expected
+ echo -n "<<<<<<< merged change: commit " > $testroot/content.expected
git_show_head $testroot/repo >> $testroot/content.expected
echo >> $testroot/content.expected
echo "modified alpha on new branch" >> $testroot/content.expected
- echo "|||||||" >> $testroot/content.expected
+ echo "||||||| 3-way merge base: commit $base_commit" \
+ >> $testroot/content.expected
echo "alpha" >> $testroot/content.expected
echo "=======" >> $testroot/content.expected
echo "modified alpha in work tree" >> $testroot/content.expected
- echo '>>>>>>> alpha' >> $testroot/content.expected
+ echo '>>>>>>>' >> $testroot/content.expected
cat $testroot/wt/alpha > $testroot/content