From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Wojciech Siewierski Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <3b0ce616-d7ae-8f63-3ed8-cab1a6feaae2@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lAoj1RGi46uR5C1cvHrJ9RJlQqhJTs8nn" X-Trace: blaine.gmane.org 1491837358 22610 195.159.176.226 (10 Apr 2017 15:15:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 10 Apr 2017 15:15:58 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 To: Dmitry Gutov , 26345@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 10 17:15:51 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cxb2k-0005jA-ER for geb-bug-gnu-emacs@m.gmane.org; Mon, 10 Apr 2017 17:15:50 +0200 Original-Received: from localhost ([::1]:34911 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxb2q-0002W7-GI for geb-bug-gnu-emacs@m.gmane.org; Mon, 10 Apr 2017 11:15:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxauK-00048M-50 for bug-gnu-emacs@gnu.org; Mon, 10 Apr 2017 11:07:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cxauE-0002Lq-Ar for bug-gnu-emacs@gnu.org; Mon, 10 Apr 2017 11:07:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43172) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cxauE-0002Ld-7J for bug-gnu-emacs@gnu.org; Mon, 10 Apr 2017 11:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cxauD-0002L2-Q5 for bug-gnu-emacs@gnu.org; Mon, 10 Apr 2017 11:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Wojciech Siewierski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Apr 2017 15:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26345 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 26345-submit@debbugs.gnu.org id=B26345.14918367918947 (code B ref 26345); Mon, 10 Apr 2017 15:07:01 +0000 Original-Received: (at 26345) by debbugs.gnu.org; 10 Apr 2017 15:06:31 +0000 Original-Received: from localhost ([127.0.0.1]:41371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cxati-0002KF-Qk for submit@debbugs.gnu.org; Mon, 10 Apr 2017 11:06:31 -0400 Original-Received: from mail-lf0-f68.google.com ([209.85.215.68]:36606) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cxatg-0002K1-Ok for 26345@debbugs.gnu.org; Mon, 10 Apr 2017 11:06:29 -0400 Original-Received: by mail-lf0-f68.google.com with SMTP id 75so3334591lfs.3 for <26345@debbugs.gnu.org>; Mon, 10 Apr 2017 08:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=x8bA1oxMA20tNHJY+7KNGf9f2r2FXemRMrXzjewtaf8=; b=Pc0R5XXM2E24aqQzcX5lXe89TOM8XXvLTCHDrdCLaIXyecHZ6oQ2iMXJZZZAmWlwnK IZA6Qn6yl249V06EHPFOb8x5SprGZxDh82bv674R+hoTGM8Hqub6jH7f0HRXuDlTJlRD nRWGIiDl3p4iPvbRUQsOnbdesHBlddc1dBr3kyBr2EDxqBNJ/BwfCGw7jAbBE5O6wkm9 Y+dT+jAFhmiTE4SsjkzJNhztY17+d8S96EJEq0/we4flUzbEZAJyI312nzQzxuMH+akG XTD77sqcM0f+j81pyu4Y2EeodJwWmuGobg2pF/GqdfKdPY1fRFrtvM/vRVaGaMBMgBgx Ml3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=x8bA1oxMA20tNHJY+7KNGf9f2r2FXemRMrXzjewtaf8=; b=aNo0OSydiG3XVKxgB8SH1UMDKLRVuAfahFqTQka8Xj6lszr0MpwjMTkSbSr3IA432P jJHDNdYwaiInAJuwZl+uSYqUVtbKujA2xroeDdh/u7FHFBZ9z7WxKtLwSTEbVX8G5soz U3IFWkvpUFhA7Pk2h1+s2K2rX1+s8dx5c5OZj9/9y/9I3BJ0J/Zga2QlH99RXljEVWVs 0WqzxYb763+WPqKj2PdcyrzJScj7GQe836CQ/Iw2XYUkUdRsdzM5DjAHSUhiS2skdVu/ YNrU3cJjUYaJF/Mddn8arOdxV2inT7xQ1miVFoU7wP9Ul8elHCvMwa7uAdcGalmWROkB J06w== X-Gm-Message-State: AFeK/H2927Xg0+IFw96wgahNqkkJVlyRrIEGxYjMS7t9vmV62R9V9/sbDMhCqbjdSc88+Q== X-Received: by 10.46.32.156 with SMTP id g28mr16800208lji.86.1491836782811; Mon, 10 Apr 2017 08:06:22 -0700 (PDT) Original-Received: from [192.168.43.99] (user-94-254-162-126.play-internet.pl. [94.254.162.126]) by smtp.googlemail.com with ESMTPSA id h9sm2850569ljb.46.2017.04.10.08.06.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Apr 2017 08:06:22 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:131446 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --lAoj1RGi46uR5C1cvHrJ9RJlQqhJTs8nn Content-Type: multipart/mixed; boundary="lDk19aDo5sFlaBsFuPfj2nB7h2an6IiEx"; protected-headers="v1" From: Wojciech Siewierski To: Dmitry Gutov , 26345@debbugs.gnu.org Message-ID: Subject: Re: bug#26345: 25.1; vc-annotate in Git is unable to fully navigate the history if the file was moved References: <3b0ce616-d7ae-8f63-3ed8-cab1a6feaae2@gmail.com> In-Reply-To: --lDk19aDo5sFlaBsFuPfj2nB7h2an6IiEx Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 appear= s >> 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 erro= r >> 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! --lDk19aDo5sFlaBsFuPfj2nB7h2an6IiEx-- --lAoj1RGi46uR5C1cvHrJ9RJlQqhJTs8nn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJY659sAAoJEOWQKlKyR7jeci0H/1erNDHOQUEtrlDDqZaEQwmY e/B3UOnV8en8mXt/sZyF4RWnW8XOv5m+DG8gTAqaBJ2+Y+GvMD35ogUFRqa6Yd24 0XsdvWCMIIo5PMEcbYL5b0spZsHBQOuI+LL2VcIEwnhqDsZ4oG5BSqIJU/W8HIQi U3lzjoQjYPxNDIMZY/bFNIhZw7bdPSrn4QPveswfEshtknOTfv9QVPqo7tKIkfpD 2MALa2ZJJacv+n6j1fd+eraI3FdDHyyW7bIykIDOwJMvV5M8POHd71dcm61Y0b95 YpEePYwRQCN7T2JLR/cEt+Ck0TyOJ5Gyrr1cxoev6nrF3FpBIJMnXbYLDNgucd4= =gVgQ -----END PGP SIGNATURE----- --lAoj1RGi46uR5C1cvHrJ9RJlQqhJTs8nn--