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

From: Đoàn Trần Công Danh <[email-masked]>
Date: Fri, 3 Feb 2023 09:01:09 +0700

On 2023-02-03 04:28:37+0300, Andry <[email-masked]> wrote:
> Hello Git,
> 
> Is there a chance to add this property to a commit and a set of
> commands,

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

	git rev-parse HEAD^{tree}

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

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

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

> Sometimes a forked branch has edits which does chance commit hashes
> without changing the sourcetree, like user mail rewrite or commits
> remove or just a commit random property change. This leads to
> rewriting the rest commits in a branch or tree.
> 
> This feature will be useful to search in all commits including
> rewritten.
> 
> Of cause in case of rebase it won't work if is happened at least one
> merge with the interference with other commits in a commit chain.
> But if not, then it might help to search commits even after
> automatic rebase.
> 

-- 
Danh