git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nikolay Edigaryev via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Nikolay Edigaryev <edigaryev@gmail.com>,
	Nikolay Edigaryev <edigaryev@gmail.com>
Subject: [PATCH] rev-list-options: fix off-by-one in '--filter=blob:limit=<n>' explainer
Date: Sun, 14 Jan 2024 19:50:50 +0000	[thread overview]
Message-ID: <pull.1645.git.git.1705261850650.gitgitgadget@gmail.com> (raw)

From: Nikolay Edigaryev <edigaryev@gmail.com>

'--filter=blob:limit=<n>' was introduced in 25ec7bcac0 (list-objects:
filter objects in traverse_commit_list, 2017-11-21) and later expanded
to bitmaps in 84243da129 (pack-bitmap: implement BLOB_LIMIT filtering,
2020-02-14)

The logic that was introduced in these commits (and that still persists
to this day) omits blobs larger than _or equal_ to n bytes or units.

However, the documentation (Documentation/rev-list-options.txt) states:

>The form '--filter=blob:limit=<n>[kmg]' omits blobs larger than n
bytes or units. n may be zero.

Moreover, the t6113-rev-list-bitmap-filters.sh tests for exactly this
logic, so it seems it is the documentation that needs fixing, not the
code.

This changes the explanation to be similar to
Documentation/git-clone.txt, which is correct.

Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com>
---
    rev-list-options: fix off-by-one in '--filter=blob:limit=' explainer
    
    '--filter=blob:limit=' was introduced in 25ec7bcac0 (list-objects:
    filter objects in traverse_commit_list, 2017-11-21) and later expanded
    to bitmaps in 84243da129 (pack-bitmap: implement BLOB_LIMIT filtering,
    2020-02-14)
    
    The logic that was introduced in these commits (and that still persists
    to this day) omits blobs larger than or equal to n bytes or units.
    
    However, the documentation (Documentation/rev-list-options.txt) states:
    
    > The form '--filter=blob:limit=[kmg]' omits blobs larger than n bytes
    > or units. n may be zero.
    
    Moreover, the t6113-rev-list-bitmap-filters.sh tests for exactly this
    logic, so it seems it is the documentation that needs fixing, not the
    code.
    
    This changes the explanation to be similar to
    Documentation/git-clone.txt, which is correct.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1645%2Fedigaryev%2Ffix-blob-limit-off-by-one-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1645/edigaryev/fix-blob-limit-off-by-one-v1
Pull-Request: https://github.com/git/git/pull/1645

 Documentation/rev-list-options.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 2bf239ff030..a583b52c612 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -947,10 +947,10 @@ ifdef::git-rev-list[]
 +
 The form '--filter=blob:none' omits all blobs.
 +
-The form '--filter=blob:limit=<n>[kmg]' omits blobs larger than n bytes
-or units.  n may be zero.  The suffixes k, m, and g can be used to name
-units in KiB, MiB, or GiB.  For example, 'blob:limit=1k' is the same
-as 'blob:limit=1024'.
+The form '--filter=blob:limit=<n>[kmg]' omits blobs of size at least n
+bytes or units.  n may be zero.  The suffixes k, m, and g can be used
+to name units in KiB, MiB, or GiB.  For example, 'blob:limit=1k'
+is the same as 'blob:limit=1024'.
 +
 The form '--filter=object:type=(tag|commit|tree|blob)' omits all objects
 which are not of the requested type.

base-commit: 564d0252ca632e0264ed670534a51d18a689ef5d
-- 
gitgitgadget

             reply	other threads:[~2024-01-14 19:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-14 19:50 Nikolay Edigaryev via GitGitGadget [this message]
2024-01-16 16:54 ` [PATCH] rev-list-options: fix off-by-one in '--filter=blob:limit=<n>' explainer 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

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

  git send-email \
    --in-reply-to=pull.1645.git.git.1705261850650.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=edigaryev@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).