Skip to content

Commit 1794e6e

Browse files
aspiersgitster
authored andcommitted
setup.c: document get_pathspec()
Since we have just created a new pathspec-handling library, now is a good time to add some comments explaining get_pathspec(). Signed-off-by: Adam Spiers <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 512aaf9 commit 1794e6e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

setup.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,25 @@ static const char *prefix_pathspec(const char *prefix, int prefixlen, const char
249249
return prefix_path(prefix, prefixlen, copyfrom);
250250
}
251251

252+
/*
253+
* N.B. get_pathspec() is deprecated in favor of the "struct pathspec"
254+
* based interface - see pathspec_magic above.
255+
*
256+
* Arguments:
257+
* - prefix - a path relative to the root of the working tree
258+
* - pathspec - a list of paths underneath the prefix path
259+
*
260+
* Iterates over pathspec, prepending each path with prefix,
261+
* and return the resulting list.
262+
*
263+
* If pathspec is empty, return a singleton list containing prefix.
264+
*
265+
* If pathspec and prefix are both empty, return an empty list.
266+
*
267+
* This is typically used by built-in commands such as add.c, in order
268+
* to normalize argv arguments provided to the built-in into a list of
269+
* paths to process, all relative to the root of the working tree.
270+
*/
252271
const char **get_pathspec(const char *prefix, const char **pathspec)
253272
{
254273
const char *entry = *pathspec;

0 commit comments

Comments
 (0)