From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: mathias@mnet-mail.de Newsgroups: gmane.emacs.devel Subject: Re: C-x v u for added files in vc-git Date: Thu, 03 Dec 2009 13:15:14 +0100 Message-ID: <20091203131514.cq73r2k3cwso8sow@webmail.mnet-online.de> References: <200912030606.nB366cKS021507@godzilla.ics.uci.edu> <20091203090205.8k74zmgqe8ko8k8o@webmail.mnet-online.de> <200912030909.nB3993lF022865@godzilla.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1259843018 15736 80.91.229.12 (3 Dec 2009 12:23:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Dec 2009 12:23:38 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 03 13:23:31 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NGAiY-0003MO-Vx for ged-emacs-devel@m.gmane.org; Thu, 03 Dec 2009 13:23:31 +0100 Original-Received: from localhost ([127.0.0.1]:41599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGAiY-0006tP-FR for ged-emacs-devel@m.gmane.org; Thu, 03 Dec 2009 07:23:30 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGAag-00017m-Vn for emacs-devel@gnu.org; Thu, 03 Dec 2009 07:15:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGAac-00015V-VH for emacs-devel@gnu.org; Thu, 03 Dec 2009 07:15:22 -0500 Original-Received: from [199.232.76.173] (port=34262 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGAac-00015H-Et for emacs-devel@gnu.org; Thu, 03 Dec 2009 07:15:18 -0500 Original-Received: from mail-out.m-online.net ([212.18.0.9]:39979) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NGAac-0007j2-05 for emacs-devel@gnu.org; Thu, 03 Dec 2009 07:15:18 -0500 Original-Received: from mail01.m-online.net (mail.m-online.net [192.168.3.149]) by mail-out.m-online.net (Postfix) with ESMTP id 1E54E1C15F2A; Thu, 3 Dec 2009 13:15:15 +0100 (CET) Original-Received: from localhost (dynscan2.mnet-online.de [192.168.1.215]) by mail.m-online.net (Postfix) with ESMTP id B501A904B5; Thu, 3 Dec 2009 13:15:15 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Original-Received: from mail.mnet-online.de ([192.168.3.149]) by localhost (dynscan2.mnet-online.de [192.168.1.215]) (amavisd-new, port 10024) with ESMTP id uJ87JBH9vq4e; Thu, 3 Dec 2009 13:15:14 +0100 (CET) X-Auth-Info: 9Yvr2kxf11CkloJjQhcF4JnOhgPNtWsoKNMfK67JkQU= Original-Received: from webmail.mnet-online.de (webmail.mnet-online.de [212.18.5.49]) by mail.mnet-online.de (Postfix) with ESMTP; Thu, 3 Dec 2009 13:15:14 +0100 (CET) Original-Received: from host-62-245-234-168.customer.m-online.net (host-62-245-234-168.customer.m-online.net [62.245.234.168]) by webmail.mnet-online.de (Horde MIME library) with HTTP; Thu, 03 Dec 2009 13:15:14 +0100 In-Reply-To: <200912030909.nB3993lF022865@godzilla.ics.uci.edu> Content-Disposition: inline User-Agent: Internet Messaging Program (IMP) H3 (4.1.5) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:118176 Archived-At: Zitat von Dan Nicolaescu : > mathias@mnet-mail.de writes: > > > Zitat von Dan Nicolaescu : > > > > > In a git tree doing: > > > > > > C-x C-f BLAH_BLAH RET > > > RET > > > C-x v v > > > > > > will put the BLAH_BLAH in the 'added state > > > > > > Doing a C-x v u > > > after that should return it to the 'unregistered state, but that doe= s > > > not happen the file stays in the 'added state. > > > > > > This is because vc-git-revert runs: > > > (vc-git-command nil 0 file "checkout" "HEAD") > > > > > > What should vc-git-revert do that it works in the above case too? > > > > git rm --cached > > > > removes the file from the index, i.e. reverts the 'add' command. > > Does it also restore the file contents in the case where the file is > registered and it has been changed ? (that's another use for the > function in question). 'git add ' not only registers the file as 'cvs add ' does. It also adds the content of the file to the index. 'git rm --cached ' removes the content from the index and doesn't touch the file. I think there are 3 cases here: 1. If you have mistakenly added a new file with 'git add' that should not be under version control then 'git rm --cached is already in the repository. If you have changed it and added to the index but don't want to commit this change now, then again 'git rm --cached will still be in your worktree in the modified state. 3. is already in the repository. If you have changed it and want reve= rt this change. In this case 'git checkout HEAD ' restores the conten= t to that of the last commit. 'git checkout' also updates the index. It didn't update the index in your case because the file wasn't in HEAD. I think C-x v u should do 1. and 2. but not 3. because 3. deletes data. Mathias