From: Christian Couder <christian.couder@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Patrick Steinhardt <ps@pks.im>, John Cai <johncai86@gmail.com>,
Linus Arver <linusa@google.com>,
Christian Couder <christian.couder@gmail.com>
Subject: [PATCH v2 0/4] rev-list: allow missing tips with --missing
Date: Thu, 8 Feb 2024 14:50:51 +0100 [thread overview]
Message-ID: <20240208135055.2705260-1-christian.couder@gmail.com> (raw)
# Intro
A recent patch series, kn/rev-list-missing-fix [1] extended the
`--missing` option in git-rev-list(1) to support commit objects.
Unfortunately, git-rev-list(1) with `--missing` set to something other
than 'error' still fails, usually with a "fatal: bad object <oid>"
error message, when a missing object is passed as an argument.
This patch series removes this limitation and when using
`--missing=print` allows all missing objects to be printed including
those that are passed as arguments.
[1] https://lore.kernel.org/git/20231026101109.43110-1-karthik.188@gmail.com/
# Patch overview
Patches 1/4 (revision: clarify a 'return NULL' in get_reference()),
2/4 (oidset: refactor oidset_insert_from_set()) and
3/4 (t6022: fix 'test' style and 'even though' typo) are very small
preparatory cleanups.
Patch 4/4 (rev-list: allow missing tips with --missing=[print|allow*])
allows git-rev-list(1) with `--missing=<arg>` when <arg> is not
'error' to not fail if some tips it is passed are missing.
# Changes since V1
Thanks to Linus Arver, Eric Sunshine and Junio who commented on V1!
The changes since V1 are the following:
- In patch 1/4 (revision: clarify a 'return NULL' in
get_reference()), some 's/explicitely/explicitly/' typos were fixed
in the commit message. Thanks to a suggestion from Eric.
- Patch 2/4 (oidset: refactor oidset_insert_from_set()) is new. It
refactors some code into "oidset.{c,h}" to avoid duplicating code
to copy elements from one oidset into another one. Thanks to a
suggestion from Linus.
- Patch 3/4 (t6022: fix 'test' style and 'even though' typo) used to
fix only an 'even though' typo, but while at it I made it use
`if test ...` instead of `if [ ... ]` too. Thanks to a suggestion
from Junio.
- Patch 4/4 (rev-list: allow missing tips with
--missing=[print|allow*]) was changed so that missing tips are
always allowed when `--missing=[print|allow*]` is used, as
suggested by Junio. So:
- no new `--allow-missing-tips` option is implemented,
- no ugly early parsing loop is added,
- no new 'do_not_die_on_missing_tips' flag is added into
'struct rev_info',
- the 'do_not_die_on_missing_objects' is used more instead,
- the commit message as been changed accordingly.
- In patch 4/4 (rev-list: allow missing tips with
--missing=[print|allow*]), a code comment has been added before
`if (get_oid_with_context(...))` in "revision.c::get_reference()"
as suggested by Linus.
- In patch 4/4 (rev-list: allow missing tips with
--missing=[print|allow*]), a big NEEDSWORK comment has been added
before the ugly early parsing loops for the
`--exclude-promisor-objects` and `--missing=...` options in
"builtin/rev-list.c".
- In patch 4/4 (rev-list: allow missing tips with
--missing=[print|allow*]), a code comment now uses "missing tips"
instead of "missing commits" in "builtin/rev-list.c", as
suggested by Linus.
- In patch 4/4 (rev-list: allow missing tips with
--missing=[print|allow*]), the added tests in t6022 have the
following changes:
- variables 'obj' and 'tip' have been renamed to 'missing_tip'
and 'existing_tip' respectively as suggested by Linus,
- a comment explaining how the 'existing_tip' variable is useful
has been added as suggested by Linus,
- `if test ...` is used instead of `if [ ... ]`, as suggested by
Junio.
- Also in patch 4/4 (rev-list: allow missing tips with
--missing=[print|allow*]), the documentation of the `--missing=...`
option has been improved to talk about missing tips.
# Range-diff since V1
Unfortunately there has been many changes in patch 4/4, so the
range-diff shows different patches:
1: b8abbc1d42 ! 1: 5233a83181 revision: clarify a 'return NULL' in get_reference()
@@ Commit message
revision: clarify a 'return NULL' in get_reference()
In general when we know a pointer variable is NULL, it's clearer to
- explicitely return NULL than to return that variable.
+ explicitly return NULL than to return that variable.
In get_reference() when 'object' is NULL, we already return NULL
when 'revs->exclude_promisor_objects && is_promisor_object(oid)' is
true, but we return 'object' when 'revs->ignore_missing' is true.
- Let's make the code clearer and more uniform by also explicitely
+ Let's make the code clearer and more uniform by also explicitly
returning NULL when 'revs->ignore_missing' is true.
+ Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
## revision.c ##
-: ---------- > 2: cfa72c8cf1 oidset: refactor oidset_insert_from_set()
2: 208d43eb81 ! 3: 5668340516 t6022: fix 'even though' typo in comment
@@ Metadata
Author: Christian Couder <chriscool@tuxfamily.org>
## Commit message ##
- t6022: fix 'even though' typo in comment
+ t6022: fix 'test' style and 'even though' typo
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
@@ t/t6022-rev-list-missing.sh: do
- # Blobs are shared by all commits, so evethough a commit/tree
+ # Blobs are shared by all commits, so even though a commit/tree
# might be skipped, its blob must be accounted for.
- if [ $obj != "HEAD:1.t" ]; then
+- if [ $obj != "HEAD:1.t" ]; then
++ if test $obj != "HEAD:1.t"
++ then
echo $(git rev-parse HEAD:1.t) >>expect.raw &&
+ echo $(git rev-parse HEAD:2.t) >>expect.raw
+ fi &&
3: 8be34ce359 < -: ---------- rev-list: add --allow-missing-tips to be used with --missing=...
-: ---------- > 4: 55792110ca rev-list: allow missing tips with --missing=[print|allow*]
Christian Couder (4):
revision: clarify a 'return NULL' in get_reference()
oidset: refactor oidset_insert_from_set()
t6022: fix 'test' style and 'even though' typo
rev-list: allow missing tips with --missing=[print|allow*]
Documentation/rev-list-options.txt | 4 ++
builtin/rev-list.c | 15 +++++++-
list-objects-filter.c | 11 +-----
oidset.c | 10 +++++
oidset.h | 6 +++
revision.c | 16 ++++++--
t/t6022-rev-list-missing.sh | 61 +++++++++++++++++++++++++++++-
7 files changed, 106 insertions(+), 17 deletions(-)
--
2.43.0.565.g97b5fd12a3.dirty
next reply other threads:[~2024-02-08 13:54 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 13:50 Christian Couder [this message]
2024-02-08 13:50 ` [PATCH v2 1/4] revision: clarify a 'return NULL' in get_reference() Christian Couder
2024-02-08 13:50 ` [PATCH v2 2/4] oidset: refactor oidset_insert_from_set() Christian Couder
2024-02-08 17:33 ` Junio C Hamano
2024-02-13 21:02 ` Linus Arver
2024-02-14 14:33 ` Christian Couder
2024-02-16 1:10 ` Linus Arver
2024-02-16 10:38 ` Christian Couder
2024-02-16 20:27 ` Linus Arver
2024-02-08 13:50 ` [PATCH v2 3/4] t6022: fix 'test' style and 'even though' typo Christian Couder
2024-02-08 13:50 ` [PATCH v2 4/4] rev-list: allow missing tips with --missing=[print|allow*] Christian Couder
2024-02-08 17:44 ` Junio C Hamano
2024-02-13 22:38 ` Linus Arver
2024-02-14 14:34 ` Christian Couder
2024-02-14 16:49 ` Junio C Hamano
2024-02-14 14:39 ` Christian Couder
2024-02-13 22:33 ` Linus Arver
2024-02-14 14:38 ` Christian Couder
2024-02-16 1:24 ` Linus Arver
2024-02-08 23:15 ` [PATCH v2 0/4] rev-list: allow missing tips with --missing Junio C Hamano
2024-02-14 14:26 ` Christian Couder
2024-02-14 14:25 ` [PATCH v3 0/5] " Christian Couder
2024-02-14 14:25 ` [PATCH v3 1/5] t9210: do not rely on lazy fetching to fail Christian Couder
2024-02-14 14:25 ` [PATCH v3 2/5] revision: clarify a 'return NULL' in get_reference() Christian Couder
2024-02-14 14:25 ` [PATCH v3 3/5] oidset: refactor oidset_insert_from_set() Christian Couder
2024-02-14 14:25 ` [PATCH v3 4/5] t6022: fix 'test' style and 'even though' typo Christian Couder
2024-02-14 14:25 ` [PATCH v3 5/5] rev-list: allow missing tips with --missing=[print|allow*] Christian Couder
2024-02-16 21:56 ` [PATCH v3 0/5] rev-list: allow missing tips with --missing Linus Arver
2024-02-28 9:10 ` [PATCH] revision: fix --missing=[print|allow*] for annotated tags Christian Couder
2024-02-28 17:46 ` Junio C Hamano
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=20240208135055.2705260-1-christian.couder@gmail.com \
--to=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johncai86@gmail.com \
--cc=linusa@google.com \
--cc=ps@pks.im \
/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).