Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete file from index SHOULD NOT delete file on FTP #17

Open
Janghou opened this issue Jan 26, 2011 · 10 comments
Open

Delete file from index SHOULD NOT delete file on FTP #17

Janghou opened this issue Jan 26, 2011 · 10 comments

Comments

@Janghou
Copy link

Janghou commented Jan 26, 2011

I removed a file from the index
git rm --cached file
and it was deleted on FTP, while it shouldn't.

--cache
Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone.

@kbjr
Copy link

kbjr commented Jan 26, 2011

i disagree. git rm --cached removed a file from the index. the remote files on your ftp server are a copy of the index, not your local directory. so it's doing exactly what it should be.

@Janghou
Copy link
Author

Janghou commented Jan 26, 2011

Remote files aren't necessarily a copy of the index. There can be uploaded files by the user, or explicitly remotely changed files (config, htaccess)
Therefore I would see the FTP as a kind of a remote working tree.

Consider this use-case:
.htaccess was included by accident.
But it should be ignored. How can we correct that?

Adding it to .gitignore doesn't help when it's already tracked.
You have to remove it from the index to have it untracked, but IMHO it shouldn't be deleted on FTP.

Dunno if python-git can see the difference between a removed file and index-removed only file, that leaves working tree files alone.

@Janghou
Copy link
Author

Janghou commented Jan 26, 2011

Closed it by accident, can't see a way to reopen it.

@kbjr
Copy link

kbjr commented Jan 26, 2011

perhaps an option could be added to the config file or some form of git-ftp only .gitignore file.

@ezyang
Copy link
Owner

ezyang commented Jan 26, 2011

We should be diffing against HEAD, which is not the index, so this is pretty mysterious. I'll take a look.

@ezyang
Copy link
Owner

ezyang commented Jan 26, 2011

I can't reproduce, so I'll need explicit instructions.

W.r.t. to not uploading certain files, sure, that's a reasonable feature request. Please open another issue?

@Janghou
Copy link
Author

Janghou commented Jan 27, 2011

I will look it to it later, and see if I can make a reproducible example.

@Janghou
Copy link
Author

Janghou commented Jan 31, 2011

Can easily reproduce. Create a repository with 2 files, add one to ignorelist, remove it from cache, it will be deleted on FTP.

By maybe that's default operation, because it's removed from the repository, and git rm --cache is only a local command to leave it in local working directory.

I don't know if the repository (HEAD, index) has any clue if a a git rm file or git rm --cache file command has been given.
If not there isn't much we can do, and my problem wasn't an issue but a lack of knowledge about git.

@ezyang
Copy link
Owner

ezyang commented Jan 31, 2011

It's still difficult to parse what you're saying. Can you write down the precise commands you are using?

@Janghou
Copy link
Author

Janghou commented Feb 17, 2011

Sorry, a bit late.

1 create new dir html with 2 files index.php and .htaccess
2 cd ..
git clone --bare html html.git
3 scp -r html.git server:/home/git-reps
4 mv html html_bu
5 git clone server:/home/git-reps/html.git
6 rm -rf html_bu
7 set ftp data in:
server:/home/git-reps/html/ftpdata
8 git push, everything will be ftp'd to ftpserver

I need a different .htaccess locally then on the ftp server.
Of course changing .htaccess will change .htacces on ftp-server.
So I want to stop tracking .htaccess: I add it to .gitignore
Changes to .htaccess will still be tracked cause it's still in the index.
So i remove it from the index: git rm --cached .htaccess
Now .htaccess is also removed from the ftp-server next push, while I think it shouldn't, at least i don't want it to happen. ;)

But I don't know if the index, or to be specific the post-update hook can make a difference between a git rm and a git rm --cache command after it's pushed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants