all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Wojciech Siewierski <wojciech.siewierski@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>, 26345@debbugs.gnu.org
Subject: bug#26345: 25.1; vc-annotate in Git is unable to fully navigate the history if the file was moved
Date: Mon, 10 Apr 2017 17:06:16 +0200	[thread overview]
Message-ID: <c4c0ed7e-e522-9660-f146-065cf2d21336@gmail.com> (raw)
In-Reply-To: <acbe4730-6eda-55c3-5f0b-625c86f05e9f@yandex.ru>


[-- Attachment #1.1: Type: text/plain, Size: 2392 bytes --]

On 10.04.2017 04:30, Dmitry Gutov wrote:
> On 03.04.2017 00:46, Wojciech Siewierski wrote:
>>
>> It seems some vc-git operations override `default-directory' with the
>> parent directory of the files they operate on. It's a problem if they no
>> longer exist like in the following scenario.
>>
>> Preparation steps in shell:
>>
>> $ git init
>> $ mkdir olddir/
>> $ echo oldcontent > olddir/file.txt
>> $ git add olddir/
>> $ git commit -m 'Initial commit'
>> $ echo newcontent > olddir/file.txt
>> $ git add olddir/
>> $ git commit -m 'Modify the file'
>> $ git mv olddir/ newdir/
>> $ git commit -m 'Move the file'
>>
>> Reproduction:
>>
>> 1. Open newdir/file.txt in Emacs.
>> 2. Press `C-x v g' to open `vc-annotate'.
>> 3. Press `j' to jump to the revision from before the file was moved.
>> 4. Try to move to the next (newer) revision with `n'. The error appears
>> here.
>
> Thanks. For the report. I'm including a minor patch below. Does it
> improve things considerably for you?
>
>>> apply: Setting current directory: No such file or directory,
>> .../testrepo/olddir/
>>
>> It seems in this scenario `vc-annotate' also has trouble with the
>> regular navigation (`n' and `p') without the usage of `j' but the error
>> message is not as clear.
>
> The problem of `n' and `p' navigation between revisions where the file
> name changed is still present, because of how `vc-git-next-revision'
> is written. Suggestions for a better implementation are welcome.
>
> The patch that fixes the first scenario:
>
> diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
> index 1a3f1bf..4767cbf 100644
> --- a/lisp/vc/vc-git.el
> +++ b/lisp/vc/vc-git.el
> @@ -1274,9 +1274,8 @@ vc-git--rev-parse
>
>  (defun vc-git-next-revision (file rev)
>    "Git-specific version of `vc-next-revision'."
> -  (let* ((default-directory (file-name-directory
> -                 (expand-file-name file)))
> -         (file (file-name-nondirectory file))
> +  (let* ((default-directory (vc-git-root file))
> +         (file (file-relative-name file))
>           (current-rev
>            (with-temp-buffer
>              (and
The error is gone but usability-wise not much has changed: now the
vc-annotate buffer contains "fatal: no such path olddir/file.txt in
master" after I finish my test scenario. I guess not much more can be
done. Thanks!


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2017-04-10 15:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-02 21:46 bug#26345: 25.1; vc-annotate in Git is unable to fully navigate the history if the file was moved Wojciech Siewierski
2017-04-10  2:30 ` Dmitry Gutov
2017-04-10 15:06   ` Wojciech Siewierski [this message]
2017-04-10 23:25     ` Dmitry Gutov
2017-04-14 23:46       ` Wojciech Siewierski
2017-05-01  1:41         ` 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=c4c0ed7e-e522-9660-f146-065cf2d21336@gmail.com \
    --to=wojciech.siewierski@gmail.com \
    --cc=26345@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /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.