Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 344267

Summary: Git weirdness
Product: [ECD] Orion Reporter: Boris Bokowski <bokowski>
Component: ClientAssignee: Project Inbox <e4.orion-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: libingw
Version: 0.2   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Boris Bokowski CLA 2011-04-29 08:43:55 EDT
Here's what I did:

1. I had three unstaged changes showing in git-status.html.
2. Using the command line, I got rid of one of them: "git checkout - bundles/org.eclipse.orion.client.editor/web/samples/editor.css"
3. git status on the command line showed:
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   bundles/org.eclipse.orion.client.core/static/js/editorFeatures.js
#	modified:   bundles/org.eclipse.orion.client.core/web-ide.launch
#
4. I got rid of a second change: "git checkout - bundles/org.eclipse.orion.client.core/static/js/editorFeatures.js" 
5. I went back to git-status.html and refreshed the page.

Expected: just one unstaged change
Actual: one unstaged change as expected, but also a staged change for: bundles/org.eclipse.orion.client.core/static/js/editorFeatures.js.

I am seeing the same on the command line:

bokowski$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   bundles/org.eclipse.orion.client.core/static/js/editorFeatures.js
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   bundles/org.eclipse.orion.client.core/web-ide.launch
#


git diff --cached
diff --git a/bundles/org.eclipse.orion.client.core/static/js/editorFeatures.js b/bundles/org.eclipse.orion.client.core/static/js/editorFeatures
index 6002748..2516c72 100644
--- a/bundles/org.eclipse.orion.client.core/static/js/editorFeatures.js
+++ b/bundles/org.eclipse.orion.client.core/static/js/editorFeatures.js
@@ -1,9 +1,9 @@
 /*******************************************************************************
  * Copyright (c) 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials are made 
- * available under the terms of the Eclipse Public License v1.0 
- * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
- * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation

This last change is something I definitely did not do. It looks like it would undo the last change for that file.

Does anybody have an idea what is going on here?
Comment 1 Boris Bokowski CLA 2011-04-29 08:48:04 EDT
Found the problem. I need to do "git checkout -- <file>" (with two dashes). I am still confused why one dash would be accepted by git checkout, and why it gives me the described result.

But it's definitely a command line thing, I don't think Orion or JGit has anything to do with it.
Comment 2 libing wang CLA 2011-04-29 09:53:58 EDT
(In reply to comment #1)
> Found the problem. I need to do "git checkout -- <file>" (with two dashes). 
We need to support this in git status page . Created bug 344280 to address this.