git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jacob Stopak <jacob@initialcommit.io>
To: git@vger.kernel.org
Subject: Newbie contribution idea for 'git log --children': input requested
Date: Sun, 11 Sep 2022 16:09:00 -0700	[thread overview]
Message-ID: <Yx5qjPhZ5AHkPHr7@MacBook-Pro-3.local> (raw)

Hello! This is my first idea for a suggested code change, and I'm
seeking some input on whether it makes sense to address, and if
so, a bit of help with how to implement.

I was futzing with "git log --children" and noticed that the
output doesn't display children for the HEAD commit in a
detached HEAD state (or even when HEAD points to a branch tip
that in fact does have a child commit that is ahead of the
branch).

I assume the children of the HEAD commit don't display because
of the way Git starts parsing backward in a parent-wise
direction, so the children of the HEAD commit would never be
found.

But it seems like displaying the children of the HEAD commit
_when they exist_ would be useful for users who have checked out
a commit somewhere in the middle of a long commit history.

In this case, a user might want to be able to easily find and
check out a commit in the "child" direction without having to
go all the way back up to the branch tip (or nearest tag) to
see commits between the detached HEAD and the branch tip.

I'm not sure if this really qualifies as a "bug" per se, or if
there is some way to do this that I'm just missing, or if it goes
against the way Git's rev lists work.

But I'm wondering if it could be addressed by simply adding a
discrete check to see if any commits point to HEAD as a parent,
(only when the --children option is used of course), and if so,
populate those ids into the log message.

It does seem to make sense that ALL commits with children would
show those children in the log when the --children option is
used... The current behavior seems to be that all commits _except_
HEAD will display their children.

Thx for your thoughts!

Best,
Jack

             reply	other threads:[~2022-09-11 23:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-11 23:09 Jacob Stopak [this message]
2022-09-12  0:41 ` Newbie contribution idea for 'git log --children': input requested Junio C Hamano
2022-09-15  5:08   ` Jeff King
2022-09-15 17:08     ` Junio C Hamano
2022-09-18  3:19     ` Jacob Stopak
2022-09-20 22:28       ` Jeff King
2022-09-21  0:24         ` Jacob Stopak

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=Yx5qjPhZ5AHkPHr7@MacBook-Pro-3.local \
    --to=jacob@initialcommit.io \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).