mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
pathspec: add flag to indicate operation without repository
A following change will add support for pathspecs to the git diff --no-index command. This mode of git diff does not load any repository. Add a new PATHSPEC_NO_REPOSITORY flag indicating that we're parsing pathspecs without a repository. Both PATHSPEC_ATTR and PATHSPEC_FROMTOP require a repository to function. Thus, verify that both of these are set in magic_mask to ensure they won't be accepted when PATHSPEC_NO_REPOSITORY is set. Check PATHSPEC_NO_REPOSITORY when warning about paths outside the directory tree. When the flag is set, do not look for a git repository when generating the warning message. Finally, add a BUG in match_pathspec_item if the istate is NULL but the pathspec has PATHSPEC_ATTR set. Callers which support PATHSPEC_ATTR should always pass a valid istate, and callers which don't pass a valid istate should have set PATHSPEC_ATTR in the magic_mask field to disable support for attribute-based pathspecs. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
6e4fb00156
commit
00466c1620
@@ -76,6 +76,11 @@ struct pathspec {
|
||||
* allowed, then it will automatically set for every pathspec.
|
||||
*/
|
||||
#define PATHSPEC_LITERAL_PATH (1<<6)
|
||||
/*
|
||||
* For git diff --no-index, indicate that we are operating without
|
||||
* a repository or index.
|
||||
*/
|
||||
#define PATHSPEC_NO_REPOSITORY (1<<7)
|
||||
|
||||
/**
|
||||
* Given command line arguments and a prefix, convert the input to
|
||||
|
||||
Reference in New Issue
Block a user