Re: [PATCH 0/9] new git check-ignore sub-command
Adam Spiers writes: > On Sun, Sep 2, 2012 at 9:35 PM, Junio C Hamano wrote: >> * avoid unnnecessary braces {} around single statement blocks, e.g. >> >> -if (exclude) { >> +if (exclude) >> return exclude; >> -} >> >> * else should follow close brace '}' of if clause, e.g. >> >> if (...) { >> ... >> -} >> -else { >> +} else { >> ... > > What about when the if clause requires braces but the else clause > doesn't? Should it be > > if (...) { > ...; > ...; > } else > ...; > > or > > if (...) { > ...; > ...; > } > else > ...; > > ? Neither. We try to do (but often fail ;-) if (...) { ...; ...; } else { ...; } following the kernel style, unless there is good reason not to. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/9] new git check-ignore sub-command
On Sun, Sep 2, 2012 at 9:35 PM, Junio C Hamano wrote: > * avoid unnnecessary braces {} around single statement blocks, e.g. > > -if (exclude) { > +if (exclude) > return exclude; > -} > > * else should follow close brace '}' of if clause, e.g. > > if (...) { > ... > -} > -else { > +} else { > ... What about when the if clause requires braces but the else clause doesn't? Should it be if (...) { ...; ...; } else ...; or if (...) { ...; ...; } else ...; ? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/9] new git check-ignore sub-command
On Sun, Sep 2, 2012 at 9:35 PM, Junio C Hamano wrote: > Adam Spiers writes: > >> I was browsing stackoverflow the other day and came across this question: >> >> >> http://stackoverflow.com/questions/12144633/which-gitignore-rule-is-ignoring-my-file/ >> >> A quick google revealed this thread from 2009: >> >> >> http://thread.gmane.org/gmane.comp.version-control.git/108671/focus=108815 >> >> where Junio and Jeff discussed the possibility of adding a new `git >> check-ignore' subcommand somewhat analogous to the existing `git >> check-attr', and suggested the beginnings of an implementation. It >> struck me that it might not be too hard to follow these ideas to their >> natural conclusion, so I decided it would make a fun project :-) > > Thanks. I wish there are more people like you ;-) Thanks ;-) > As to styles, I spotted only three kinds of "Huh?": > > * do not initialise statics to 0 or NULL, e.g. > > -static int exclude_args = 0; > +static int exclude_args; > > * avoid unnnecessary braces {} around single statement blocks, e.g. > > -if (exclude) { > +if (exclude) > return exclude; > -} > > * else should follow close brace '}' of if clause, e.g. > > if (...) { > ... > -} > -else { > +} else { > ... OK thanks, I will fix these and also submit a patch for CodingGuidelines. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/9] new git check-ignore sub-command
Adam Spiers writes: > I was browsing stackoverflow the other day and came across this question: > > > http://stackoverflow.com/questions/12144633/which-gitignore-rule-is-ignoring-my-file/ > > A quick google revealed this thread from 2009: > > http://thread.gmane.org/gmane.comp.version-control.git/108671/focus=108815 > > where Junio and Jeff discussed the possibility of adding a new `git > check-ignore' subcommand somewhat analogous to the existing `git > check-attr', and suggested the beginnings of an implementation. It > struck me that it might not be too hard to follow these ideas to their > natural conclusion, so I decided it would make a fun project :-) Thanks. I wish there are more people like you ;-) As to styles, I spotted only three kinds of "Huh?": * do not initialise statics to 0 or NULL, e.g. -static int exclude_args = 0; +static int exclude_args; * avoid unnnecessary braces {} around single statement blocks, e.g. -if (exclude) { +if (exclude) return exclude; -} * else should follow close brace '}' of if clause, e.g. if (...) { ... -} -else { +} else { ... For reviews on substance, please see other messages from me. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html