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

Re: Hash for a commit sourcetree beside to a commit hash

From
AAndry <andry@inbox.ru>
Date
Feb 3, 2023, 02:21 UTC
Message-ID
<563617028.20230203052145@inbox.ru>
In-Reply-To
<Y9xq5VAMjzUqTb6X@danh.dev>
Hello Đoàn,
Friday, February 3, 2023, 5:01:09 AM, you wrote:
ĐTCD> On 2023-02-03 04:28:37+0300, Andry <andry@inbox.ru> wrote:
>> Hello Git,
>> 
>> Is there a chance to add this property to a commit and a set of
>> commands,

ĐTCD> Does `git rev-parse commit^{tree}` works for you? E.g. ĐTCD> git rev-parse HEAD^{tree}

If the `^{tree}` does calculate a commit internal sourcetree hash without other commits, then yes. If it does rely on other commits and accumulates the sourcetree over the chain of commits, then it does not calculate the hash by the difference and can not be applied as I have described.

>> for example, to search a commit by a sourcetree hash?

ĐTCD> I'm not sure if I understand your question correctly, but does this ĐTCD> work?

ĐTCD> git rev-list <a-commit-tish> | ĐTCD> while read commit; do ĐTCD> if test $(git rev-parse $commit^{tree}) = $hash; then ĐTCD> echo $commit ĐTCD> break ĐTCD> fi ĐTCD> done

Nice, but I can not apply this over a git hub or a web interface without a clone.
Previous: Đoàn Trần Công DanhNext: Philip Oakley
Message 3 of 11 in “Hash for a commit sourcetree beside to a commit hash”
  1. AndryFeb 3, 2023
  2. Đoàn Trần Công DanhFeb 3, 2023
  3. AndryFeb 3, 2023
  4. Philip OakleyFeb 3, 2023
  5. AndryFeb 3, 2023
  6. Đoàn Trần Công DanhFeb 3, 2023
  7. AndryFeb 4, 2023
  8. Philip OakleyFeb 3, 2023
  9. AndryFeb 5, 2023
  10. AndryFeb 12, 2023
  11. AndryFeb 26, 2023

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.