git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Vipul Kumar <kumar@onenetbeyond.org>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: List all commits of a specified file in oldest to newest order
Date: Tue, 9 Nov 2021 05:24:50 +0000	[thread overview]
Message-ID: <6c6ef97c-9de5-176f-f328-c4dffd96d495@onenetbeyond.org> (raw)
In-Reply-To: <YYTorS1DiuTXv0/V@coredump.intra.peff.net>

On 11/5/21 8:17 AM, Jeff King wrote:

> So yes, it's a bug in the sense that the behavior is nonsense and it
> doesn't work as one might expect. But it's also the hacky "--follow"
> working as designed, and is just a limitation of its approach. It would
> need to be rewritten completely to work correctly.  Arguably we should
> at least disallow the combination of --reverse and --follow for now, as
> it will never help (OTOH, if there is nothing to follow it should behave
> OK, and I suspect some people and scripts may add --follow "just in
> case").

I think, it's a good idea to disallow the combination of "--reverse" and 
"--follow", just like we did for "--reverse" and "--walk-reflogs" 
combination. Because this combination never going to help anybody:

   * If there is nothing to follow, people shouldn't use "--follow" 
option. Using "--follow" along with "--reverse" might arise 
misconception to users that they are also following renames also, which 
actually they don't.

   * But if there are things to follow, using combination of "--follow" 
and "--reverse" only shows a single commit which points to the "rename 
of the file". I quite didn't understand why is this happening? Once we 
encounter rename commit (from "a.txt to b.txt") while traversing in 
reverse order, our pathspec is now "b.txt". So we should also get list 
of commits which changes b.txt file.

> As a workaround, you can get what you want by two separate traversals:
> 
>    git log --follow --format=%H -- $your_file |
>    git log --stdin --no-walk --reverse [--oneline, -p, etc]

Thank you!


-v

      parent reply	other threads:[~2021-11-09  5:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05  4:10 List all commits of a specified file in oldest to newest order Vipul Kumar
2021-11-05  8:13 ` Ævar Arnfjörð Bjarmason
2021-11-09  3:35   ` Vipul Kumar
2021-11-09  9:42     ` Ævar Arnfjörð Bjarmason
2021-12-14  3:58       ` Vipul Kumar
2021-11-05  8:17 ` Jeff King
2021-11-05 18:49   ` Junio C Hamano
2021-11-05 23:26     ` Jeff King
2021-11-09  5:24   ` Vipul Kumar [this message]

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=6c6ef97c-9de5-176f-f328-c4dffd96d495@onenetbeyond.org \
    --to=kumar@onenetbeyond.org \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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).