[PATCH 03/21] pathspec: make sure the prefix part is wildcard-clean

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prefix is the result of Git moving back from current directory to
worktree's top directory and it has to prepend all user provided paths
so that they become relative to the new current directory. Any
wildcards in the prefix should not be treated as such because it's not
the user intention. Make sure all wildcards in the prefix part is
disabled.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 setup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/setup.c b/setup.c
index 4fcdae6..573ef79 100644
--- a/setup.c
+++ b/setup.c
@@ -250,6 +250,8 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
 	*raw = item->match;
 	item->len = strlen(item->match);
 	item->nowildcard_len = simple_length(item->match);
+	if (item->nowildcard_len < prefixlen)
+		item->nowildcard_len = prefixlen;
 	return magic;
 }
 
-- 
1.8.0.rc2.23.g1fb49df

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]