On Mon, Mar 11, 2019 at 1:20 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes: > > >> case 2: > >> + if (last == '.') { /* Refname contains "..". */ > >> + if (sanitized) > >> + sanitized->len--; /* collapse ".." to single "." */ > > > > I think this needs to be: > > > > strbuf_setlen(sanitized, sanitized->len - 1); > > > > to ensure that NUL-terminator ends up in the correct place if this "." > > is the very last character in 'refname'. (Otherwise, the NUL will > > remain after the second ".", thus ".." won't be collapsed to "." at > > all.) > > True. Why doesn't it do the similar "replace with -" it does for > other unfortunate characters, though? > I think Jeff saw an opportunity to keep it cleaner ("." looks better than ".-") and took it. -- Duy