git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Beller <sbeller@google.com>
To: gitster@pobox.com, larsxschneider@gmail.com
Cc: git@vger.kernel.org, Stefan Beller <sbeller@google.com>
Subject: [PATCH] worktree: initialize return value for submodule_uses_worktrees
Date: Tue, 27 Dec 2016 09:50:13 -0800	[thread overview]
Message-ID: <20161227175013.12747-1-sbeller@google.com> (raw)
In-Reply-To: <7E1C7387-4F37-423F-803D-3B5690B49D40@gmail.com>

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

Signed-off-by: Stefan Beller <sbeller@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


  parent reply	other threads:[~2016-12-27 17:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-22 22:18 What's cooking in git.git (Dec 2016, #07; Thu, 22) Junio C Hamano
2016-12-23 10:18 ` Duy Nguyen
2016-12-23 17:46   ` Junio C Hamano
2016-12-24 10:50     ` Duy Nguyen
2016-12-23 23:55 ` Lars Schneider
2016-12-26 20:33   ` Stefan Beller
2016-12-27 17:50   ` Stefan Beller [this message]
2016-12-27 22:12     ` [PATCH] worktree: initialize return value for submodule_uses_worktrees Junio C Hamano
2016-12-27 22:18       ` Stefan Beller
2016-12-27 22:47         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161227175013.12747-1-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=larsxschneider@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).