git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 1/2] revision: differentiate if --no-abbrev asked explicitly

From
Đoàn Trần Công Danh <congdanhqx@gmail.com>
Date
Aug 14, 2020, 14:50 UTC
Message-ID
<20200814145043.GB9518@danh.dev>
In-Reply-To
<xmqqzh6yyr1t.fsf@gitster.c.googlers.com>
On 2020-08-13 18:06:22-0700, Junio C Hamano <gitster@pobox.com> wrote:
Show 26 quoted lines
> Đoàn Trần Công Danh  <congdanhqx@gmail.com> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 22 of 41 in “extend --abbrev support to diff-patch format”
  1. 0/2 extend --abbrev support to diff-patch formatĐoàn Trần Công Danh, Aug 9, 2020
  2. 1/2 revision: differentiate if --no-abbrev asked explicitlyĐoàn Trần Công Danh, Aug 9, 2020
  3. 2/2 diff: extend --abbrev support to diff-patch formatĐoàn Trần Công Danh, Aug 9, 2020
  4. Junio C HamanoAug 9, 2020
  5. Jeff KingAug 10, 2020
  6. Đoàn Trần Công DanhAug 10, 2020
  7. Junio C HamanoAug 10, 2020
  8. Jeff KingAug 10, 2020
  9. Đoàn Trần Công DanhAug 11, 2020
  10. Jeff KingAug 11, 2020
  11. Đoàn Trần Công DanhAug 11, 2020
  12. Junio C HamanoAug 10, 2020
  13. 0/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 11, 2020
  14. 1/2 revision: differentiate if --no-abbrev asked explicitlyĐoàn Trần Công Danh, Aug 11, 2020
  15. Junio C HamanoAug 11, 2020
  16. 2/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 11, 2020
  17. 0/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 14, 2020
  18. 1/2 revision: differentiate if --no-abbrev asked explicitlyĐoàn Trần Công Danh, Aug 14, 2020
  19. Junio C HamanoAug 14, 2020
  20. Đoàn Trần Công DanhAug 14, 2020
  21. Junio C HamanoAug 14, 2020
  22. Đoàn Trần Công DanhAug 14, 2020
  23. Junio C HamanoAug 19, 2020
  24. 2/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 14, 2020
  25. SZEDER GáborAug 14, 2020
  26. Junio C HamanoAug 14, 2020
  27. Junio C HamanoAug 14, 2020
  28. brian m. carlsonAug 15, 2020
  29. Đoàn Trần Công DanhAug 15, 2020
  30. Junio C HamanoAug 17, 2020
  31. Junio C HamanoAug 20, 2020
  32. 0/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 20, 2020
  33. 2/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 20, 2020
  34. Junio C HamanoAug 20, 2020
  35. 1/2 t4013: improve diff-post-processor logicĐoàn Trần Công Danh, Aug 20, 2020
  36. Junio C HamanoAug 20, 2020
  37. Đoàn Trần Công DanhAug 21, 2020
  38. Junio C HamanoAug 21, 2020
  39. 0/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 21, 2020
  40. 2/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 21, 2020
  41. 1/2 t4013: improve diff-post-processor logicĐoàn Trần Công Danh, Aug 21, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.