From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: C-x v u for added files in vc-git Date: Thu, 3 Dec 2009 10:22:35 -0800 (PST) Message-ID: <200912031822.nB3IMZt0027156@godzilla.ics.uci.edu> References: <200912030606.nB366cKS021507@godzilla.ics.uci.edu> <20091203090205.8k74zmgqe8ko8k8o@webmail.mnet-online.de> <200912030909.nB3993lF022865@godzilla.ics.uci.edu> <20091203131514.cq73r2k3cwso8sow@webmail.mnet-online.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259864697 25892 80.91.229.12 (3 Dec 2009 18:24:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Dec 2009 18:24:57 +0000 (UTC) Cc: emacs-devel@gnu.org To: mathias@mnet-mail.de Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 03 19:24:50 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 1NGGMD-0008Uy-Sw for ged-emacs-devel@m.gmane.org; Thu, 03 Dec 2009 19:24:50 +0100 Original-Received: from localhost ([127.0.0.1]:42319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGGMD-0004Vk-Hb for ged-emacs-devel@m.gmane.org; Thu, 03 Dec 2009 13:24:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGGLk-00049p-4R for emacs-devel@gnu.org; Thu, 03 Dec 2009 13:24:20 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGGLf-00044v-9F for emacs-devel@gnu.org; Thu, 03 Dec 2009 13:24:19 -0500 Original-Received: from [199.232.76.173] (port=53628 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGGLe-00044r-Vx for emacs-devel@gnu.org; Thu, 03 Dec 2009 13:24:15 -0500 Original-Received: from colin-baker-v0.ics.uci.edu ([128.195.1.153]:56723) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NGGLe-0003hI-Kj for emacs-devel@gnu.org; Thu, 03 Dec 2009 13:24:14 -0500 Original-Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101]) by colin-baker-v0.ics.uci.edu (8.13.8/8.13.8) with ESMTP id nB3IMaZM015061 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 3 Dec 2009 10:22:36 -0800 Original-Received: (from dann@localhost) by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id nB3IMZt0027156; Thu, 3 Dec 2009 10:22:35 -0800 (PST) In-Reply-To: <20091203131514.cq73r2k3cwso8sow@webmail.mnet-online.de> (mathias@mnet-mail.de's message of "Thu, 03 Dec 2009 13:15:14 +0100") Original-Lines: 64 X-ICS-MailScanner-Information: Please send mail to helpdesk@ics.uci.edu or more information X-ICS-MailScanner-ID: nB3IMaZM015061 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=0.561, required 5, autolearn=disabled, ALL_TRUSTED -1.44, GAPPY_SUBJECT 2.00) X-ICS-MailScanner-From: dann@godzilla.ics.uci.edu X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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:118194 Archived-At: mathias@mnet-mail.de writes: > 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 does > > > > 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 to undo it. > > 2. 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 revert > this change. In this case 'git checkout HEAD ' restores the content > 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. 3. is exactly the goal for the command, to get rid of unwanted changes! So it seems that if we do the sequence: git checkout HEAD git rm --cached that take care of all situations.