From c8556c6213cf6dca63f29f98ad9d074f6c5f8233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 19 Oct 2013 09:41:24 +0700 Subject: Fix calling parse_pathspec with no paths nor PATHSPEC_PREFER_* flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When parse_pathspec() is called with no paths, the behavior could be either return no paths, or return one path that is cwd. Some commands do the former, some the latter. parse_pathspec() itself does not make either the default and requires the caller to specify either flag if it may run into this situation. I've grep'd through all parse_pathspec() call sites. Some pass neither, but those are guaranteed never pass empty path to parse_pathspec(). There are two call sites that may pass empty path and are fixed with this patch. [jc: added a test from Antoine's bug report] Reported-by: Antoine Pelisse Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- revision.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'revision.c') diff --git a/revision.c b/revision.c index 001623a921..e04fdd0cb1 100644 --- a/revision.c +++ b/revision.c @@ -1372,7 +1372,8 @@ static void prepare_show_merge(struct rev_info *revs) i++; } free_pathspec(&revs->prune_data); - parse_pathspec(&revs->prune_data, PATHSPEC_ALL_MAGIC, 0, "", prune); + parse_pathspec(&revs->prune_data, PATHSPEC_ALL_MAGIC, + PATHSPEC_PREFER_FULL, "", prune); revs->limited = 1; } -- cgit v1.2.1