Skip to content

Commit 3b7c49e

Browse files
committed
Merge branch 'rd/test-path-utils' into maint
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
2 parents ce555f3 + b2a7123 commit 3b7c49e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

path.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,11 @@ const char *remove_leading_path(const char *in, const char *prefix)
676676
* normalized, any time "../" eats up to the prefix_len part,
677677
* prefix_len is reduced. In the end prefix_len is the remaining
678678
* prefix that has not been overridden by user pathspec.
679+
*
680+
* NEEDSWORK: This function doesn't perform normalization w.r.t. trailing '/'.
681+
* For everything but the root folder itself, the normalized path should not
682+
* end with a '/', then the callers need to be fixed up accordingly.
683+
*
679684
*/
680685
int normalize_path_copy_len(char *dst, const char *src, int *prefix_len)
681686
{

test-path-utils.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ static int normalize_ceiling_entry(struct string_list_item *item, void *unused)
2121
if (normalize_path_copy(buf, ceil) < 0)
2222
die("Path \"%s\" could not be normalized", ceil);
2323
len = strlen(buf);
24-
if (len > 1 && buf[len-1] == '/')
25-
die("Normalized path \"%s\" ended with slash", buf);
2624
free(item->string);
2725
item->string = xstrdup(buf);
2826
return 1;

0 commit comments

Comments
 (0)