git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Wish] use postimage when showing common context in "diff -w"?
@ 2011-12-27 22:16 Junio C Hamano
  2012-01-06 17:13 ` [PATCH] xdiff: print post-image for common records instead of pre-image René Scharfe
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2011-12-27 22:16 UTC (permalink / raw)
  To: git; +Cc: Joey Hess

Joey's "write first for-merge ref to FETCH_HEAD first" ($gmane/187699)
wraps an existing large for(;;) loop inside another new loop, making the
existing code indented deeper.  After queuing the patch, "git show -w"
displays a hunk like this [*1*]:

+	/*
+	 * The first pass writes objects to be merged and then the
+	 * second pass writes the rest, in order to allow using
+	 * FETCH_HEAD as a refname to refer to the ref to be merged.
+	 */
+	for (want_merge = 1; 0 <= want_merge; want_merge--) {
 	for (rm = ref_map; rm; rm = rm->next) {
 		struct ref *ref = NULL;
 
+			commit = lookup_commit_reference_gently(rm->old_sha1, 1);
+			if (!commit)
+				rm->merge = 0;
+
+			if (rm->merge != want_merge)
+				continue;
+
 		if (rm->peer_ref) {
 			ref = xcalloc(1, sizeof(*ref) + strlen(rm->peer_ref->name) + 1);
 			strcpy(ref->name, rm->peer_ref->name);

The context lines we can see in the above hunk are shown with incorrect
indentation level; I think we are showing the lines from the preimage.

It would be a really nice holiday gift to us, if somebody can fix this to
show lines from the postimage. It would make reviewing the change much
more pleasant.  I obviously cannot throw this into my Amazon wishlist, so
instead I am posting it here ;-)


[Footnote]

*1* The text has my style fix-ups in it and does not match what was
posted. The patch lacked a sign-off and needs to be amended anyway. Also
it needs to adjust some existing tests (at least 5515 seems to break for
obvious reasons).

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-10 23:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-27 22:16 [Wish] use postimage when showing common context in "diff -w"? Junio C Hamano
2012-01-06 17:13 ` [PATCH] xdiff: print post-image for common records instead of pre-image René Scharfe
2012-01-06 19:10   ` Junio C Hamano
2012-01-10 22:58   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).