From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master b5b0e05: Call `smerge-start-session' even when dealing with a stash conflict Date: Mon, 20 Apr 2015 11:25:34 -0400 Message-ID: References: <20150419192734.3632.17817@vcs.savannah.gnu.org> <5534FB9D.4070502@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1429543618 26470 80.91.229.3 (20 Apr 2015 15:26:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Apr 2015 15:26:58 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 20 17:26:37 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YkDal-0003TG-TH for ged-emacs-devel@m.gmane.org; Mon, 20 Apr 2015 17:26:36 +0200 Original-Received: from localhost ([::1]:54167 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkDal-00006O-5e for ged-emacs-devel@m.gmane.org; Mon, 20 Apr 2015 11:26:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkDaR-00005q-Eu for emacs-devel@gnu.org; Mon, 20 Apr 2015 11:26:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YkDaO-0002vW-2L for emacs-devel@gnu.org; Mon, 20 Apr 2015 11:26:15 -0400 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]:47891) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkDaN-0002v8-Ma for emacs-devel@gnu.org; Mon, 20 Apr 2015 11:26:11 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 7D8F585FBB; Mon, 20 Apr 2015 11:26:04 -0400 (EDT) Original-Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 45CDB1E5B94; Mon, 20 Apr 2015 11:25:35 -0400 (EDT) Original-Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 0B825B40DC; Mon, 20 Apr 2015 11:25:34 -0400 (EDT) In-Reply-To: <5534FB9D.4070502@yandex.ru> (Dmitry Gutov's message of "Mon, 20 Apr 2015 16:14:05 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 132.204.24.67 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:185715 Archived-At: >> Better would be for vc-git-resolve-when-done to check the status of the >> file and only `git add' it if it doesn't have anything staged yet. So, >> it would still work as before in the case where there was nothing staged >> before the "stash pop". > Hmm, it seem I can't really detect whether the file had something staged > (whether the conflict is due to that, or some new commits, 'git > diff --cached', for instance, only says '* Unmerged path test2'). "git status --porcelain " gives me: "M " for a file with staged changes " M " for a modified file with no staged changes, and "MM " for a modified file with both staged and unstaged changes. So I think that looking for "\\`M" in the output of "git status --porcelain" should work. Of course, what I'm proposing would still add the file to the staging area, even if the user did not originally intend to do so, but at least there's no serious loss of information (the only loss of information is "which files(s)'s changes were already staged and which weren't"). > Guess I'm not enough of an aficionado, then. After plenty of searching and > reading the man pages, 'git add' followed by 'git reset' is the best I have. Well, if you're not afraid of getting gross, you could do something along the lines of: unstaged=$(git diff -- ) git add echo "$unstaged" | patch -R -p1 git add echo "$unstaged" | patch -p1 -- Stefan