aboutsummaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2013-01-06 16:58:12 +0000
committerJunio C Hamano <gitster@pobox.com>2013-01-06 14:26:37 -0800
commit1794e6e0972bec862a29b637e4c4262fa76e97a8 (patch)
tree8fba10c4397e2deaa957074f44e8bd2586322600 /setup.c
parent512aaf9453cecfa57dddc61aec2132b936b2ff70 (diff)
downloadgit-1794e6e0972bec862a29b637e4c4262fa76e97a8.tar.gz
git-1794e6e0972bec862a29b637e4c4262fa76e97a8.tar.xz
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 <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/setup.c b/setup.c
index 7663a4cbb..95701475d 100644
--- a/setup.c
+++ b/setup.c
@@ -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;