Re: [PATCH 2/1 alt] peel_onion: do not assume length of x_type globals

2013-09-03 Thread Junio C Hamano
Jeff King writes: > If you _really_ wanted to abstract it, you could make commit_type a > macro and use string concatenation along with prefixcmp. But that is > going in the direction of less readable, I think. :) ;-) we are on the same wave-length. Thanks, will apply. > > This has probably co

[PATCH 2/1 alt] peel_onion: do not assume length of x_type globals

2013-09-03 Thread Jeff King
When we are parsing "rev^{foo}", we check "foo" against the various global type strings, like "commit_type", "tree_type", etc. This is nicely abstracted, but then we destroy the abstraction completely by using magic numbers that must match the length of the type strings. We could avoid these magic