From: Dmitry Gutov <dgutov@yandex.ru>
To: 14989@debbugs.gnu.org
Subject: bug#14989: 24.3.50; log-view-diff and log-view-diff-changeset default to different `to' revisions for git merge commits
Date: Wed, 31 Jul 2013 01:42:57 +0300 [thread overview]
Message-ID: <8738qv8ya6.fsf@axl.i-did-not-set--mail-host-address--so-tickle-me> (raw)
To reproduce:
Have a merge commit where the second branch (merged from) has a newer
last commit than the first branch (merged to).
`vc-print-root-log' buffer would look like this:
* (HEAD, devel)b044fba..: Some Guy 2013-07-25 foo foo
* 2152d76..: Dmitry Gutov 2013-07-25 Merge branch 'bar' into devel
|\
| * (bar)1554943..: Another Guy 2013-07-25 Abc
| * f92770a..: Another Guy 2013-07-25 Def
* | 5f5c068..: Another Guy 2013-07-25 Ghi
If I move to commit 2152d76 and press `d', it will show the diff against
1554943. If I press `D', if will show the diff against 5f5c068, which is
*the* parent commit, as far as Git is concerned (the first parent, to be
more exact), because it belongs to the branch `devel', and the merge was
done from `bar' to `devel'.
Since this is a `vc-print-root-log' buffer, both commands will show the
full changesets, not just changes in an individual file.
But the behavior in `vc-print-log' is the same in this respect, except
the diff `d' shows is just for the current file.
`log-view-diff' behavior makes certain amount of sense (it always diffs
against the revision on the line below), but it's inconsistent with
`log-view-diff-changeset', and it also backfires when the current commit
is not a child of the commit on the previous line. Example: f92770a and
5f5c068. As a result, we get a meaningless diff.
This fix is simple enough. Apply?
=== modified file 'lisp/vc/log-view.el'
--- lisp/vc/log-view.el 2013-06-11 06:36:06 +0000
+++ lisp/vc/log-view.el 2013-07-30 22:31:40 +0000
@@ -565,10 +565,7 @@
(let ((fr (log-view-current-tag beg))
(to (log-view-current-tag end)))
(when (string-equal fr to)
- (save-excursion
- (goto-char end)
- (log-view-msg-next)
- (setq to (log-view-current-tag))))
+ (setq to (vc-call-backend log-view-vc-backend 'previous-revision nil fr)))
(vc-diff-internal
t (list log-view-vc-backend
(if log-view-per-file-logs
The functions could also use some further cleanup:
1) Swap the `to' and `fr' local variables.
2) Extract the function bodies to one function with a third argument
(called `whole-changeset', maybe), and make them call it.
Objections?
next reply other threads:[~2013-07-30 22:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-30 22:42 Dmitry Gutov [this message]
2013-07-31 1:38 ` bug#14989: 24.3.50; log-view-diff and log-view-diff-changeset default to different `to' revisions for git merge commits Stefan Monnier
2013-07-31 12:26 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8738qv8ya6.fsf@axl.i-did-not-set--mail-host-address--so-tickle-me \
--to=dgutov@yandex.ru \
--cc=14989@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.