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

Re: [PATCH 2/5] git-submodule: New subcommand 'summary' (2) - hard work

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 12, 2008, 19:21 UTC
Message-ID
<7vzlvasvcy.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<46dff0320801120424v1b780a97x8a4ecfcfe8e52f7@mail.gmail.com>
"Ping Yin" <pkufranky@gmail.com> writes:
Show 11 quoted lines
>> >
>> > I think you would want to read full 40-char sha1_src and
>> > sha1_dst with "while read", and keep that full 40-char in these
>> > variables, and use them when calling rev-parse here.
>>
>> Hmm, precision is really a problem. However, "git diff --raw" will not
>> always give full 40-char sha1, instead it will give sha1 with enough
>> length. So maybe i can use the sha1 from "git diff --raw" ?
>>
> Oh, I'm wrong. It seems 'git diff --raw' will always give full 40-char
> sha1 for submodule entry and abbreviated sha1 for blob entry.

It is not recommended to use "git diff" in scripts when you can use one of the "git diff-*" plumbing. In this case I think you would want "git-diff-index". Also see --abbrev option.

You can never determine how many hexdigits are "enough" from the containing project, as it does not have to have access to the submodule object store. That's the reason I suggested to read full object name from diff-index and use it for error reporting and object retrieval, and shorten it in the UI for normal status noise.

Previous: Ping YinNext: Ping Yin
Message 14 of 19 in “submodule summary support”
  1. 0/5 submodule summary supportPing Yin, Jan 12, 2008
  2. 1/5 git-submodule: New subcommand 'summary' (1) - code frameworkPing Yin, Jan 12, 2008
  3. 2/5 git-submodule: New subcommand 'summary' (2) - hard workPing Yin, Jan 12, 2008
  4. 3/5 git-submodule: New subcommand 'summary' (3) - limit summary sizePing Yin, Jan 12, 2008
  5. 4/5 git-status: submodule summary supportPing Yin, Jan 12, 2008
  6. 5/5 git-status: configurable submodule summary sizePing Yin, Jan 12, 2008
  7. Junio C HamanoJan 12, 2008
  8. Ping YinJan 12, 2008
  9. Junio C HamanoJan 12, 2008
  10. Ping YinJan 13, 2008
  11. Junio C HamanoJan 12, 2008
  12. Ping YinJan 12, 2008
  13. Ping YinJan 12, 2008
  14. Junio C HamanoJan 12, 2008
  15. Ping YinJan 12, 2008
  16. Junio C HamanoJan 12, 2008
  17. Ping YinJan 13, 2008
  18. Junio C HamanoJan 12, 2008
  19. Ping YinJan 12, 2008

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.