]> git.ipfire.org Git - thirdparty/git.git/blobdiff - pathspec.c
Merge branch 'es/add-doc-list-short-form-of-all-in-synopsis' into maint-2.43
[thirdparty/git.git] / pathspec.c
index 3a3a5724c44bcb7b53d10ddce6f0f9f9f397512b..bb1efe1f3929f116a216de5cae6fa6b83227569e 100644 (file)
@@ -1,6 +1,6 @@
 #include "git-compat-util.h"
 #include "abspath.h"
-#include "config.h"
+#include "parse.h"
 #include "dir.h"
 #include "environment.h"
 #include "gettext.h"
@@ -467,7 +467,12 @@ static void init_pathspec_item(struct pathspec_item *item, unsigned flags,
                match = prefix_path_gently(prefix, prefixlen,
                                           &prefixlen, copyfrom);
                if (!match) {
-                       const char *hint_path = get_git_work_tree();
+                       const char *hint_path;
+
+                       if (!have_git_dir())
+                               die(_("'%s' is outside the directory tree"),
+                                   copyfrom);
+                       hint_path = get_git_work_tree();
                        if (!hint_path)
                                hint_path = get_git_dir();
                        die(_("%s: '%s' is outside repository at '%s'"), elt,