Merge branch 'rd/test-path-utils'
authorJunio C Hamano <gitster@pobox.com>
Fri, 16 Oct 2015 21:42:44 +0000 (14:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 16 Oct 2015 21:42:46 +0000 (14:42 -0700)
The normalize_ceiling_entry() function does not muck with the end
of the path it accepts, and the real world callers do rely on that,
but a test insisted that the function drops a trailing slash.

* rd/test-path-utils:
test-path-utils.c: remove incorrect assumption

path.c
test-path-utils.c
diff --git a/path.c b/path.c
index 62a2ae82ddfd3fc9213da0988e761985a5f177e4..1352952616667a11c40060119f0e3a8da87a22f2 100644 (file)
--- a/path.c
+++ b/path.c
@@ -910,6 +910,11 @@ const char *remove_leading_path(const char *in, const char *prefix)
  * normalized, any time "../" eats up to the prefix_len part,
  * prefix_len is reduced. In the end prefix_len is the remaining
  * prefix that has not been overridden by user pathspec.
+ *
+ * NEEDSWORK: This function doesn't perform normalization w.r.t. trailing '/'.
+ * For everything but the root folder itself, the normalized path should not
+ * end with a '/', then the callers need to be fixed up accordingly.
+ *
  */
 int normalize_path_copy_len(char *dst, const char *src, int *prefix_len)
 {
index 3dd3744a57cffd2a98be5cd551cda475c746e646..c67bf65b347810c576f80a0ac33e3b84f42e1516 100644 (file)
@@ -21,8 +21,6 @@ static int normalize_ceiling_entry(struct string_list_item *item, void *unused)
        if (normalize_path_copy(buf, ceil) < 0)
                die("Path \"%s\" could not be normalized", ceil);
        len = strlen(buf);
-       if (len > 1 && buf[len-1] == '/')
-               die("Normalized path \"%s\" ended with slash", buf);
        free(item->string);
        item->string = xstrdup(buf);
        return 1;