All of lore.kernel.org
 help / color / mirror / Atom feed
From: "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Christian Couder" <christian.couder@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Jeff King" <peff@peff.net>, "Junio C Hamano" <gitster@pobox.com>,
	"Derrick Stolee" <derrickstolee@github.com>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>,
	"Victoria Dye" <vdye@github.com>,
	"Elijah Newren" <newren@gmail.com>,
	"Emily Shaffer" <emilyshaffer@google.com>,
	"Matheus Tavares Bernardino" <matheus.bernardino@usp.br>,
	"Shaoxuan Yuan" <shaoxuan.yuan02@gmail.com>,
	"Taylor Blau" <me@ttaylorr.com>,
	"ZheNing Hu" <adlternative@gmail.com>
Subject: [PATCH v3 0/2] [RFC] diff: introduce scope option
Date: Tue, 29 Nov 2022 12:00:19 +0000	[thread overview]
Message-ID: <pull.1398.v3.git.1669723221.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1398.v2.git.1669344333627.gitgitgadget@gmail.com>

In [1], we discovered that users working on different sparse-checkout
specification may download unnecessary blobs from each other's specification
in collaboration. In [2] Junio suggested that maybe we can restrict some git
command's filespec in sparse-checkout specification to elegantly solve this
problem above. In [3]: Newren and Derrick Stolee prefer to name the option
--scope={sparse, all}.

So this patch is attempt to do this thing on git diff:

v1:

 1. add --restrict option to git diff, which restrict diff filespec in
    sparse-checkout specification. [4]

v2.

 1. rename --restrict to --scope={sparse, all}, support --no-scope.
 2. add config: diff.scope={sparse,all}.

v3.

 1. with the help of newren's review, fix the wrong --scope behavior, its
    previous meaning was misrepresented as sparse patterns, and now it is
    fixed to match sparse specification. [5]
 2. remove wrong diff.scope config.
 3. apply --scope to git diff, git diff-index, git diff-tree.

v4.

 1. create a OPT_SPARSE_SCOPE macro for easier add --scope option to other
    git commands later.
 2. introduce --scope option to "git grep ".

Since I split --scope into a separate option, this option will not be
directly inherited by git commands such as git log, git format-patch, etc.
If necessary, we can add it to git log or other commands in a similar way
later.

Global scope config haven’t implement yet... Since we haven't decided on an
appropriate name for scope config. [6]

Note why I don't add --scope to "git grep --cached", because we can't use ""
with "--cached", whether we use --scope=sparse or not , the resulting set of
files it gets is the same.

[1]:
https://lore.kernel.org/git/CAOLTT8SHo66kGbvWr=+LQ9UVd1NHgqGGEYK2qq6==QgRCgLZqQ@mail.gmail.com/
[2]: https://lore.kernel.org/git/xmqqzgeqw0sy.fsf@gitster.g/ [3]:
https://lore.kernel.org/git/07a25d48-e364-0d9b-6ffa-41a5984eb5db@github.com/
[4]:
https://lore.kernel.org/git/pull.1368.git.1664036052741.gitgitgadget@gmail.com/
[5]:
https://lore.kernel.org/git/CAOLTT8TceM-NpV2_hUCZj2Dx=W30f_9SHW8CcRH-pw32BRd-oA@mail.gmail.com/
[6]:
https://lore.kernel.org/git/CABPp-BGHMsMxP6e7p0HAZA=ugk+GY3XW6_EaTN=HzaLQYAzQYA@mail.gmail.com/

ZheNing Hu (2):
  [RFC] diff: introduce --scope option
  [RPC] grep: introduce --scope option

 Documentation/diff-options.txt   |  33 ++++
 Documentation/git-grep.txt       |  24 +++
 builtin/diff-index.c             |  24 ++-
 builtin/diff-tree.c              |  11 ++
 builtin/diff.c                   |  23 ++-
 builtin/grep.c                   |  10 +
 cache.h                          |   5 +
 diff-lib.c                       |  43 +++++
 diff.c                           |   2 +
 diff.h                           |   7 +
 dir.c                            |  52 ++++++
 dir.h                            |   4 +
 grep.h                           |   2 +
 parse-options.h                  |   7 +
 t/t1090-sparse-checkout-scope.sh | 303 +++++++++++++++++++++++++++++++
 tree-diff.c                      |   7 +
 16 files changed, 551 insertions(+), 6 deletions(-)


base-commit: 815c1e82021edbd99a2c423cf27f28863f28cef3
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1398%2Fadlternative%2Fzh%2Fdiff-scope-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1398/adlternative/zh/diff-scope-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/1398

Contributor requested no range-diff. You can review it using these commands:
   git fetch https://github.com/gitgitgadget/git c000d916 1d1b6618
   git range-diff <options> c000d916..471a0691 083e0127..1d1b6618
-- 
gitgitgadget

  reply	other threads:[~2022-11-29 12:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31  4:11 [PATCH] [RFC] diff: introduce scope option ZheNing Hu via GitGitGadget
2022-11-01  1:34 ` Taylor Blau
2022-11-01  2:13   ` ZheNing Hu
2022-11-01  5:18 ` Elijah Newren
2022-11-06  2:11   ` ZheNing Hu
2022-11-06  6:58     ` Elijah Newren
2022-11-14  9:08       ` ZheNing Hu
2022-11-25  2:45 ` [PATCH v2] [RFC] diff: introduce --scope option ZheNing Hu via GitGitGadget
2022-11-29 12:00   ` ZheNing Hu via GitGitGadget [this message]
2022-11-29 12:00     ` [PATCH v3 1/2] " ZheNing Hu via GitGitGadget
2022-11-29 12:00     ` [PATCH v3 2/2] [RPC] grep: " ZheNing Hu via GitGitGadget

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.1398.v3.git.1669723221.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=adlternative@gmail.com \
    --cc=avarab@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=derrickstolee@github.com \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=matheus.bernardino@usp.br \
    --cc=me@ttaylorr.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=shaoxuan.yuan02@gmail.com \
    --cc=vdye@github.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.