From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#57400: 29.0.50; Support sending patches from VC directly Date: Thu, 13 Oct 2022 20:25:03 +0000 Message-ID: <87mt9zii8w.fsf@posteo.net> References: <84v8qgn1z9.fsf@iki.fi> <87h71zo3p8.fsf@posteo.net> <87sfljmgwz.fsf@posteo.net> <87y1twvima.fsf@posteo.net> <84sfk2p846.fsf@iki.fi> <87h70i9ntt.fsf@posteo.net> <87edvl6vbj.fsf@gmail.com> <8735c1nn3y.fsf@posteo.net> <877d1d6rcy.fsf@gmail.com> <867d1cjc8w.fsf@mail.linkov.net> <87o7unkggk.fsf@posteo.net> <86edvids93.fsf@mail.linkov.net> <87zge52nx0.fsf@posteo.net> <86sfjvqz68.fsf@mail.linkov.net> <87edvecg45.fsf@posteo.net> <86r0ze2ldb.fsf@mail.linkov.net> <871qrchzli.fsf@posteo.net> <86tu471vhq.fsf@mail.linkov.net> <875ygnjyp0.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17725"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Robert Pluim , 57400@debbugs.gnu.org, Antoine Kalmbach To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 13 22:26:43 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oj4mx-0004Qb-9J for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Oct 2022 22:26:43 +0200 Original-Received: from localhost ([::1]:56388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oj4mv-0002cA-PF for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Oct 2022 16:26:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oj4mI-0002YO-88 for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 16:26:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35981) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oj4mI-0000zi-03 for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 16:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oj4mH-0004cK-RH for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 16:26:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Oct 2022 20:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57400 X-GNU-PR-Package: emacs Original-Received: via spool by 57400-submit@debbugs.gnu.org id=B57400.166569271317682 (code B ref 57400); Thu, 13 Oct 2022 20:26:01 +0000 Original-Received: (at 57400) by debbugs.gnu.org; 13 Oct 2022 20:25:13 +0000 Original-Received: from localhost ([127.0.0.1]:35059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oj4lU-0004b7-JJ for submit@debbugs.gnu.org; Thu, 13 Oct 2022 16:25:12 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:52587) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oj4lS-0004as-E0 for 57400@debbugs.gnu.org; Thu, 13 Oct 2022 16:25:11 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id E3283240027 for <57400@debbugs.gnu.org>; Thu, 13 Oct 2022 22:25:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665692704; bh=gbsJoZqsov1Z/X76cUFGYcB6MQlAbgc4wilIS6foTxw=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=nTRlT3XpUS5q/i4nskWMuMlTUQMvxMS9CyohBi9TRhPr6ZGi0tOIHaZ8ShYoU4rPH /ssbEqqjdzD8Ta/lcD2XucgPIlg2Acn/nrKoXEKbES9wG9245ACkM/GB6c76O5aRfd HaEEw6ETEqS4p7BYo1x6pPzfLsUKLIfV4j1yNYZw/NDELwy3GGS3TK6q/2yc1gHjUR 8XuW1V2xxNX6e+f/D6NZYGgx6AdPH1oc1H1KmNM2otOuFfw/tkYVgcgwlSUyiuG0bd iawOLveCGEv9z3k0Gb1YSAWICdoT/uJ1+1rFq9YNzNQuuTDbZjq/Wyob6lKnO5lbEV ro03oG+dUF7dQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MpLc02wChz6tm4; Thu, 13 Oct 2022 22:25:04 +0200 (CEST) In-Reply-To: <875ygnjyp0.fsf@posteo.net> (Philip Kaludercic's message of "Thu, 13 Oct 2022 21:44:27 +0200") Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:245353 Archived-At: --=-=-= Content-Type: text/plain Philip Kaludercic writes: > Juri Linkov writes: > >>>>> I have done all of the above and am prepared to push the changes, but >>>>> before I do I was wondering if anyone would have any objections to the >>>>> following changes to vc-git.el: >>>> >>>> Indeed, abbreviated commits are more usable. But please wait a little >>>> for more comments. >>> >>> Also note that this change would also only affect working-revision and >>> previous-revision. If necessary or preferred, I could also modify the >>> changes to only affect working-revision. >> >> Nicer names would be better everywhere, including previous-revision. >> But: In my recent mail to RMS I raised questions about 'C-u C-x v ='. >> And when I tried your patch then the default value for "HEAD" >> often is very strange. For example, try to type 'C-u C-x v =' >> on the file lisp/paren.el. Here is what it shows: >> >> Older revision [remotes/origin/scratch/eglot2emacs~488]: >> >> I wonder where comes "eglot2emacs" from when the current branch is master? > > Hmm, it looks like Git tried to find a symbolic reference at any cost, > so it found some branch found a relative commit. I'll try and find out > if there is a way to avoid this, and only use symbolic references if > there is no positional offset. This patch should prevent these kinds things from happening: --=-=-= Content-Type: text/plain Content-Disposition: inline diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 5d564f3c94..47c9082368 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -2030,14 +2030,17 @@ vc-git--run-command-string (setq ok nil)))))) (and ok str))) -(defun vc-git-symbolic-commit (commit) +(defun vc-git-symbolic-commit (commit &optional force) "Translate COMMIT string into symbolic form. -Returns nil if not possible." +Returns nil if not possible. If the optional argument FORCE is +non-nil, revisions containing positional +arguments (e.g. \"master~8\") will also be accepted." (and commit (let ((name (with-temp-buffer (and (vc-git--out-ok "name-rev" "--name-only" commit) (goto-char (point-min)) + (or force (not (looking-at "^.*[~^].*$" t))) (= (forward-line 2) 1) (bolp) (buffer-substring-no-properties (point-min) --=-=-=--