Its all about Ruby On Rails
Archive for April, 2008
Git Error: trailing whitespace, indent SP followed by a TAB, unresolved merge conflict
Apr 23rd
I have been using Git from last few days, and faced following errors while committing:
1) Trailing whitespace
2) Indent SP followed by a TAB
3) Unresolved merge conflict
The first error “Trailing whitespace” is because of carriage-return/line-feed(windows style line feed/end). To resolve this problem comment following lines(58-60) in .git/hooks/pre-commit file:
if (/\s$/) {
bad_line("trailing whitespace", $_);
}
The second one “Indent SP followed by a TAB” is because of leading spaces/tabs. To resolve this problem comment following lines(61-63) in .git/hooks/pre-commit file:
if (/^\s* /) {
bad_line("indent SP followed by a TAB", $_);
}
The third one “Unresolved merge conflict” is because of seven or more successive occurrence of = or < or > characters. Major chances of having seven = character in README or doc files. To resolve this problem replace following line(64) in .git/hooks/pre-commit file:
if (/^(?:[<>=]){7}/) {
by
if (/^(?:[<>=]){7}$/) {
These tricks worked for me, I hope it could help you.
Rails Plugin Annotate Models For Spec And Spec Fixtures
Apr 23rd
I have been using “Annotate Models” rails plugin written by Dave Thomas since I found it around one and half year ago. It really helps while writing fixtures. But if you use RSpec you might miss schema info at the top of your rspec fixture file as I do. So, today I modify the plugin file so that it prepends schema info to spec file and fixture file. Below are the links of patch file:
svn patch to add schema info to spec file and spec fixture file