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

Running recursively in an svn repo directory corrupts the repository #48

Closed
lepht opened this issue May 1, 2014 · 7 comments
Closed

Comments

@lepht
Copy link

lepht commented May 1, 2014

After running image_optim in -r recursive mode inside of a subversion directory, svn is unable to commit changes, failing with the error "Working copy text base is corrupt". Re-checking out the repository and running image_optim recursively using shell globbing instead doesn't have this issue (eg image_optim **/*.png)

In verbose mode with -r, you can see image_optim modifying files inside of the .svn directories, which is what is probably causing issues. A similar issue may exist for git repos (?)

@toy
Copy link
Owner

toy commented May 1, 2014

Thanks for reporting, so #35 should be without question mark.

svn co https://github.com/toy/image_optim/trunk image_optim_svn
find image_optim_svn/**/.svn -type f -exec file {} \; | grep image

Though it is not an issue for git repos as objects are packed (find .git -type f -exec file {} \; | grep image in gem git repo returns nothing).

@lepht
Copy link
Author

lepht commented May 2, 2014

Thanks for the quick response!

I think the ideal solution would be to exclude /\.(svn|git|hg|cvs)$/ dirs by default (to avoid this bug) as there's probably never a time when corruption of the repo is intended. In the case of .git even if it doesn't harm the repo, it's still a waste of time to loop through the files in the directory.

For #35 it would be nice (and more flexible) to implement a --ignore PATTERN and/or --ignore-dir NAME argument so users can specify what other directories should be skipped.

@toy
Copy link
Owner

toy commented May 2, 2014

I was thinking about disabling recursion into any dot dirs by default and adding option to allow recursion into them.

@lepht
Copy link
Author

lepht commented May 2, 2014

I suppose it fixes my issue either way ;) ignore-vcs-by-default but allow custom excludes is nice in that it's a convention used in various other popular tools like code searchers ack, and ag, and editors like sublime text and textmate.

@toy
Copy link
Owner

toy commented May 6, 2014

There is a difference in how or what those tools do to files — unlike all tools you've listed, image_optim will change files without asking, text search tools should never change anything and text editors will change files only when requested.

@lepht
Copy link
Author

lepht commented May 6, 2014

The point is that there's an established convention for dealing with source control subdirectories intelligently, and by following the convention you're less likely to surprise the user. In addition, regardless of convention you should never do unexpected destructive processes (like corrupting VCS repositories) -- by following the convention established by other tools (ignore VCS dirs by default, allow custom ignore filters) you serve both needs (no surprises, no surprise destruction)

@toy
Copy link
Owner

toy commented Sep 1, 2014

@lepht What do you think about referenced commit?

@toy toy closed this as completed in e6c937a Sep 4, 2014
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

2 participants