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>
Adam Spiers committed
Jan 6, 2013 at 16:58 UTC
1794e6e0972bec862a29b637e4c4262fa76e97a8
1 file changed
+19
setup.c
+19
@@ -249,6 +249,25 @@ static const char *prefix_pathspec(const char *prefix, int prefixlen, const char
249
return prefix_path(prefix, prefixlen, copyfrom);
250
}
251
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
+ */
271
const char **get_pathspec(const char *prefix, const char **pathspec)
272
{
273
const char *entry = *pathspec;