From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#38615: 27.0.50; vc-git: Wrong status in vc-dir after registering directory Date: Mon, 16 Dec 2019 03:25:00 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------C27F4E1D79B8B85B6A032C6C" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="182869"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 To: Andrii Kolomoiets , 38615@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 16 02:26:10 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1igf9G-000lNl-7q for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Dec 2019 02:26:10 +0100 Original-Received: from localhost ([::1]:45220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igf9E-0007fc-Vg for geb-bug-gnu-emacs@m.gmane.org; Sun, 15 Dec 2019 20:26:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48992) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igf99-0007fV-3T for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2019 20:26:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igf98-0002lz-2h for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2019 20:26:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59801) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igf97-0002lm-Uf for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2019 20:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1igf97-00054J-On for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2019 20:26:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Dec 2019 01:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38615 X-GNU-PR-Package: emacs Original-Received: via spool by 38615-submit@debbugs.gnu.org id=B38615.157645951119357 (code B ref 38615); Mon, 16 Dec 2019 01:26:01 +0000 Original-Received: (at 38615) by debbugs.gnu.org; 16 Dec 2019 01:25:11 +0000 Original-Received: from localhost ([127.0.0.1]:37541 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1igf8J-000529-1g for submit@debbugs.gnu.org; Sun, 15 Dec 2019 20:25:11 -0500 Original-Received: from mail-wm1-f47.google.com ([209.85.128.47]:40619) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1igf8G-00051l-Ix for 38615@debbugs.gnu.org; Sun, 15 Dec 2019 20:25:09 -0500 Original-Received: by mail-wm1-f47.google.com with SMTP id t14so4908694wmi.5 for <38615@debbugs.gnu.org>; Sun, 15 Dec 2019 17:25:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=cN2JCPKUix5XcSo22fNYOlxnglEHEPOyvsMg2G/WCuI=; b=mRA81YA1e9H3Us8+TfFqgxz2vGe15jeLQ26Zd4lxbZ009Dpg4Ygk60cfJFEkAQ6X/R AtklejZ6X9UUaEKJjCIAPOatE8cxkhvIjrKYsYN30on4AmPulbzKn9Z4x0OILZLP04sT gYZRUBNr9JaTVjZSB/FoAOv5WX/eAC5Vbi7Wk2TgR8HMJmq4X8lrXLK+cMOEXQF/XiVg WGPY5OiyENn1MvitvyZZvKqPMGLy8/21T7DJdFCWkqoCVLdpLlyHqb8KAEFKKorq1bAM 1qD6OJUEsM77ouN6OCW9tePxO+DY/Tw61D/WnB4L6dF6ENaPj+UzeGKV42mfs9a1n/NH mPBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=cN2JCPKUix5XcSo22fNYOlxnglEHEPOyvsMg2G/WCuI=; b=WBQ4NlBEgkqGQRbCzJ7elgc8+Nazlj4mkPsOUJWG3LlymEHCw+DejHyttz401g5SD/ WBAR/pAExcprcGCMTrdmFLttJCpX89JNs32Oaw5iIl4cTdt6ENax5auLdkLDUOXeLJ/g Psacdg8+11Kc605R7mkUIFLSGST7xvTTVlR0ZG6s2Me0rMlA/Pbls6qjWqygwTed0Tsj 4mGIQhtnPW5tzkuGabsIMgCJQPBrmJ7AmGKAV8rJPDlxzvUdlkuHp4C+WPyTeoYZJKCA mJfAt5ZztLIDE2dWMyqjM6ESYZBiAEQhDIbkPwjLGZmPt1y8vhUsmjohhkj1jmPot7+3 XzGA== X-Gm-Message-State: APjAAAWsutAKPjTpDB2O+zmQsuyKl86pp8WriE9R6c/8MxU0c9F0oPRo 3nOfJBfinvVvyNwRJtTWRGOfDCrYPes= X-Google-Smtp-Source: APXvYqzmZLRHFmUE4HcI5T0qGqxrrcttrJdIHUYwwPlbn9sLJ+dnYYHarXUf8vCxUYXfp+/y5jla1Q== X-Received: by 2002:a1c:8095:: with SMTP id b143mr28253106wmd.7.1576459502302; Sun, 15 Dec 2019 17:25:02 -0800 (PST) Original-Received: from [192.168.0.5] ([212.50.117.215]) by smtp.googlemail.com with ESMTPSA id s1sm19387959wmc.23.2019.12.15.17.25.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Dec 2019 17:25:01 -0800 (PST) In-Reply-To: Content-Language: en-US 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: 209.51.188.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:173409 Archived-At: This is a multi-part message in MIME format. --------------C27F4E1D79B8B85B6A032C6C Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi Andrii, On 14.12.2019 14:41, Andrii Kolomoiets wrote: > 0. mkdir test && cd test > git init > touch file > git add file > git commit -m "initial" > mkdir dir > touch dir/file1 > 1. emacs -Q > 2. C-x v d > "dir/" is listed with "unregistered" status. > 3. v > "dir/" has "added" status. > 4. g > "dir/file1" is listed with "up-to-date" status. Shouldn't it have > "added" status? > 5. g > Now "dir/file1" properly has "added" status. > > Also: > - After step 3 point is moved to word "dir" on second line. > - Press "n" before step 3 to move point to "dir/". After step 3 "dir/" > status is not updated and remains "unregistered". Thanks for the repro. This problem seems to have been with us for a while. vc-git's dir-status-files code is a bit hard to follow, but here's a patch you can try. I'll commit it in the next few days if nothing comes up. --------------C27F4E1D79B8B85B6A032C6C Content-Type: text/x-patch; name="vc-git-dir-status-files+added.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="vc-git-dir-status-files+added.diff" diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 71307cdffd..9e02a820ac 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -521,14 +521,17 @@ vc-git-after-dir-status-stage ('ls-files-up-to-date (setq next-stage 'ls-files-unknown) (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} \\([0-3]\\)\t\\([^\0]+\\)\0" nil t) - (let ((perm (string-to-number (match-string 1) 8)) - (state (match-string 2)) - (name (match-string 3))) - (vc-git-dir-status-update-file - git-state name (if (equal state "0") - 'up-to-date - 'conflict) - (vc-git-create-extra-fileinfo perm perm))))) + (let* ((perm (string-to-number (match-string 1) 8)) + (state (match-string 2)) + (name (match-string 3)) + (file-info (vc-git-create-extra-fileinfo perm perm))) + (if (equal state "0") + (unless (gethash name (vc-git-dir-status-state->hash git-state)) + ;; `diff-index' has not produced a more precise info. + (vc-git-dir-status-update-file + git-state name 'up-to-date file-info)) + (vc-git-dir-status-update-file + git-state name 'conflict file-info))))) ('ls-files-conflict (setq next-stage 'ls-files-unknown) ;; It's enough to look for "3" to notice a conflict. --------------C27F4E1D79B8B85B6A032C6C--