When the worktrees directory is empty, the `ret` will be returned
uninitialized. Fix it by initializing the value.

Signed-off-by: Stefan Beller <sbel...@google.com>
---

This goes on top of 1a248cf (origin/sb/submodule-embed-gitdir);
ideally to be squashed, but as it is in next already, as a separate
patch.

Thanks,
Stefan

 worktree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/worktree.c b/worktree.c
index d4606aa8cd..828fd7a0ad 100644
--- a/worktree.c
+++ b/worktree.c
@@ -387,7 +387,7 @@ int submodule_uses_worktrees(const char *path)
        struct strbuf sb = STRBUF_INIT;
        DIR *dir;
        struct dirent *d;
-       int ret;
+       int ret = 0;
        struct repository_format format;
 
        submodule_gitdir = git_pathdup_submodule(path, "%s", "");
-- 
2.11.0.rc2.50.g8bda6b2.dirty

Reply via email to