From unknown Sun Jun 15 14:44:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24725: 25.1.50; vc-region-history may exceed max line number of file in repository Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 18 Oct 2016 14:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 24725@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.147680086413466 (code B ref -1); Tue, 18 Oct 2016 14:28:01 +0000 Received: (at submit) by debbugs.gnu.org; 18 Oct 2016 14:27:44 +0000 Received: from localhost ([127.0.0.1]:38218 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwVMl-0003V8-VT for submit@debbugs.gnu.org; Tue, 18 Oct 2016 10:27:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50869) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwVMk-0003Uv-UF for submit@debbugs.gnu.org; Tue, 18 Oct 2016 10:27:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwVMe-0002MU-Sj for submit@debbugs.gnu.org; Tue, 18 Oct 2016 10:27:37 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55799) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwVMe-0002MQ-Q1 for submit@debbugs.gnu.org; Tue, 18 Oct 2016 10:27:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwVMd-000605-NM for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2016 10:27:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwVMZ-0002Kw-M2 for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2016 10:27:35 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:36313) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwVMZ-0002KL-FJ for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2016 10:27:31 -0400 Received: by mail-pf0-x241.google.com with SMTP id r16so15299019pfg.3 for ; Tue, 18 Oct 2016 07:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version; bh=ZFexhvq+Rqous2Z4scjT8rhEIPf/WqgHd5hBhy0Oaok=; b=nyF3KH9N23Bwm/9E6DYdDgt+qCK9N+3gjIkML55s9L5TTt1hi1kczpjvSfXSwTusJG Z/UxmQl6LmFde85kOq/QncgK3TWMUCATqrEjAnvKvajVHTBr7XH5LARu2LriG6APC+8Z kgMhJqnztKHQ6aPJ4qVqU7reufprKpaSKpPoKS2EFzTjT3BI/XtjgNWm2TWahRKAfBJO uUF9xztYv65zvlneqBULfsk9EBxkRFfEQKvIUdZ/x5Gu6QnCEtQEHvWmBS+othBj2BP0 oTGfG5mWJmAkAB8RvKjefOPJ9wgOpnVEgLp615NEFqVMtE0zo/FRrRcrfs8aTM46eiTv 7s3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=ZFexhvq+Rqous2Z4scjT8rhEIPf/WqgHd5hBhy0Oaok=; b=XB+N6BA2qz33kf0/2JDQi8WeeG04n+ki/L8s66ctTdHgCBg9utxa5/I1p+JHmqFlZE zJAMh8lGEqGdix0j8Iee/42/Z+9yZ3dR7mQyvRlPbvZ1+uqpc80svlLW1+KqVJ645Y8+ Iu4zIeG3oWph4drYEkAXsFYVSWm4983APq/KMxnVh7ERgntSAkbc29IfVLFFaHdt0NI4 7hHshECAhy+BfycNuG6kYvMRyXEwXYorHNY9JcpRk2CIl6bg9q0lqlcX2Hf+0QecHVIa dJfz4LyDpQccvtzeDs3UFLjgdhEwU+XICwaPZXJX3QeXtajFWIh1ohFz1ptI2Jge0iLW siIw== X-Gm-Message-State: AA6/9RluePM/ke+OkgrN1IUOLOPUq5zB3SbjvavUF+72hhSNxThl/ahE/d54L6r4P+fMXw== X-Received: by 10.99.129.65 with SMTP id t62mr1005470pgd.114.1476800849675; Tue, 18 Oct 2016 07:27:29 -0700 (PDT) Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id ah5sm56715134pad.30.2016.10.18.07.27.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Oct 2016 07:27:29 -0700 (PDT) From: Tino Calancha Date: Tue, 18 Oct 2016 23:27:19 +0900 Message-ID: <87y41llol4.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) emacs -Q lisp/vc/vc.el C-x h M-x vc-region-history RET fatal: file vc.el has only 2921 lines ;; vc.el has 2922 lines but Git ignores the last empty line. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From 12a6fc588fe60ebf98443a0fd068fe77d63bd17e Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Tue, 18 Oct 2016 23:20:07 +0900 Subject: [PATCH] vc-region-history: Do not exceed the file maximum line number The last empty line in a file is not part of the Git repository. * lisp/vc/vc.el (vc-region-history): Exclude the last empty line from the region (Bug#24724). --- lisp/vc/vc-git.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 9eac5b2..762f6af 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1016,6 +1016,8 @@ vc-git-region-history ;; FIXME: Maybe this should be done in vc.el (i.e. for all backends), but ;; since Git is the only backend to support this operation so far, it's hard ;; to tell. + (when (> lto (1- (line-number-at-pos (point-max)))) + (setq lto (1- (line-number-at-pos (point-max))))) (with-temp-buffer (vc-call-backend 'git 'diff file "HEAD" nil (current-buffer)) (goto-char (point-min)) -- 2.9.3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.1) of 2016-10-13 built on calancha-pc Repository revision: baa8ba4ed471d7fe4bb07c80a9dd16c4712525b4 From unknown Sun Jun 15 14:44:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24725: 25.1.50; vc-region-history may exceed max line number of file in repository Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Oct 2016 23:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha , 24725@debbugs.gnu.org Received: via spool by 24725-submit@debbugs.gnu.org id=B24725.147691936223587 (code B ref 24725); Wed, 19 Oct 2016 23:23:02 +0000 Received: (at 24725) by debbugs.gnu.org; 19 Oct 2016 23:22:42 +0000 Received: from localhost ([127.0.0.1]:40129 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bx0C1-00068N-Pc for submit@debbugs.gnu.org; Wed, 19 Oct 2016 19:22:41 -0400 Received: from mail-lf0-f48.google.com ([209.85.215.48]:32902) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bx0C0-000687-OY for 24725@debbugs.gnu.org; Wed, 19 Oct 2016 19:22:41 -0400 Received: by mail-lf0-f48.google.com with SMTP id x79so52360514lff.0 for <24725@debbugs.gnu.org>; Wed, 19 Oct 2016 16:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5htqAs6zAejpQ+GcJFNJkMlNeUl48whMDnjX31NEL8Y=; b=TR+Yy+GtjxRQZ0XbKdAcz7l5ztz/e7C/k9csTXJV3jxOR2WYRuzKiLD+jrjZNQqm8Y NvfVppefqnUdQPTy1rt2JT48VaPwaZ+MLasQZHfqnmZfCH5deZE8OwVsEQKl+tucaC0e Cd61th/GZlbB5Jr7pSmNN/VuDXV93ulxM6nFeMtVaShnwjaujGCR77Bw1z8OudA1/5uz M0iqIh6cncHQx58WYBL8GIuUB8seskTI+JMEdyM/Ikz4jc5dBWn591pyQ0KVEJc13xMY HoJ+eucxoKIDG2Kwbt/YybD6JM7K+jp5khtInx9u5EPXYowtewunqfay8mydWaRt6rk5 dE7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5htqAs6zAejpQ+GcJFNJkMlNeUl48whMDnjX31NEL8Y=; b=WbBKefKYqZtACYv+x/hICUQXAIiCf4ps7U+BxzmD1boKkb2ySYbO0SN5j2ATC25oBC v4aG8gLXhn+i78XYDIpSZ3CDcfHvfW9DCjI1F77L25iUPK0tNmveVCeBKgtidYDkyQxW 5W65Czkk0OHXXwM61wdWm37U1QG3czV9Y4S5VKpEoT6TNzQxi6J1tBnDFF+YjztIWVk/ GvBdE7kslCJLzg6ZAWk80sUuvMb3g6ZJvxjlGppSnt6A+7SOMJ4rGZP4RxIh7coPV9vo uLJ8ZXa8JSnfCSFzNzOtM062QWul4y0wvhcBl/XiIqFd/FPq4/LA/XsAs+enPE/0lA0u QRzg== X-Gm-Message-State: AA6/9RmRe6/OMQ7kRLTZWg9xAPwXkUsQC3PhFDGEYJmoc47tfhu5qRmMtfkcu8jZJGP5hA== X-Received: by 10.194.18.137 with SMTP id w9mr6386455wjd.198.1476919354668; Wed, 19 Oct 2016 16:22:34 -0700 (PDT) Received: from [192.168.1.3] ([185.105.173.41]) by smtp.googlemail.com with ESMTPSA id qa7sm73027203wjc.39.2016.10.19.16.22.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Oct 2016 16:22:34 -0700 (PDT) References: <87y41llol4.fsf@gmail.com> From: Dmitry Gutov Message-ID: Date: Thu, 20 Oct 2016 02:22:32 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Thunderbird/50.0 MIME-Version: 1.0 In-Reply-To: <87y41llol4.fsf@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.2 (/) Hi! On 18.10.2016 17:27, Tino Calancha wrote: > > emacs -Q lisp/vc/vc.el > C-x h > M-x vc-region-history RET > fatal: file vc.el has only 2921 lines > ;; vc.el has 2922 lines but Git ignores the last empty line. With your patch, what will happen if the file does not end with a newline (which can be some people's or tools' preference)? Currently, in that case the above scenario works fine. Maybe we need a different check, rather than substracting. Or try (line-number-at-pos (1- (point-max))) instead of (1- (line-number-at-pos (point-max))). From unknown Sun Jun 15 14:44:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24725: 25.1.50; vc-region-history may exceed max line number of file in repository Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Oct 2016 04:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov Cc: 24725@debbugs.gnu.org, tino.calancha@gmail.com Received: via spool by 24725-submit@debbugs.gnu.org id=B24725.147693734518459 (code B ref 24725); Thu, 20 Oct 2016 04:23:01 +0000 Received: (at 24725) by debbugs.gnu.org; 20 Oct 2016 04:22:25 +0000 Received: from localhost ([127.0.0.1]:40205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bx4s5-0004nf-J3 for submit@debbugs.gnu.org; Thu, 20 Oct 2016 00:22:25 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:34389) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bx4s4-0004nT-V7 for 24725@debbugs.gnu.org; Thu, 20 Oct 2016 00:22:25 -0400 Received: by mail-pf0-f169.google.com with SMTP id r16so28165044pfg.1 for <24725@debbugs.gnu.org>; Wed, 19 Oct 2016 21:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:references:cc:date:in-reply-to:message-id :user-agent:mime-version; bh=egAcAmCUBXR2p29pUsYWBibuUQ4St0LAVeT/hwdFQ+A=; b=ZtiQZJSycw+eWHkGVVQvz7shWZV2RRdhAJd9vuxwpfHAecitJ6glZgngjLBly5QuYL Jc+477KxyjYp1DT8ojjIfOG40HZ97e9sgY+YfgXKu5efT382C1z6ArKazEpnk8yJK2Ml 0laXeaHVpUkDovXnlRH+mg5kZqZSNDPRU/iMc382CA9AbFbwbOlz2h8s0czsksl6IXYQ YvLIHcyx98X8Er1jprwr2v7a2qfEUWvZeu1lsNDkxv/X8U6XcqE6FYD0UK6C0Y/M0cZy XaWPLf0tM8EWDnZ7PyuB4P01HegAu+8n8c7dNbeXW3hFxK22gtoD4hEyEqbTqiVt6k6L VzZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:references:cc:date:in-reply-to :message-id:user-agent:mime-version; bh=egAcAmCUBXR2p29pUsYWBibuUQ4St0LAVeT/hwdFQ+A=; b=QpA1cyxEGx+LOIs41VdJuevPUciYB6FxGsXbUzrxnmZyNCOqGkicSc1jSwcD/cuxAE gWwE4KoPp06Iu0Zq8VQYwWqiR8yrPXysXSXRiuCZGu2r+rdjH+WxSuQ0EehBwYOP5JBp uIRKKz5XMS70WTcvHmpe6jf58LJut7V9GwNTj2cgy5T2SCTwQDHuPFE/odjUIihWxk5O y/H+LnhHT9j1S51uoWNODRLeoVZMLuZpWcnB1jxim9hW3LENznUXPFKKzQ+CALnILURd hVtR2dngWM20TiqQtXMc5d/ZXJvywZu/WG1mmIN6n99jprmRn/Or0AO65dP3I++7mWAu BuXg== X-Gm-Message-State: AA6/9RnJues3LrLVH/qg32dJgfIvqkvvKeZNid9FGHvj3mpPGyNHfBgbh2gPlJBhrXvO+Q== X-Received: by 10.98.102.84 with SMTP id a81mr17417599pfc.176.1476937339012; Wed, 19 Oct 2016 21:22:19 -0700 (PDT) Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id e74sm66380189pfk.13.2016.10.19.21.22.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Oct 2016 21:22:18 -0700 (PDT) From: Tino Calancha References: <87y41llol4.fsf@gmail.com> Date: Thu, 20 Oct 2016 13:22:10 +0900 In-Reply-To: (Dmitry Gutov's message of "Thu, 20 Oct 2016 02:22:32 +0300") Message-ID: <8737jrejkd.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Dmitry Gutov writes: > Hi! > > On 18.10.2016 17:27, Tino Calancha wrote: >> >> emacs -Q lisp/vc/vc.el >> C-x h >> M-x vc-region-history RET >> fatal: file vc.el has only 2921 lines >> ;; vc.el has 2922 lines but Git ignores the last empty line. > > With your patch, what will happen if the file does not end with a > newline (which can be some people's or tools' preference)? In that case my patch is wrong: it excludes the last line from the region. > Currently, in that case the above scenario works fine. Maybe we need a > different check, rather than substracting. > > Or try (line-number-at-pos (1- (point-max))) instead of (1- > (line-number-at-pos (point-max))). Thank you. Your suggestion handle both cases correctly. Following is the new patch: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From c9ce3a54f572549ea2027108694eb556b5cbe8f3 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Thu, 20 Oct 2016 12:22:51 +0900 Subject: [PATCH] vc-region-history: Do not exceed the file maximum line number The last empty line in a file is not part of the Git repository. * lisp/vc/vc.el (vc-region-history): Exclude the last empty line from the region (Bug#24725). --- lisp/vc/vc-git.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 9eac5b2..c6a9064 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1016,6 +1016,8 @@ vc-git-region-history ;; FIXME: Maybe this should be done in vc.el (i.e. for all backends), but ;; since Git is the only backend to support this operation so far, it's hard ;; to tell. + (when (> lto (line-number-at-pos (1- (point-max)))) + (setq lto (line-number-at-pos (1- (point-max))))) (with-temp-buffer (vc-call-backend 'git 'diff file "HEAD" nil (current-buffer)) (goto-char (point-min)) -- 2.9.3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.1) of 2016-10-20 Repository revision: 8988327d548db7b69f30ea15496ccb0726fa4502 From unknown Sun Jun 15 14:44:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24725: 25.1.50; vc-region-history may exceed max line number of file in repository Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Oct 2016 07:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: 24725@debbugs.gnu.org, Dmitry Gutov Received: via spool by 24725-submit@debbugs.gnu.org id=B24725.14769484453416 (code B ref 24725); Thu, 20 Oct 2016 07:28:02 +0000 Received: (at 24725) by debbugs.gnu.org; 20 Oct 2016 07:27:25 +0000 Received: from localhost ([127.0.0.1]:40283 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bx7l7-0000t2-1a for submit@debbugs.gnu.org; Thu, 20 Oct 2016 03:27:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:48357) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bx7l5-0000su-FX for 24725@debbugs.gnu.org; Thu, 20 Oct 2016 03:27:23 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8DE3EABFC; Thu, 20 Oct 2016 07:27:22 +0000 (UTC) From: Andreas Schwab References: <87y41llol4.fsf@gmail.com> <8737jrejkd.fsf@gmail.com> X-Yow: FISH-NET-FISH-NET-FISH-NET-FISH-NET-FISH!! Date: Thu, 20 Oct 2016 09:27:22 +0200 In-Reply-To: <8737jrejkd.fsf@gmail.com> (Tino Calancha's message of "Thu, 20 Oct 2016 13:22:10 +0900") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) On Okt 20 2016, Tino Calancha wrote: > diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el > index 9eac5b2..c6a9064 100644 > --- a/lisp/vc/vc-git.el > +++ b/lisp/vc/vc-git.el > @@ -1016,6 +1016,8 @@ vc-git-region-history > ;; FIXME: Maybe this should be done in vc.el (i.e. for all backends), but > ;; since Git is the only backend to support this operation so far, it's hard > ;; to tell. > + (when (> lto (line-number-at-pos (1- (point-max)))) > + (setq lto (line-number-at-pos (1- (point-max))))) Shouldn't that be fixed in the caller, and lto always be decremented if the regions ends at bol? Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." From unknown Sun Jun 15 14:44:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24725: 25.1.50; vc-region-history may exceed max line number of file in repository Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Oct 2016 08:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Andreas Schwab Cc: 24725@debbugs.gnu.org, Tino Calancha , Dmitry Gutov Received: via spool by 24725-submit@debbugs.gnu.org id=B24725.14769509587315 (code B ref 24725); Thu, 20 Oct 2016 08:10:01 +0000 Received: (at 24725) by debbugs.gnu.org; 20 Oct 2016 08:09:18 +0000 Received: from localhost ([127.0.0.1]:40313 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bx8Pe-0001tv-0C for submit@debbugs.gnu.org; Thu, 20 Oct 2016 04:09:18 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:35107) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bx8Pc-0001tc-B5 for 24725@debbugs.gnu.org; Thu, 20 Oct 2016 04:09:16 -0400 Received: by mail-pf0-f179.google.com with SMTP id s8so31960206pfj.2 for <24725@debbugs.gnu.org>; Thu, 20 Oct 2016 01:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:references:cc:date:in-reply-to:message-id :user-agent:mime-version; bh=sMPIac8kmOBuv9yXwZU+ktn+EIwH4+wiSIC58HedpiY=; b=puINKYhc2jNqsfwdZ2DroODk9cbRNVLah2E32NysOmW4Ra5A3sJXSnjtRbmPniRPJK UFFZig5Ujhtow6cQUSOWOakeup8t4K9wq1llY2lN/93Az9uNnukpOyA4FQF/Vsk8IdZB aQHwoCySL27EdrFYUyYx/zSNTf4WHPNYO2+Rc2K9A/UbvHC2iAFb3pGoCw8SwapfGuLy dbGa/XJX8Mb6iLQmNBxd/ZqCGgYY6uMNsqu+DAyHnNNHVP+7UesbOPbX+e2i3/f//5mv YLmI+bcQ+kkn/iKhdi5s8CKos0JfV5juXnI5F/vvoSMYLwxY8yDjNg9Ml9njt7JMT8wk 8t9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:references:cc:date:in-reply-to :message-id:user-agent:mime-version; bh=sMPIac8kmOBuv9yXwZU+ktn+EIwH4+wiSIC58HedpiY=; b=EXb50hnxK22sL/ky2163B4xSeXy67pe/EQvRCLBhVjVUT88S2DM5HVqoQgsyTYKOgk QO/uACjTd+ial/Q0ZPnqV9zuJHImqk6T13elmXzidP0kPuJtzSuMK813j+Jta9b9u4Ui 8f6HSelv0ysTbBs/kUWzX0YqNH+tUehAQPzkMNXovef2RHJL8Kc+Itx17YZhfPcitvqz Jeej0hZ63CvvVEnx37Og4RxkjhICnpMa0QzrBK7Slv5f6sEC6pkfYxg/0fMS9MJOWqMu ikQcaNFJIEuKEA6kghN+jtH/p2n/U2WkV4AICevfjBMHH2D9Vkw9e4PalFYf71U2sGwA T2TQ== X-Gm-Message-State: AA6/9RlPjzrk1sAcclFKV9KHI29DQ4Y1PNsLbN3ATA7yNY/ngswap/tVVZJ92KQXjlJzdQ== X-Received: by 10.98.129.130 with SMTP id t124mr19024605pfd.5.1476950950836; Thu, 20 Oct 2016 01:09:10 -0700 (PDT) Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id m188sm69256570pfc.40.2016.10.20.01.09.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Oct 2016 01:09:10 -0700 (PDT) From: Tino Calancha References: <87y41llol4.fsf@gmail.com> <8737jrejkd.fsf@gmail.com> Date: Thu, 20 Oct 2016 17:09:07 +0900 In-Reply-To: (Andreas Schwab's message of "Thu, 20 Oct 2016 09:27:22 +0200") Message-ID: <87r37bcuho.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) Andreas Schwab writes: > On Okt 20 2016, Tino Calancha wrote: > >> diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el >> index 9eac5b2..c6a9064 100644 >> --- a/lisp/vc/vc-git.el >> +++ b/lisp/vc/vc-git.el >> @@ -1016,6 +1016,8 @@ vc-git-region-history >> ;; FIXME: Maybe this should be done in vc.el (i.e. for all backends), but >> ;; since Git is the only backend to support this operation so far, it's hard >> ;; to tell. >> + (when (> lto (line-number-at-pos (1- (point-max)))) >> + (setq lto (line-number-at-pos (1- (point-max))))) > > Shouldn't that be fixed in the caller, and lto always be decremented if > the regions ends at bol? I think you are right. Otherwise we are including a line out of the region, i.e., in interactive calls we also search in the history for a line out of the highlighted region. How about following new patch? ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From b05b6d12171ea270f6b392c8af7f4415414960e5 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Thu, 20 Oct 2016 17:00:04 +0900 Subject: [PATCH] vc-region-history: Search just on lines within the region * lisp/vc/vc.el (vc-region-history): If region ends in the beginning of a line, then exclude that line from the search (Bug#24725). --- lisp/vc/vc.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index af875e8..0d8e308 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2393,7 +2393,11 @@ vc-region-history "Show the history of the region FROM..TO." (interactive "r") (let* ((lfrom (line-number-at-pos from)) - (lto (line-number-at-pos to)) + (lto (save-excursion + (goto-char to) + (if (bolp) + (1- (line-number-at-pos to)) + (line-number-at-pos to)))) (file buffer-file-name) (backend (vc-backend file)) (buf (get-buffer-create "*VC-history*"))) -- 2.9.3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.1) of 2016-10-20 Repository revision: 8988327d548db7b69f30ea15496ccb0726fa4502 From unknown Sun Jun 15 14:44:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24725: 25.1.50; vc-region-history may exceed max line number of file in repository Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Oct 2016 10:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha , Andreas Schwab Cc: 24725@debbugs.gnu.org Received: via spool by 24725-submit@debbugs.gnu.org id=B24725.147695887119213 (code B ref 24725); Thu, 20 Oct 2016 10:22:01 +0000 Received: (at 24725) by debbugs.gnu.org; 20 Oct 2016 10:21:11 +0000 Received: from localhost ([127.0.0.1]:40366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bxATH-0004zo-DA for submit@debbugs.gnu.org; Thu, 20 Oct 2016 06:21:11 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:34345) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bxATF-0004zX-5v for 24725@debbugs.gnu.org; Thu, 20 Oct 2016 06:21:09 -0400 Received: by mail-lf0-f53.google.com with SMTP id b81so76528774lfe.1 for <24725@debbugs.gnu.org>; Thu, 20 Oct 2016 03:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6IXxEqla5X3dFPPirggpwfiZ0/xge5XhshX24/GdEZE=; b=uW4L1l5yTM3/BuZsuEoOPQHB/2+vGmTJFroLe/jcsWHJ805TOqkBCialQ7aBJND3dD C1n81yziDCeOGjy51Dtj5hx1IrGdvl7dJt+oclgd7l7xI/WC/pQAfz0L32QV+Erp4uNR 7en3KXzkMcfrokxMBmlifTy2rlgXjEzJ/amqW8bn1osUqLsoqSjG47Ya5x2z4tOOMd7g v0NAse++BQAlP8Sqd71JbU+Nfm5PioxRIe2N0RGUGk4j7ELXlMVP6foHqeappumCylxG kCJBfhMo1N/X/KmdAhsPvGlaLf2d/xpZfx/nhH06hNzs68oEQuJzzNsNYgcpXgLxYOc+ NG0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6IXxEqla5X3dFPPirggpwfiZ0/xge5XhshX24/GdEZE=; b=NYGonQHlKZiUNTeHXy0lEs00qJKrHAab913F1ntRaooMgALtdi3rStFxG3tqnG3oAA eU6dzwG5D6XQcRCttq1LVfFLw2Fp88Wak5kVjRE0eHIWxmUylLEd5dxgBPdOv4SUx866 lAzKYOlKWcfvJSixC1yH+v1V1wHt8cm/9CQZXOkfk1LguAinRvqdQFf56Rv1AoAD+BjS 0seNkXc8dafcNvT4vhdgOOLjYLIiYU1JaE+LESrJ4v1TKZh/jJ0FGYeR74azA06vXMqn 0zvY3SFUjC9WKKFgrId9J4cclqO2e/9y5HTTm5HHviyVmMe4KN3ZyPBQAuzNvQvgLJvC ZNpw== X-Gm-Message-State: AA6/9Rnj4WNicUyX7WJT8kRu4vQGrdce2xz3rE2Audd0VHtpLtNvQyQoT+LOChINNkoXcw== X-Received: by 10.25.28.70 with SMTP id c67mr403997lfc.93.1476958863287; Thu, 20 Oct 2016 03:21:03 -0700 (PDT) Received: from [192.168.1.3] ([185.105.173.41]) by smtp.googlemail.com with ESMTPSA id u14sm7717641lja.46.2016.10.20.03.21.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Oct 2016 03:21:02 -0700 (PDT) References: <87y41llol4.fsf@gmail.com> <8737jrejkd.fsf@gmail.com> <87r37bcuho.fsf@gmail.com> From: Dmitry Gutov Message-ID: Date: Thu, 20 Oct 2016 13:21:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Thunderbird/50.0 MIME-Version: 1.0 In-Reply-To: <87r37bcuho.fsf@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) On 20.10.2016 11:09, Tino Calancha wrote: >> Shouldn't that be fixed in the caller, and lto always be decremented if >> the regions ends at bol? > I think you are right. Otherwise we are including a line out of the > region, i.e., in interactive calls we also search in the history for > a line out of the highlighted region. > How about following new patch? LGTM, please install. Although I was thinking of simplifying it to just: (line-number-at-pos (1- to)) That can only bite us if TO is at bob, which would be very unusual. From unknown Sun Jun 15 14:44:43 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Tino Calancha Subject: bug#24725: closed (Re: bug#24725: 25.1.50; vc-region-history may exceed max line number of file in repository) Message-ID: References: <878ttjmh95.fsf@gmail.com> <87y41llol4.fsf@gmail.com> X-Gnu-PR-Message: they-closed 24725 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 24725@debbugs.gnu.org Date: Thu, 20 Oct 2016 10:46:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1476960361-21819-1" This is a multi-part message in MIME format... ------------=_1476960361-21819-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #24725: 25.1.50; vc-region-history may exceed max line number of file in re= pository which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 24725@debbugs.gnu.org. --=20 24725: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24725 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1476960361-21819-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 24725-done) by debbugs.gnu.org; 20 Oct 2016 10:45:13 +0000 Received: from localhost ([127.0.0.1]:40377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bxAqW-0005ew-Up for submit@debbugs.gnu.org; Thu, 20 Oct 2016 06:45:13 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:36657) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bxAqU-0005eg-N2 for 24725-done@debbugs.gnu.org; Thu, 20 Oct 2016 06:45:11 -0400 Received: by mail-pf0-f178.google.com with SMTP id e6so34384455pfk.3 for <24725-done@debbugs.gnu.org>; Thu, 20 Oct 2016 03:45:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:references:cc:date:in-reply-to:message-id :user-agent:mime-version; bh=Qh3J1Gz4C67Pnb37K0LZpk4t6i8JPxmYlME6mgUitHA=; b=IOJBNjF7AIuuHEycA/2p0QUl8pg6v2e6ZgS97PMxUGhOH7z6HW12a4KjKEynFcxGL4 3dj5fl3daTjbAUNZW+v/Ii6dqNITWCQAMz/SSDEojQCsAPbei8X79wbXmamXYPZNrrcI JBP5ybL+vRf+qpwc0JkGCuPtpbx1M/NRlPK5uyp1Jn1VbOoS9EIopi9wSfaOha/DnH6+ PUfyG1Nd9JSPWgv1IWms9EWM1F4jF15hvx+13V4DrfjRtdqsLdbD7uPlMLjYubY4LE0U CVoY0EhNW+VIS6JwYnE0yXd1AJ2ZYFQvbjV1HQe7BF/kXa3wLKzU5YqhSL4DVUSNhKyU lodg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:references:cc:date:in-reply-to :message-id:user-agent:mime-version; bh=Qh3J1Gz4C67Pnb37K0LZpk4t6i8JPxmYlME6mgUitHA=; b=FQCCFEt+GMttgYbAatmkqOtdCMjfYnr3xNdVxmXH56ObKN4s8hX6wJAH1WJIA+DacD hYtAMHkzFDxxqN2m6Fp/iAFnORD/VftXi8wDLn+l22GIS4MkrndS4tEGKaj3g0EimOtN t/LCdo6CtPsfw/Y2x/Z36ztX688Njh1IFDG0m7Dq4GscbekWqz0qmto5VzsZ3cNZyj7N n6O1cx9aMKGapsW3whm2xzMU641nByj+mCTkYwtyRhc4JEjLVFfltkxQ2/LKSVpfcy9o vLswSYTDGnTF6YYu8PgSJ3i9GwXuafQQ0GGThehyXSTIswUhkbHhgfIY8bB2z8BA1wBk hlIA== X-Gm-Message-State: AA6/9RkTchTHu1yzsQSUZvxwKGTH9sKRFtVsB7jAWEsf9ILKoM6eISXZLPtpog68k6uctg== X-Received: by 10.98.36.219 with SMTP id k88mr48774pfk.88.1476960304916; Thu, 20 Oct 2016 03:45:04 -0700 (PDT) Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id a4sm70905831pax.8.2016.10.20.03.45.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Oct 2016 03:45:04 -0700 (PDT) From: Tino Calancha To: 24725-done@debbugs.gnu.org Subject: Re: bug#24725: 25.1.50; vc-region-history may exceed max line number of file in repository References: <87y41llol4.fsf@gmail.com> <8737jrejkd.fsf@gmail.com> <87r37bcuho.fsf@gmail.com> Date: Thu, 20 Oct 2016 19:44:54 +0900 In-Reply-To: (Dmitry Gutov's message of "Thu, 20 Oct 2016 13:21:00 +0300") Message-ID: <878ttjmh95.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 24725-done Cc: Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) Dmitry Gutov writes: > On 20.10.2016 11:09, Tino Calancha wrote: > >>> Shouldn't that be fixed in the caller, and lto always be decremented if >>> the regions ends at bol? >> I think you are right. Otherwise we are including a line out of the >> region, i.e., in interactive calls we also search in the history for >> a line out of the highlighted region. >> How about following new patch? > > LGTM, please install. > > Although I was thinking of simplifying it to just: > > (line-number-at-pos (1- to)) > > That can only bite us if TO is at bob, which would be very unusual. Good. It sounds more simple. Pushed that simple fix to emacs-25 branch as commit 3877c911 ------------=_1476960361-21819-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 18 Oct 2016 14:27:44 +0000 Received: from localhost ([127.0.0.1]:38218 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwVMl-0003V8-VT for submit@debbugs.gnu.org; Tue, 18 Oct 2016 10:27:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50869) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwVMk-0003Uv-UF for submit@debbugs.gnu.org; Tue, 18 Oct 2016 10:27:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwVMe-0002MU-Sj for submit@debbugs.gnu.org; Tue, 18 Oct 2016 10:27:37 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55799) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwVMe-0002MQ-Q1 for submit@debbugs.gnu.org; Tue, 18 Oct 2016 10:27:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwVMd-000605-NM for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2016 10:27:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwVMZ-0002Kw-M2 for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2016 10:27:35 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:36313) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwVMZ-0002KL-FJ for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2016 10:27:31 -0400 Received: by mail-pf0-x241.google.com with SMTP id r16so15299019pfg.3 for ; Tue, 18 Oct 2016 07:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version; bh=ZFexhvq+Rqous2Z4scjT8rhEIPf/WqgHd5hBhy0Oaok=; b=nyF3KH9N23Bwm/9E6DYdDgt+qCK9N+3gjIkML55s9L5TTt1hi1kczpjvSfXSwTusJG Z/UxmQl6LmFde85kOq/QncgK3TWMUCATqrEjAnvKvajVHTBr7XH5LARu2LriG6APC+8Z kgMhJqnztKHQ6aPJ4qVqU7reufprKpaSKpPoKS2EFzTjT3BI/XtjgNWm2TWahRKAfBJO uUF9xztYv65zvlneqBULfsk9EBxkRFfEQKvIUdZ/x5Gu6QnCEtQEHvWmBS+othBj2BP0 oTGfG5mWJmAkAB8RvKjefOPJ9wgOpnVEgLp615NEFqVMtE0zo/FRrRcrfs8aTM46eiTv 7s3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=ZFexhvq+Rqous2Z4scjT8rhEIPf/WqgHd5hBhy0Oaok=; b=XB+N6BA2qz33kf0/2JDQi8WeeG04n+ki/L8s66ctTdHgCBg9utxa5/I1p+JHmqFlZE zJAMh8lGEqGdix0j8Iee/42/Z+9yZ3dR7mQyvRlPbvZ1+uqpc80svlLW1+KqVJ645Y8+ Iu4zIeG3oWph4drYEkAXsFYVSWm4983APq/KMxnVh7ERgntSAkbc29IfVLFFaHdt0NI4 7hHshECAhy+BfycNuG6kYvMRyXEwXYorHNY9JcpRk2CIl6bg9q0lqlcX2Hf+0QecHVIa dJfz4LyDpQccvtzeDs3UFLjgdhEwU+XICwaPZXJX3QeXtajFWIh1ohFz1ptI2Jge0iLW siIw== X-Gm-Message-State: AA6/9RluePM/ke+OkgrN1IUOLOPUq5zB3SbjvavUF+72hhSNxThl/ahE/d54L6r4P+fMXw== X-Received: by 10.99.129.65 with SMTP id t62mr1005470pgd.114.1476800849675; Tue, 18 Oct 2016 07:27:29 -0700 (PDT) Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id ah5sm56715134pad.30.2016.10.18.07.27.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Oct 2016 07:27:29 -0700 (PDT) From: Tino Calancha To: bug-gnu-emacs@gnu.org Subject: 25.1.50; vc-region-history may exceed max line number of file in repository Date: Tue, 18 Oct 2016 23:27:19 +0900 Message-ID: <87y41llol4.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) emacs -Q lisp/vc/vc.el C-x h M-x vc-region-history RET fatal: file vc.el has only 2921 lines ;; vc.el has 2922 lines but Git ignores the last empty line. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From 12a6fc588fe60ebf98443a0fd068fe77d63bd17e Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Tue, 18 Oct 2016 23:20:07 +0900 Subject: [PATCH] vc-region-history: Do not exceed the file maximum line number The last empty line in a file is not part of the Git repository. * lisp/vc/vc.el (vc-region-history): Exclude the last empty line from the region (Bug#24724). --- lisp/vc/vc-git.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 9eac5b2..762f6af 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1016,6 +1016,8 @@ vc-git-region-history ;; FIXME: Maybe this should be done in vc.el (i.e. for all backends), but ;; since Git is the only backend to support this operation so far, it's hard ;; to tell. + (when (> lto (1- (line-number-at-pos (point-max)))) + (setq lto (1- (line-number-at-pos (point-max))))) (with-temp-buffer (vc-call-backend 'git 'diff file "HEAD" nil (current-buffer)) (goto-char (point-min)) -- 2.9.3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.1) of 2016-10-13 built on calancha-pc Repository revision: baa8ba4ed471d7fe4bb07c80a9dd16c4712525b4 ------------=_1476960361-21819-1--