From: Matthieu Moy Date: Thu, 08 Oct 2015 18:26:17 GMT Subject: Re: [PATCH v2 00/10] port branch.c to use ref-filter's printing options Message-ID: In-Reply-To: Karthik Nayak writes: > On Thu, Oct 8, 2015 at 10:40 PM, Matthieu Moy > wrote: > >> This particular piece of code is so important and I won't fight for a >> better factored one, but in general "there are only two instances" is a >> dubious argument to avoid refactoring. >> >> Still, I find it weird to force the nobracket to be always at the same >> position. >> > > No i mean I could follow up with the way we use it in align, but I don't see > how I can make a function out of this. Ah, OK. Well, there are already two instances of /* Strip trailing comma */ if (s[1]) strbuf_setlen(s[0], s[0]->len - 1); (for objectname and align), one of which says /* * TODO: Implement a function similar to strbuf_split_str() * which would omit the separator from the end of each value. */ I guess it's time to replace this TODO with actual code. A straightforward implementation would be to call strbuf_split_str and then use the same "if (s[1])" as you already have. There's probably a more efficient way. -- Matthieu Moy http://www-verimag.imag.fr/~moy/