Commit 4f3c844beaeb6a0b30565833e0481b8de9a5106e

Stefan Sperling 2021-09-14T16:12:52

make 'got update' display the worktree's branch name upon success ok tracey

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
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
diff --git a/got/got.c b/got/got.c
index 5b6177b..4765f7e 100644
--- a/got/got.c
+++ b/got/got.c
@@ -3386,9 +3386,10 @@ cmd_update(int argc, char *argv[])
 	if (error != NULL)
 		goto done;
 
-	if (upa.did_something)
-		printf("Updated to commit %s\n", commit_id_str);
-	else
+	if (upa.did_something) {
+		printf("Updated to %s: %s\n",
+		    got_worktree_get_head_ref_name(worktree), commit_id_str);
+	} else
 		printf("Already up-to-date\n");
 	print_update_progress_stats(&upa);
 done:
@@ -6070,8 +6071,11 @@ cmd_branch(int argc, char *argv[])
 			    NULL);
 			if (error)
 				goto done;
-			if (upa.did_something)
-				printf("Updated to commit %s\n", commit_id_str);
+			if (upa.did_something) {
+				printf("Updated to %s: %s\n",
+				    got_worktree_get_head_ref_name(worktree),
+				    commit_id_str);
+			}
 			print_update_progress_stats(&upa);
 		}
 	}
