Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364471 - Staging view -> Replace with File in Git Index replaces file but shows diff still
Summary: Staging view -> Replace with File in Git Index replaces file but shows diff s...
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 1.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-22 09:57 EST by Brad Cupit CLA
Modified: 2012-01-09 10:08 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brad Cupit CLA 2011-11-22 09:57:32 EST
Build Identifier: 201110171000

When replacing a file in the staging view sometimes the contents are replaced (which is what I expect) but the file still shows in the Unstaged Changes pane (not what I expect). When I diff the file, there are no changes. Once this happens I can go to the command line and 'git status' shows the file as modified, but 'git diff' shows no changes (meaning, git agrees with EGit).

This only happens occasionally, and I haven't found a reliable way to reproduce 100% of the time.

Reproducible: Sometimes

Steps to Reproduce:
1. in the staging view, right click a file in the Unstaged Changes
2. choose 'Replace with File in Git Index'
3. sometimes the file stays in Unstaged Changes. If I double-click the entry in Unstaged Changes (to see the diff) there are no differences.
Comment 1 Matthias Sohn CLA 2011-11-25 18:18:27 EST
Could you check for changes in line endings ?
What's your setting for core.autocrlf ?
Comment 2 Brad Cupit CLA 2011-11-28 08:00:35 EST
(In reply to comment #1)
> Could you check for changes in line endings ?
> What's your setting for core.autocrlf ?

That's a really good idea. My ~/.gitconfig has autocrlf set to false.
I'll check that out the next time I reproduce it.

Also, I've never seen this in 1.0. It seemed to first occur in egit 1.1
Comment 3 Brad Cupit CLA 2011-12-14 12:00:54 EST
ok I can finally consistently reproduce this.

note: I have core.autocrlf set to false

To reproduce:
1. make a change to a Java or Groovy file
2. run the Eclipse code formatter
3. stage the file
4. unstage the file
5. right click on it in the Git Staging view -> Replace with File in Git Index

The contents will have been replaced but the file still shows up in the `Unstaged changes` panel. Running `git status` from the command line also shows the file as being modified though the diff is empty.

I have Eclipse setup to format my code each save, so I may see this bug in the following use case:
1. make a bunch of changes (formatter is run on each save)
2. stage all of the files
3. unstage the one file I don't want to commit
4. replace that file with the one in the git index
5. see the bug
Comment 4 Kevin Sawicki CLA 2012-01-05 19:48:27 EST
Hi,

Do you still see this issue in 1.2?

There were fixes both checkout and the staging view that may have fixed this issue.
Comment 5 Brad Cupit CLA 2012-01-09 10:08:49 EST
fixed in 1.2!

Thank you!!