From: Junio C Hamano <gitster@pobox.com>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [Bug???] In `git-rev-list(1)`, using the `--objects` flag doesn't work well with the `--not` flag, as non-commit objects are not excluded
Date: Tue, 15 Aug 2023 13:52:01 -0700 [thread overview]
Message-ID: <xmqq350khvv2.fsf@gitster.g> (raw)
In-Reply-To: <CAOLa=ZQmjroDiOcUsu_MHtQ-88QHU9qeZPOPh+KJJ3dFoF2q0A@mail.gmail.com> (Karthik Nayak's message of "Tue, 15 Aug 2023 18:44:18 +0200")
Karthik Nayak <karthik.188@gmail.com> writes:
> Hello!
>
> What did you do before the bug happened? (Steps to reproduce your issue)
>
> Assume a repository structure as follows:
>
> - commit1 9f2aa2eb987c2281bb4901dbccd1398ad2c39722
> - tree: 205f6b799e7d5c2524468ca006a0131aa57ecce7
> - 100644 blob 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 foo
> - content: foo
> - commit2 9e02481f4df3a8997335b0a68882580e3b9b588f (parent:
> 9f2aa2eb987c2281bb4901dbccd1398ad2c39722)
> - tree: 672d0aa883d095369c56416587bc397eee4ac37e
> - 100644 blob 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 foo
> - content: foo
> - 100644 blob eec8c88a93f6ee1515fb8348f2c122cfda4302cd moo
> - content: moo
> - commit3 91fa9611a355db77a07f963c746d57f75af380da (parent:
> 9e02481f4df3a8997335b0a68882580e3b9b588f)
> - tree 0c16a6cc9eef3fdd3034c1ffe2fc5e6d0bba2192
> - tree 086885f71429e3599c8c903b0e9ed491f6522879 bar
> - 100644 blob 7a67abed5f99fdd3ee203dd137b9818d88b1bafd goo
> - content: goo
> - 100644 blob 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 foo
> - content: foo
> - 100644 blob eec8c88a93f6ee1515fb8348f2c122cfda4302cd moo
> - content: moo
> - 100644 blob 8baef1b4abc478178b004d62031cf7fe6db6f903 abc
> - content: abc
> - commit4 6b52ed5b176604a0740689b5bb9be7bd79f4bced (parent:
> 9f2aa2eb987c2281bb4901dbccd1398ad2c39722)
> - tree ff05824d2f76436c61d2c971e11a27514aba6948
> - tree 086885f71429e3599c8c903b0e9ed491f6522879 bar
> - 100644 blob 7a67abed5f99fdd3ee203dd137b9818d88b1bafd goo
> - content: goo
> - 100644 blob 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 foo
> - content: foo
> - 100644 blob 8baef1b4abc478178b004d62031cf7fe6db6f903 abc
> - content: abc
The differences in commit object names become distracting, but I do
not think your example depends on them, so a minimum reproduction
recipe should be
$ rm -fr new ; git init new ; cd new
$ echo foo >foo
$ git add -A; git commit -m one; git rev-parse HEAD:
205f6b799e7d5c2524468ca006a0131aa57ecce7
$ echo moo >moo
$ git add -A; git commit -m two; git rev-parse HEAD:
672d0aa883d095369c56416587bc397eee4ac37e
$ mkdir bar; echo goo >bar/goo; echo abc >abc
$ git add -A; git commit -m three; git rev-parse HEAD:
0c16a6cc9eef3fdd3034c1ffe2fc5e6d0bba2192
$ git rm moo; git commit -m four; git rev-parse HEAD:
ff05824d2f76436c61d2c971e11a27514aba6948
$ git rev-list --objects HEAD^..HEAD
5a1b93c9c4c0c9e5c969f8e0b92a02184f8f9aab
ff05824d2f76436c61d2c971e11a27514aba6948
that output lists HEAD and HEAD^{tree} in this order, which seems to
be what you are expecting.
I am consistently getting the same result with Git 2.42-rc2, 2.41,
2.21, and 2.20 (I do not have ones older than 2.20 around).
> What did you expect to happen? (Expected behavior)
>
> In such a repository, the output for the command, should have the
> output provided below
>
> ❯ git rev-list --objects 6b52ed5b176604a0740689b5bb9be7bd79f4bced
> --not 91fa9611a355db77a07f963c746d57f75af380da
> 6b52ed5b176604a0740689b5bb9be7bd79f4bced
> ff05824d2f76436c61d2c971e11a27514aba6948
>
> What happened instead? (Actual behavior)
>
> Instead, the output is as follows:
>
> ❯ git rev-list --objects 6b52ed5b176604a0740689b5bb9be7bd79f4bced
> --not 91fa9611a355db77a07f963c746d57f75af380da
> 6b52ed5b176604a0740689b5bb9be7bd79f4bced
> ff05824d2f76436c61d2c971e11a27514aba6948
> 8baef1b4abc478178b004d62031cf7fe6db6f903 abc
> 086885f71429e3599c8c903b0e9ed491f6522879 bar
> 7a67abed5f99fdd3ee203dd137b9818d88b1bafd bar/goo
So, there is something else going on in *your* build of Git, or the
repository you prepared for testing, or both.
prev parent reply other threads:[~2023-08-15 20:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-15 16:44 [Bug] In `git-rev-list(1)`, using the `--objects` flag doesn't work well with the `--not` flag, as non-commit objects are not excluded Karthik Nayak
2023-08-15 19:31 ` Junio C Hamano
2023-08-15 22:11 ` Taylor Blau
2023-08-15 22:59 ` Karthik Nayak
2023-08-15 22:56 ` Karthik Nayak
2023-08-16 18:24 ` Junio C Hamano
2023-08-16 20:58 ` Karthik Nayak
2023-08-15 20:52 ` Junio C Hamano [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq350khvv2.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.