aboutsummaryrefslogtreecommitdiff
path: root/line-log.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-10-19 09:41:24 +0700
committerJunio C Hamano <gitster@pobox.com>2013-10-22 10:49:43 -0700
commitc8556c6213cf6dca63f29f98ad9d074f6c5f8233 (patch)
treea8cfbe3faac1bf61fba78f1cfb07cf741d1559ad /line-log.c
parent625c3304e200f9bdc05626be1397311faa4962ba (diff)
downloadgit-c8556c6213cf6dca63f29f98ad9d074f6c5f8233.tar.gz
git-c8556c6213cf6dca63f29f98ad9d074f6c5f8233.tar.xz
Fix calling parse_pathspec with no paths nor PATHSPEC_PREFER_* flags
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 <apelisse@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'line-log.c')
-rw-r--r--line-log.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/line-log.c b/line-log.c
index 843a334bf..b29f981cc 100644
--- a/line-log.c
+++ b/line-log.c
@@ -747,7 +747,8 @@ void line_log_init(struct rev_info *rev, const char *prefix, struct string_list
r = r->next;
}
paths[count] = NULL;
- parse_pathspec(&rev->diffopt.pathspec, 0, 0, "", paths);
+ parse_pathspec(&rev->diffopt.pathspec, 0,
+ PATHSPEC_PREFER_FULL, "", paths);
free(paths);
}
}