git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 07/19] glossary: define pathspec

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Dec 13, 2010, 09:46 UTC
Message-ID
<1292233616-27692-8-git-send-email-pclouds@gmail.com>
In-Reply-To
<1292233616-27692-1-git-send-email-pclouds@gmail.com>
From: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/glossary-content.txt |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt
index 1f029f8..4ed2a28 100644
--- a/Documentation/glossary-content.txt
+++ b/Documentation/glossary-content.txt
@@ -273,6 +273,29 @@ This commit is referred to as a "merge commit", or sometimes just a
 	<<def_pack,pack>>, to assist in efficiently accessing the contents of a
 	pack.
 
+[[def_pathspec]]pathspec::
+       Pattern used to specify paths.
++
+Pathspecs are used on the command line of "git ls-files", "git
+ls-tree", "git grep", "git checkout", and many other commands to
+limit the scope of operations to some subset of the tree or
+worktree.  See the documentation of each command for whether
+paths are relative to the current directory or toplevel.  The
+pathspec syntax is as follows:
+
+* any path matches itself
+* the pathspec up to the last slash represents a
+  directory prefix.  The scope of that pathspec is
+  limited to that subtree.
+* the rest of the pathspec is a pattern for the remainder
+  of the pathname.  Paths relative to the directory
+  prefix will be matched against that pattern using fnmatch(3);
+  in particular, '*' and '?' _can_ match directory separators.
++
+For example, Documentation/*.jpg will match all .jpg files
+in the Documentation subtree,
+including Documentation/chapter_1/figure_1.jpg.
+
 [[def_parent]]parent::
 	A <<def_commit_object,commit object>> contains a (possibly empty) list
 	of the logical predecessor(s) in the line of development, i.e. its
-- 
1.7.3.3.476.g10a82
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 13 of 45 in “nd/struct-pathspec (or pathspec unification [1])”
  1. 00/19 nd/struct-pathspec (or pathspec unification [1])Nguyễn Thái Ngọc Duy, Dec 13, 2010
  2. 01/19 Add struct pathspecNguyễn Thái Ngọc Duy, Dec 13, 2010
  3. Thiago FarinaDec 13, 2010
  4. Nguyen Thai Ngoc DuyDec 14, 2010
  5. 02/19 diff-no-index: use diff_tree_setup_paths()Nguyễn Thái Ngọc Duy, Dec 13, 2010
  6. 03/19 pathspec: cache string length when initializing pathspecNguyễn Thái Ngọc Duy, Dec 13, 2010
  7. 04/19 Convert struct diff_options to use struct pathspecNguyễn Thái Ngọc Duy, Dec 13, 2010
  8. Junio C HamanoDec 13, 2010
  9. Nguyen Thai Ngoc DuyDec 14, 2010
  10. 05/19 tree_entry_interesting(): remove dependency on struct diff_optionsNguyễn Thái Ngọc Duy, Dec 13, 2010
  11. Junio C HamanoDec 13, 2010
  12. 06/19 Move tree_entry_interesting() to tree-walk.c and export itNguyễn Thái Ngọc Duy, Dec 13, 2010
  13. 07/19 glossary: define pathspecNguyễn Thái Ngọc Duy, Dec 13, 2010
  14. 08/19 pathspec: mark wildcard pathspecs from the beginningNguyễn Thái Ngọc Duy, Dec 13, 2010
  15. Junio C HamanoDec 13, 2010
  16. 09/19 tree-diff.c: reserve space in "base" for pathname concatenationNguyễn Thái Ngọc Duy, Dec 13, 2010
  17. Junio C HamanoDec 13, 2010
  18. Nguyen Thai Ngoc DuyDec 14, 2010
  19. Junio C HamanoDec 14, 2010
  20. Nguyen Thai Ngoc DuyDec 14, 2010
  21. Johannes SixtDec 14, 2010
  22. Nguyen Thai Ngoc DuyDec 14, 2010
  23. Johannes SixtDec 14, 2010
  24. Nguyen Thai Ngoc DuyDec 14, 2010
  25. Junio C HamanoDec 14, 2010
  26. 10/19 tree_entry_interesting(): factor out most matching logicNguyễn Thái Ngọc Duy, Dec 13, 2010
  27. Junio C HamanoDec 13, 2010
  28. 11/19 tree_entry_interesting: support depth limitNguyễn Thái Ngọc Duy, Dec 13, 2010
  29. Junio C HamanoDec 13, 2010
  30. Nguyen Thai Ngoc DuyDec 14, 2010
  31. 12/19 tree_entry_interesting(): support wildcard matchingNguyễn Thái Ngọc Duy, Dec 13, 2010
  32. Junio C HamanoDec 13, 2010
  33. Nguyen Thai Ngoc DuyDec 14, 2010
  34. 13/19 tree_entry_interesting(): optimize fnmatch when base is matchedNguyễn Thái Ngọc Duy, Dec 13, 2010
  35. Junio C HamanoDec 13, 2010
  36. 14/19 Convert ce_path_match() use to match_pathspec()Nguyễn Thái Ngọc Duy, Dec 13, 2010
  37. Junio C HamanoDec 13, 2010
  38. Nguyen Thai Ngoc DuyDec 14, 2010
  39. 15/19 pathspec: add match_pathspec_depth()Nguyễn Thái Ngọc Duy, Dec 13, 2010
  40. Junio C HamanoDec 13, 2010
  41. Nguyen Thai Ngoc DuyDec 14, 2010
  42. 16/19 grep: convert to use struct pathspecNguyễn Thái Ngọc Duy, Dec 13, 2010
  43. 17/19 grep: use match_pathspec_depth() for cache/worktree greppingNguyễn Thái Ngọc Duy, Dec 13, 2010
  44. 18/19 grep: use preallocated buffer for grep_tree()Nguyễn Thái Ngọc Duy, Dec 13, 2010
  45. 19/19 grep: drop pathspec_matches() in favor of tree_entry_interesting()Nguyễn Thái Ngọc Duy, Dec 13, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.