Skip to content

Commit

Permalink
setup.c: document get_pathspec()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
aspiers authored and gitster committed Jan 6, 2013
1 parent 512aaf9 commit 1794e6e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,25 @@ static const char *prefix_pathspec(const char *prefix, int prefixlen, const char
return prefix_path(prefix, prefixlen, copyfrom);
}

/*
* N.B. get_pathspec() is deprecated in favor of the "struct pathspec"
* based interface - see pathspec_magic above.
*
* Arguments:
* - prefix - a path relative to the root of the working tree
* - pathspec - a list of paths underneath the prefix path
*
* Iterates over pathspec, prepending each path with prefix,
* and return the resulting list.
*
* If pathspec is empty, return a singleton list containing prefix.
*
* If pathspec and prefix are both empty, return an empty list.
*
* This is typically used by built-in commands such as add.c, in order
* to normalize argv arguments provided to the built-in into a list of
* paths to process, all relative to the root of the working tree.
*/
const char **get_pathspec(const char *prefix, const char **pathspec)
{
const char *entry = *pathspec;
Expand Down

0 comments on commit 1794e6e

Please sign in to comment.