diff --git a/regress/cmdline/branch.sh b/regress/cmdline/branch.sh
index fd9564b..f49f14f 100755
--- a/regress/cmdline/branch.sh
+++ b/regress/cmdline/branch.sh
@@ -116,7 +116,8 @@ test_branch_create() {
 		> $testroot/stdout.expected
 	echo "refs/heads/updatebranch" >> $testroot/stdout.expected
 	echo "U  gamma/delta" >> $testroot/stdout.expected
-	echo "Updated to commit $commit_id0" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/updatebranch: $commit_id0" \
+		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
diff --git a/regress/cmdline/commit.sh b/regress/cmdline/commit.sh
index cfed572..d2b9ef3 100755
--- a/regress/cmdline/commit.sh
+++ b/regress/cmdline/commit.sh
@@ -300,7 +300,7 @@ test_commit_rejects_conflicted_file() {
 	echo "modified alpha, too" > $testroot/wt/alpha
 
 	echo "C  alpha" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
diff --git a/regress/cmdline/diff.sh b/regress/cmdline/diff.sh
index f37ba4b..5d259e7 100755
--- a/regress/cmdline/diff.sh
+++ b/regress/cmdline/diff.sh
@@ -121,7 +121,8 @@ test_diff_shows_conflict() {
 	sed -i 's/8/88/' $testroot/wt/numbers
 
 	echo "C  numbers" > $testroot/stdout.expected
-	echo -n "Updated to commit $head_rev" >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: $head_rev" \
+		>> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 
diff --git a/regress/cmdline/stage.sh b/regress/cmdline/stage.sh
index e511ff9..8e7009b 100755
--- a/regress/cmdline/stage.sh
+++ b/regress/cmdline/stage.sh
@@ -249,7 +249,7 @@ test_stage_conflict() {
 	echo "modified alpha, too" > $testroot/wt/alpha
 
 	echo "C  alpha" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
diff --git a/regress/cmdline/status.sh b/regress/cmdline/status.sh
index 115ad4e..77a893c 100755
--- a/regress/cmdline/status.sh
+++ b/regress/cmdline/status.sh
@@ -184,7 +184,7 @@ test_status_shows_local_mods_after_update() {
 	sed -i 's/7/77/' $testroot/wt/numbers
 
 	echo "G  numbers" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -343,7 +343,7 @@ test_status_shows_no_mods_after_complete_merge() {
 	sed -i 's/2/22/' $testroot/wt/numbers
 
 	echo "G  numbers" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -397,7 +397,7 @@ test_status_shows_conflict() {
 	sed -i 's/2/77/' $testroot/wt/numbers
 
 	echo "C  numbers" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
diff --git a/regress/cmdline/update.sh b/regress/cmdline/update.sh
index 978c932..cae6024 100755
--- a/regress/cmdline/update.sh
+++ b/regress/cmdline/update.sh
@@ -30,7 +30,7 @@ test_update_basic() {
 	git_commit $testroot/repo -m "modified alpha"
 
 	echo "U  alpha" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -70,7 +70,7 @@ test_update_adds_file() {
 	git_commit $testroot/repo -m "adding a new file"
 
 	echo "A  gamma/new" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -110,7 +110,7 @@ test_update_deletes_file() {
 	git_commit $testroot/repo -m "deleting a file"
 
 	echo "D  beta" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -151,7 +151,7 @@ test_update_deletes_dir() {
 	git_commit $testroot/repo -m "deleting a directory"
 
 	echo "D  epsilon/zeta" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -193,7 +193,8 @@ test_update_deletes_dir_with_path_prefix() {
 
 	# update back to first commit and expect psi/mu to be deleted
 	echo "D  psi/mu" > $testroot/stdout.expected
-	echo "Updated to commit $first_rev" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $first_rev" \
+		>> $testroot/stdout.expected
 
 	(cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
 
@@ -236,7 +237,8 @@ test_update_deletes_dir_recursively() {
 	# update back to first commit and expect psi/mu to be deleted
 	echo "D  psi/chi/tau" > $testroot/stdout.expected
 	echo "D  psi/mu" >> $testroot/stdout.expected
-	echo "Updated to commit $first_rev" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $first_rev" \
+		>> $testroot/stdout.expected
 
 	(cd $testroot/wt && got update -c $first_rev > $testroot/stdout)
 
@@ -276,7 +278,7 @@ test_update_sibling_dirs_with_common_prefix() {
 
 	echo "U  epsilon/zeta" > $testroot/stdout.expected
 	echo "A  epsilon2/mu" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -294,7 +296,7 @@ test_update_sibling_dirs_with_common_prefix() {
 	git_commit $testroot/repo -m "changing epsilon/zeta again"
 
 	echo "U  epsilon/zeta" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -338,7 +340,7 @@ test_update_dir_with_dot_sibling() {
 
 	echo "U  epsilon/zeta" > $testroot/stdout.expected
 	echo "A  epsilon.txt" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -356,7 +358,7 @@ test_update_dir_with_dot_sibling() {
 	git_commit $testroot/repo -m "changing epsilon/zeta again"
 
 	echo "U  epsilon/zeta" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -403,7 +405,7 @@ test_update_moves_files_upwards() {
 	echo "D  epsilon/psi/chi/tau" >> $testroot/stdout.expected
 	echo "D  epsilon/psi/mu" >> $testroot/stdout.expected
 	echo "A  epsilon/psi/tau" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -458,7 +460,7 @@ test_update_moves_files_to_new_dir() {
 	echo "D  epsilon/psi/mu" >> $testroot/stdout.expected
 	echo "A  epsilon-new/mu" >> $testroot/stdout.expected
 	echo "A  epsilon-new/psi/tau" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -525,7 +527,7 @@ test_update_creates_missing_parent() {
 	echo "D  snake.c" >> $testroot/stdout.expected
 	echo "A  snscore/Makefile" >> $testroot/stdout.expected
 	echo "A  snscore/snscore.c" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -577,7 +579,7 @@ test_update_creates_missing_parent_with_subdir() {
 	echo "A  sss/snake/snake.6" >> $testroot/stdout.expected
 	echo "A  sss/snake/snake.c" >> $testroot/stdout.expected
 	echo "A  sss/snake/snake.h" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -617,7 +619,7 @@ test_update_file_in_subsubdir() {
 	git_commit $testroot/repo -m "changed a file"
 
 	echo "U  arch/alpha/Makefile" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -668,7 +670,7 @@ test_update_merges_file_edits() {
 	echo "C  alpha" > $testroot/stdout.expected
 	echo "U  beta" >> $testroot/stdout.expected
 	echo "G  numbers" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
@@ -734,7 +736,7 @@ test_update_keeps_xbit() {
 	git_commit $testroot/repo -m "changed executable file"
 
 	echo "U  xfile" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -792,7 +794,7 @@ test_update_clears_xbit() {
 	git_commit $testroot/repo -m "not an executable file anymore"
 
 	echo "U  xfile" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -833,7 +835,7 @@ test_update_restores_missing_file() {
 	rm $testroot/wt/alpha
 
 	echo "!  alpha" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	(cd $testroot/wt && got update > $testroot/stdout)
@@ -878,7 +880,7 @@ test_update_conflict_wt_add_vs_repo_add() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	echo "C  gamma/new" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
@@ -939,7 +941,7 @@ test_update_conflict_wt_edit_vs_repo_rm() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	echo "G  beta" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
@@ -991,7 +993,7 @@ test_update_conflict_wt_rm_vs_repo_edit() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	echo "G  beta" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
@@ -1052,7 +1054,7 @@ test_update_conflict_wt_rm_vs_repo_rm() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	echo "D  beta" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
@@ -1109,7 +1111,7 @@ test_update_partial() {
 
 	echo "U  alpha" > $testroot/stdout.expected
 	echo "U  beta" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -1136,7 +1138,7 @@ test_update_partial() {
 	fi
 
 	echo "U  epsilon/zeta" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -1181,7 +1183,7 @@ test_update_partial_add() {
 
 	echo "A  new" > $testroot/stdout.expected
 	echo "A  epsilon/new2" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -1258,7 +1260,7 @@ test_update_partial_dir() {
 	git_commit $testroot/repo -m "modified two files"
 
 	echo "U  epsilon/zeta" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -1359,7 +1361,7 @@ test_update_to_another_branch() {
 
 	echo "Switching work tree from refs/heads/master to refs/heads/newbranch" > $testroot/stdout.expected
 	echo "C  alpha" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/newbranch: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
@@ -1498,7 +1500,7 @@ test_update_bumps_base_commit_id() {
 
 	echo "U  epsilon/psi" > $testroot/stdout.expected
 	echo "C  epsilon/zeta" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
@@ -1546,7 +1548,7 @@ test_update_tag() {
 	(cd $testroot/repo && git tag -m "test" -a $tag)
 
 	echo "U  alpha" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -1601,7 +1603,7 @@ test_update_toggles_xbit() {
 	local commit_id2=`git_show_head $testroot/repo`
 
 	echo "U  xfile" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -1613,7 +1615,7 @@ test_update_toggles_xbit() {
 	fi
 
 	echo "U  xfile" > $testroot/stdout.expected
-	echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $commit_id1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -1640,7 +1642,8 @@ test_update_toggles_xbit() {
 	fi
 
 	echo "U  xfile" > $testroot/stdout.expected
-	echo "Updated to commit $commit_id2" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $commit_id2" \
+		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -1692,7 +1695,7 @@ test_update_preserves_conflicted_file() {
 	fi
 
 	echo "#  alpha" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	echo "Files not updated because of existing merge conflicts: 1" \
@@ -1735,7 +1738,7 @@ test_update_modified_submodules() {
 
 	# This update only records the new base commit. Otherwise it is a
 	# no-op change because Got's file index does not track submodules.
-	echo -n "Updated to commit " > $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " > $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -1763,7 +1766,7 @@ test_update_adds_submodule() {
 	(cd $testroot/repo && git commit -q -m 'adding submodule')
 
 	echo "A  .gitmodules" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -1805,7 +1808,7 @@ test_update_conflict_wt_file_vs_repo_submodule() {
 	# No conflict occurs because 'got update' ignores the submodule
 	# and leaves the clashing file as it was.
 	echo "A  .gitmodules" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -1854,7 +1857,7 @@ test_update_adds_symlink() {
 	echo "A  epsilon.link" >> $testroot/stdout.expected
 	echo "A  nonexistent.link" >> $testroot/stdout.expected
 	echo "A  passwd.link" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -1968,7 +1971,7 @@ test_update_deletes_symlink() {
 	git_commit $testroot/repo -m "delete symlink"
 
 	echo "D  alpha.link" > $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 
@@ -2055,7 +2058,7 @@ test_update_symlink_conflicts() {
 	echo "C  new.link" >> $testroot/stdout.expected
 	echo "C  nonexistent.link" >> $testroot/stdout.expected
 	echo "G  zeta.link" >> $testroot/stdout.expected
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 7" >> $testroot/stdout.expected
@@ -2297,7 +2300,8 @@ test_update_single_file() {
 	fi
 
 	echo "U  c" > $testroot/stdout.expected
-	echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $commit_id1" \
+		>> $testroot/stdout.expected
 
 	(cd $testroot/wt && got update -c $commit_id1 c \
 		> $testroot/stdout)
@@ -2322,7 +2326,8 @@ test_update_single_file() {
 	fi
 
 	echo "U  c" > $testroot/stdout.expected
-	echo "Updated to commit $commit_id2" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $commit_id2" \
+		>> $testroot/stdout.expected
 
 	(cd $testroot/wt && got update -c $commit_id2 c > $testroot/stdout)
 
@@ -2346,7 +2351,8 @@ test_update_single_file() {
 	fi
 
 	echo "D  c" > $testroot/stdout.expected
-	echo "Updated to commit $commit_id3" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $commit_id3" \
+		>> $testroot/stdout.expected
 
 	(cd $testroot/wt && got update -c $commit_id3 c \
 		> $testroot/stdout 2> $testroot/stderr)
@@ -2370,7 +2376,8 @@ test_update_single_file() {
 	fi
 
 	echo "D  c" > $testroot/stdout.expected
-	echo "Updated to commit $commit_id3" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $commit_id3" \
+		>> $testroot/stdout.expected
 
 	(cd $testroot/wt && got update -c $commit_id3 > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
@@ -2429,7 +2436,8 @@ test_update_file_skipped_due_to_conflict() {
 	(cd $testroot/wt && got update -c $commit_id0 > $testroot/stdout)
 
 	echo "C  beta" > $testroot/stdout.expected
-	echo "Updated to commit $commit_id0" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $commit_id0" \
+		>> $testroot/stdout.expected
 	echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
@@ -2478,7 +2486,8 @@ test_update_file_skipped_due_to_conflict() {
 	# update to the latest commit again; this skips beta
 	(cd $testroot/wt && got update > $testroot/stdout)
 	echo "#  beta" > $testroot/stdout.expected
-	echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $commit_id1" \
+		>> $testroot/stdout.expected
 	echo "Files not updated because of existing merge conflicts: 1" \
 		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
@@ -2537,7 +2546,8 @@ test_update_file_skipped_due_to_conflict() {
 	# updating to the latest commit should now update beta
 	(cd $testroot/wt && got update > $testroot/stdout)
 	echo "U  beta" > $testroot/stdout.expected
-	echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $commit_id1" \
+		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -2612,8 +2622,10 @@ test_update_file_skipped_due_to_obstruction() {
 	(cd $testroot/wt && got update > $testroot/stdout)
 
 	echo "~  beta" > $testroot/stdout.expected
-	echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
-	echo "File paths obstructed by a non-regular file: 1" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $commit_id1" \
+		>> $testroot/stdout.expected
+	echo "File paths obstructed by a non-regular file: 1" \
+		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -2644,7 +2656,8 @@ test_update_file_skipped_due_to_obstruction() {
 	# updating to the latest commit should now update beta
 	(cd $testroot/wt && got update > $testroot/stdout)
 	echo "!  beta" > $testroot/stdout.expected
-	echo "Updated to commit $commit_id1" >> $testroot/stdout.expected
+	echo "Updated to refs/heads/master: $commit_id1" \
+		>> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -2692,7 +2705,7 @@ test_update_quiet() {
 	echo "modified alpha" > $testroot/repo/alpha
 	git_commit $testroot/repo -m "modified alpha"
 
-	echo -n "Updated to commit " >> $testroot/stdout.expected
+	echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
 	echo >> $testroot/stdout.expected