git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Lyaudet <laurent.lyaudet@gmail.com>
To: git@vger.kernel.org
Subject: Maybe default Commits History Simplification could be more sensible
Date: Sat, 29 Oct 2022 16:53:59 +0200	[thread overview]
Message-ID: <CAB1LBmsxiRHRpOibHC2c_LLAn-QSQ+qeaKF0TxQ2y8mBqTXoNQ@mail.gmail.com> (raw)

Hello,

From here :
https://git-scm.com/docs/git-log#_history_simplification
I read :
> Default mode
> Simplifies the history to the simplest history explaining the final state of the tree.
> Simplest because it prunes some side branches if the end result is the same (i.e. merging branches with the same content)

But I am kindly questioning if the "explaining the final state of the
tree." is correct.
Because I had the following case :

If :
- commit 1 modifies some lines of file f on a branch b,
- then commit 2 modifies some of the same lines of f on master,
- and commit 3 revert commits 2,
-  and then commit 4 merges b on master,
then without --show-pulls, with git log on file f you see first 3 commits only ;
and there is no way you can apply these 3 commits in sequence,
as depicted, and obtain the master's current state.

When you use git log on a branch, you expect the default :
- to give you all that happened to your branch,
- or to give you a list of commits that applied successively explains
the current state of the branch.
I know that with trees a sequence of commits is not sufficient.
But it would be a good property of default history simplification that
your current branch state can be obtained with the first parent
subsequence of displayed commits.

Currently, default history simplification for git log on some branch b
also gives merges of branch b on branch b2, if later on branch b2 is
merged back on branch b.
To me this merge commits are less interesting than the merge commit of
branch b2 on branch b at the end.

I assume that the simplification of merge commits was intended for the
simple case :
- create branch b2 from branch b1
- n commits on branch b2
- merge branch b2 on b1
If no modification was made on b1 during that time, I agree that the
merge commit of b2 on b1 is not interesting.
In that case, it could explicitly say it displays commits on other
parents that could have been automatically rebased.
Like :
commit hxhxhxhxhxh
date
done on branch b2
merged on branch b1 at date, could have been automatically rebased
Message : It was a nice commit
...

But in the case, some common file was touched on b1 during that time,
then it should give the final merge commit. (Solution 1)
(I said touched instead of modified because of the revert.)
Or it should also simplify and remove the commit and its revert on b1.
(Solution 2)
I would prefer either Solution 1 or Solution 2 to the current default.

Many UIs above git use default history simplification.
Github for example uses default history simplification.
And you cannot customize the commands used with options in these UIs.
So I hope you will find that having better default is an important topic.

Best regards,
    Laurent Lyaudet

             reply	other threads:[~2022-10-29 14:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-29 14:53 Laurent Lyaudet [this message]
2022-10-30 15:46 ` Maybe default Commits History Simplification could be more sensible Philip Oakley

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=CAB1LBmsxiRHRpOibHC2c_LLAn-QSQ+qeaKF0TxQ2y8mBqTXoNQ@mail.gmail.com \
    --to=laurent.lyaudet@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).