diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2018-08-28 17:20:18 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-30 09:28:02 -0700 |
commit | 4c5fa9e6c4091eea9d8df3466b18ddb2812cd934 (patch) | |
tree | edd8e082bbc5fe414466daad52cff4fc4c7a4126 /git-gui/po | |
parent | Git 2.19-rc1 (diff) | |
download | tgif-4c5fa9e6c4091eea9d8df3466b18ddb2812cd934.tar.xz |
worktree: don't die() in library function find_worktree()
Callers don't expect library function find_worktree() to die(); they
expect it to return the named worktree if found, or NULL if not.
Although find_worktree() itself never invokes die(), it calls
real_pathdup() with 'die_on_error' incorrectly set to 'true', thus will
die() indirectly if the user-provided path is not to real_pathdup()'s
liking. This can be observed, for instance, with any git-worktree
command which searches for an existing worktree:
$ git worktree unlock foo
fatal: 'foo' is not a working tree
$ git worktree unlock foo/bar
fatal: Invalid path '.../foo': No such file or directory
The first error message is the expected one from "git worktree unlock"
not finding the specified worktree; the second is from find_worktree()
invoking real_pathdup() incorrectly and die()ing prematurely.
Aside from the inconsistent error message between the two cases, this
bug hasn't otherwise been a serious problem since existing callers all
die() anyhow when the worktree can't be found. However, that may not be
true of callers added in the future, so fix find_worktree() to avoid
die()ing.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-gui/po')
0 files changed, 0 insertions, 0 deletions