]> git.ipfire.org Git - thirdparty/git.git/blobdiff - pathspec.c
The second batch post 2.26 cycle
[thirdparty/git.git] / pathspec.c
index 166d255642db4c9b854dbd19018cbc854d1c4ca1..8243e06eab48373d12729959fde8fe666eb312b2 100644 (file)
@@ -438,9 +438,13 @@ static void init_pathspec_item(struct pathspec_item *item, unsigned flags,
        } else {
                match = prefix_path_gently(prefix, prefixlen,
                                           &prefixlen, copyfrom);
-               if (!match)
+               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(get_git_work_tree()));
+                           copyfrom, absolute_path(hint_path));
+               }
        }
 
        item->match = match;