diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-03-16 22:43:29 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-03-16 22:43:29 +0300 |
commit | e96327c94799460e02b38b242995eab0600ebbd6 (patch) | |
tree | 258a6686b3473520de72d6ba6ea215bd3f7620d7 /setup.c | |
parent | 30e9940356dc67959877f4b2417da33ebdefbb79 (diff) | |
parent | 5c20398699165a91af2d81ea2d20385bc8dd3627 (diff) |
Merge branch 'es/outside-repo-errmsg-hints'
An earlier update to show the location of working tree in the error
message did not consider the possibility that a git command may be
run in a bare repository, which has been corrected.
* es/outside-repo-errmsg-hints:
prefix_path: show gitdir if worktree unavailable
Diffstat (limited to 'setup.c')
-rw-r--r-- | setup.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -120,9 +120,13 @@ char *prefix_path_gently(const char *prefix, int len, char *prefix_path(const char *prefix, int len, const char *path) { char *r = prefix_path_gently(prefix, len, NULL, path); - if (!r) + if (!r) { + const char *hint_path = get_git_work_tree(); + if (!hint_path) + hint_path = get_git_dir(); die(_("'%s' is outside repository at '%s'"), path, - absolute_path(get_git_work_tree())); + absolute_path(hint_path)); + } return r; } |