Adam Spiers [off-list ref] writes:
quoted hunk
This will be reused by a new git check-ignore command.
Signed-off-by: Adam Spiers <redacted>
---
pathspec.c | 20 ++++++++++++++------
pathspec.h | 1 +
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/pathspec.c b/pathspec.c
index 8aea0d2..6724121 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -77,9 +77,20 @@ void treat_gitlinks(const char **pathspec)
}
/*
+ * Dies if the given path refers to a file inside a symlinked
+ * directory.
+ */
+void validate_path(const char *path, const char *prefix)
The name needs to be a lot more specific.
There may be 47 different kinds of "validations" various callers may
want to do on a path, but this function only caters to one kind of
callers that want to make sure that the path refers to something
that we would directly add to our index.
+{
+ if (has_symlink_leading_path(path, strlen(path))) {
+ int len = prefix ? strlen(prefix) : 0;
+ die(_("'%s' is beyond a symbolic link"), path + len);
+ }
+}
On Fri, Dec 28, 2012 at 8:44 PM, Junio C Hamano [off-list ref] wrote:
Adam Spiers [off-list ref] writes:
quoted
This will be reused by a new git check-ignore command.
Signed-off-by: Adam Spiers <redacted>
---
pathspec.c | 20 ++++++++++++++------
pathspec.h | 1 +
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/pathspec.c b/pathspec.c
index 8aea0d2..6724121 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -77,9 +77,20 @@ void treat_gitlinks(const char **pathspec)
}
/*
+ * Dies if the given path refers to a file inside a symlinked
+ * directory.
+ */
+void validate_path(const char *path, const char *prefix)
The name needs to be a lot more specific.
There may be 47 different kinds of "validations" various callers may
want to do on a path, but this function only caters to one kind of
callers that want to make sure that the path refers to something
that we would directly add to our index.
quoted
+{
+ if (has_symlink_leading_path(path, strlen(path))) {
+ int len = prefix ? strlen(prefix) : 0;
+ die(_("'%s' is beyond a symbolic link"), path + len);
+ }
+}
Good point. Which do you prefer of these suggested names?
- die_if_path_beyond_symlink()
- validate_path_not_beyond_symlink()
- die_if_symlink_leading_path()
- validate_no_symlink_leading_path()
- validate_path_addable_to_index()
Or something else?