forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RFC] diff: introduce --scope option
Many of git commands, such as "git grep", "git diff", they will search the "full-tree" scope of the entire git repository, which is reasonable under normal circumstances, but if the user uses sparse checkout in a git monorepo, it's very possible that he just wants to use files within the sparse specification, perhaps because: * He wants to be able to focus on his subprojects, the output of other subprojects will only interfere with him. * He's using partial cloning at the same time, and he doesn't want to be able to execute the above git commands download a large number of blobs which out of sparse specification, which is a waste of time and may cause the size of the git repository to gradually expand. So we need a way to restrict git commands to the sparse specification. Implementing "diff --scope" is the first step in this plan. We are looking for a suitable option to choose: restrict the path scope of diff to the sparse specification or keep the full tree scope (default action now). "--scope=sparse", "--scope=all" are the parameters corresponding to these two cases. It is worth noting that "--scope" option only works on diff commands specify "--cached" or "REVISION", because normal "git diff" has retrict the scope of diff files to the sparse specificaiton by default, while "git diff --cached" or "git diff REVSION" will compare to the commit history, and "--scope" options can works here to restrict or not. Add "--scope" option to git "diff-index" and "git diff-tree" too, because they also meet the above: specify "--cached", or "REVISION". Meanwhile, "git diff-no-index", "git diff-files" don't have this option. Signed-off-by: ZheNing Hu <adlternative@gmail.com>
- Loading branch information
1 parent
815c1e8
commit 115d128
Showing
13 changed files
with
488 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.