diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-04-06 16:11:56 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-04-06 17:08:46 -0700 |
commit | 8a42c9850177cc91e9f38779e8aca89682a02975 (patch) | |
tree | f6fc1c613c9285c123ef217d98518b53e603e030 /git-compat-util.h | |
parent | a91df69cbb5ced7837525106ff57ff349180770b (diff) | |
download | git-8a42c9850177cc91e9f38779e8aca89682a02975.tar.gz |
magic pathspec: add tentative ":/path/from/top/level" pathspec support
Support ":/" magic string that can be prefixed to a pathspec element to
say "this names the path from the top-level of the working tree", when
you are in the subdirectory.
For example, you should be able to say:
$ edit Makefile ;# top-level
$ cd Documentation
$ edit git.txt ;# in the subdirectory
and then do one of three things, still inside the subdirectory:
$ git add -u . ;# add only Documentation/git.txt
$ git add -u :/ ;# add everything, including paths outside Documentation
$ git add -u ;# whatever the default setting is.
To truly support magic pathspec, the API needs to be restructured so that
get_pathspec() and init_pathspec() are unified into one call. Currently,
the former just prefixes the user supplied pathspec with the current
subdirectory path, and the latter takes the output from the former and
pre-parses them into a bit richer structure for easier handling. They
should become a single API function that takes the current subdirectory
path and the remainder of argv[] (after parsing --options and revision
arguments from the command line) and returns an array of parsed pathspec
elements, and "magic" should become attributes of struct pathspec_item.
This patch implements only "top" magic because it can be hacked into the
system without such a refactoring.
The syntax for magic pathspec prefix is designed to be extensible yet
simple to type to invoke a simple magic like "from the top". The parser
for the magic prefix is hooked into get_pathspec() function in this patch,
and it needs to be moved when we refactor the API.
But we have to start from somewhere.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
0 files changed, 0 insertions, 0 deletions