summaryrefslogtreecommitdiff
path: root/pathspec.c
diff options
context:
space:
mode:
Diffstat (limited to 'pathspec.c')
-rw-r--r--pathspec.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/pathspec.c b/pathspec.c
index 128f27fcb7..7a229d8d22 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -3,7 +3,7 @@
#include "dir.h"
#include "pathspec.h"
#include "attr.h"
-#include "argv-array.h"
+#include "strvec.h"
#include "quote.h"
/*
@@ -438,8 +438,13 @@ static void init_pathspec_item(struct pathspec_item *item, unsigned flags,
} else {
match = prefix_path_gently(prefix, prefixlen,
&prefixlen, copyfrom);
- if (!match)
- die(_("%s: '%s' is outside repository"), elt, copyfrom);
+ if (!match) {
+ const char *hint_path = get_git_work_tree();
+ if (!hint_path)
+ hint_path = get_git_dir();
+ die(_("%s: '%s' is outside repository at '%s'"), elt,
+ copyfrom, absolute_path(hint_path));
+ }
}
item->match = match;
@@ -619,7 +624,7 @@ void parse_pathspec_file(struct pathspec *pathspec, unsigned magic_mask,
unsigned flags, const char *prefix,
const char *file, int nul_term_line)
{
- struct argv_array parsed_file = ARGV_ARRAY_INIT;
+ struct strvec parsed_file = STRVEC_INIT;
strbuf_getline_fn getline_fn = nul_term_line ? strbuf_getline_nul :
strbuf_getline;
struct strbuf buf = STRBUF_INIT;
@@ -638,7 +643,7 @@ void parse_pathspec_file(struct pathspec *pathspec, unsigned magic_mask,
die(_("line is badly quoted: %s"), buf.buf);
strbuf_swap(&buf, &unquoted);
}
- argv_array_push(&parsed_file, buf.buf);
+ strvec_push(&parsed_file, buf.buf);
strbuf_reset(&buf);
}
@@ -647,8 +652,8 @@ void parse_pathspec_file(struct pathspec *pathspec, unsigned magic_mask,
if (in != stdin)
fclose(in);
- parse_pathspec(pathspec, magic_mask, flags, prefix, parsed_file.argv);
- argv_array_clear(&parsed_file);
+ parse_pathspec(pathspec, magic_mask, flags, prefix, parsed_file.v);
+ strvec_clear(&parsed_file);
}
void copy_pathspec(struct pathspec *dst, const struct pathspec *src)