Replacing a file and correct git handling

Hi,

When I delete a file and replace it with another file with the same name in PhpStorm (98.191 EAP) I do not get the expected behavior: after commit the added files are deleted!
When I manually use git I get the expected behavior: commit is done and new file is seen as a change to the old one. After this manual commit and syncing PhpStorm still tries to do a commit to delete the file. This is only fixed after I restart PhpStorm.

Could you please let me know if this behavior is intentional and if it is how one would go about replacing a file in PhpStorm under Git version control.

Best,

Dirk Louwers

12 comments

Hi Dirk,

I couldn't reproduce your problem at once, so let me clarify your steps.
1. Remote a file (say "a.txt") via IDEA.
2. Create a new file with the same name "a.txt" and some other content.
3. Add the file to Git? - do you add the newly created file to git or you leave it unversioned? Note that if you don't add the file, then only deletion will be committed.
4. Commit all changes.
File a.txt gets deleted from disk.

Is it correct?

0

Hi,

Let me clarify the steps:

1. Open a directory of a project under Git version control
2. Delete a file from the IDE project view
3. Drag a file with the same name back to the IDE into the same folder as you deleted the first file
4. Now the file is marked in gray and will be deleted on the next commit

Hope you will be able to reproduce this.

Best,

Dirk Louwers

0

When you drag the file to IDEA Git should ask whether you want to add the file to Git version control (see the screenshot).
Does it ask you? What do you answer?

Снимок экрана 2010-10-26 в 16.51.29.png

0

Hi,

No it does not ask me. When dragging the file to the IDE it does prompt my to add files to Git but shows "No differences". See attached screenshot.

Best,

Dirk Louwers

confirm.png

0

And after you delete the file from IDEA Project View, does it show as Deleted (grey) in the Changes View?

0

Hi,

Yes it does show up both in the bottom changes/local pane as well as in the commit as a staged delete. It just doesn't prompt to add the file when dragged back. It does if I drag to desktop, restart the IDE and then drag back but not without the restart.

Best,

Dirk Louwers

0

Dirk, strangely I can't reproduce this issue. :(

Could you be so kind to make a screencast to see what's happening?
Maybe I'm trying something wrong.

Btw, here's a screencast with my actions: http://www.screencast.com/t/Wnt0BQlD2m

(You can screencast by using free Jing (http://www.techsmith.com/jing/) and upload to screencast.com, which is also free.)

0

Hi,

Neither can I if I try it on a fresh environment like you've done.
On my existant environment the system doesn't prompt if I want to add the re-added file to Git. Instead it shows an empty list of changes like the screenshot I sent earlier.
Hard to see what's causing this in my specific environment.

Best,

Dirk Louwers

0

Dirk,

could you please try to re-create IDEA project on these problematic sources and check if the error goes away?
(of course don't forget to backup)

Also could you please attach the content of your .idea folder here, and also .git/config

Thanks

0

Hi,

Could you please provide me with an e-mail address I can send it to, in case it contains sensitive information my employer does not like to publish on the internet?

Best,

Dirk Louwers

0

Hi,

I have done a clean checkout and created a project over it (open directory). Now it behaves as expected: moving files out of the project view to desktop and back cause no change (file shown in black). It also works fine when I delete it and move a copy back in. I then get asked if I want to add it to git. However when I modify a file and then move it out of the project view to my desktop the trouble starts. Moving it back to the project view marks it as deleted without asing me if I want to add it or just marking it as changed like it was before.

Best,

Dirk Louwers

0

Please sign in to leave a comment.