On 2020-08-13 18:06:22-0700, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Đoàn Trần Công Danh <congdanhqx@xxxxxxxxx> writes: > > > Let me list some combination here: > > > > * none of --abbrev --no-abbrev --full-index -> default short index > > * --abbrev --full-index -> full-index > > * --full-index --abbrev -> full-index > > * --abbrev --no-abbrev -> full-index > > * --no-abbrev --abbrev=[n] -> shortened index to n char > > > > So, we can't use full_index bit, because --no-abbrev can be defeated > > by --abbrev, but --full-index will always win --abbrev. > > Sure, I wasn't suggesting to flip the flags.full_index bit upon > seeing "--no-abbrev". When --no-abbrev is in effect (i.e. the last > one among --no-abbrev, --abbrev, or --abbrev=n), .abbrev field is > set to 0. So wouldn't it be sufficient to say > > - If flags.full_index bit is set, show the full object name > > - If abbrev is 0, show the full object name > > - All other cases, after clamping the value of abbrev to reasonable > value, truncat the object name to that length > > What am I missing? No, you didn't miss anything. It's obviously me, who screwed up the logical thinking. Originally, I come up with something along the line in 2/2: int abbrev = o->flags.full_index ? hexsz : DEFAULT_ABBREV; if (!o->abbrev) abbrev = o->abbrev; I couldn't recalled what I wrote, but that logic requires 1/2, after I come up with 1/2, I re-analysed 2/2 and come up with current logic. I failed to re-visit 1/2 to check if it's necessary. It's all MY fault. Sorry for wasting everyone's time in 1/2. Please eject 1/2 from this series. -- Thanks Danh