Git development
 help / color / mirror / Atom feed
From: Andry <andry@inbox.ru>
To: git@vger.kernel.org
Subject: Re: Hash for a commit sourcetree beside to a commit hash
Date: Sun, 12 Feb 2023 16:27:59 +0300	[thread overview]
Message-ID: <7910309440.20230212162759@inbox.ru> (raw)
In-Reply-To: <1798489336.20230203042837@inbox.ru>

Hello Git,



Friday, February 3, 2023, 4:28:37 AM, you wrote:

A> Hello Git,

A> Is there a chance to add this property to a commit and a set of commands, for example, to search a commit by a sourcetree hash?

I've suddenly found another interesting ability of such hash. It could may restore a commit submodule add/update reference hashes to submodule commits after submodule repo rewrite.

Lets say you have 2 repositories.

```
[Repo A] of Owner A

  ...
  |
  Commit A1
  | |
  | +-- submodule add/update hash B1
  |
  Commit A2
  | |
  | +-- submodule add/update hash B2
  |
  ...

[Repo B] of Owner B (submodule to A)

  ...
  |
  Commit B1
  |
  Commit B2
  |
  ...
```

If owner of [Repo B] would try to rewrite repository because, for example, of a mistake in the commit author email address,
then [Repo A] becomes broken and will reference invalid hashes.
Hard to rewrite hashes in [Repo A] because of unrelated histories and tricky algorithm with the hash mappings.

But if add a second hash into a commit property as hash of an ordered sourcetree diff, then
we can automatically map such hashes even in unrelated histories.
Because basically a commit hash changes because of change in a commit properties instead of in the source tree.
And even a change in source may not lead to trigger changes in following commits because depends on the context and
the sources intersection (including source movement).

So the git could suggest with these hashes a semi automatic merge even if a repo was rewriten.
Of cause this needs additionally to detect changes in all properties to show to the user before semi automatic merge.

In case of [Repo A] it just needs to add second hash into [repo A] submodule add/update and now you can rewrite [Repo A]
through the mapping by ordered sourcetree diff hash.


  parent reply	other threads:[~2023-02-12 13:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03  1:28 Hash for a commit sourcetree beside to a commit hash Andry
2023-02-03  2:01 ` Đoàn Trần Công Danh
2023-02-03  2:21   ` Andry
2023-02-03 11:11     ` Philip Oakley
2023-02-03 13:37       ` Andry
2023-02-03 15:15         ` Đoàn Trần Công Danh
2023-02-04  4:50           ` Andry
2023-02-03 22:39         ` Philip Oakley
2023-02-05  1:41           ` Andry
2023-02-12 13:27 ` Andry [this message]
2023-02-26  9:37 ` Andry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7910309440.20230212162759@inbox.ru \
    --to=andry@inbox.ru \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox