From: Junio C Hamano Date: Fri, 14 Aug 2020 01:06:22 GMT Subject: Re: [PATCH v3 1/2] revision: differentiate if --no-abbrev asked explicitly Message-ID: In-Reply-To: <20200814005947.GA9518@danh.dev> Đoàn Trần Công Danh 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? > I'm planning for: > > * BOTH --abbrev and --no-abbrev but NOT --full-index; > * BOTH --abbrev AND --full-index