aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin-apply.c2
-rw-r--r--builtin-bundle.c2
-rw-r--r--builtin-config.c2
-rw-r--r--builtin-diff-files.c2
-rw-r--r--builtin-diff.c2
-rw-r--r--builtin-ls-remote.c2
-rw-r--r--git.c4
-rw-r--r--setup.c8
8 files changed, 16 insertions, 8 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index a3f075df4..b5f78ac3a 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2994,7 +2994,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
int read_stdin = 1;
int inaccurate_eof = 0;
int errs = 0;
- int is_not_gitdir = 0;
+ int is_not_gitdir;
const char *whitespace_option = NULL;
diff --git a/builtin-bundle.c b/builtin-bundle.c
index 9f38e2176..ac476e7a4 100644
--- a/builtin-bundle.c
+++ b/builtin-bundle.c
@@ -14,7 +14,7 @@ static const char *bundle_usage="git-bundle (create <bundle> <git-rev-list args>
int cmd_bundle(int argc, const char **argv, const char *prefix)
{
struct bundle_header header;
- int nongit = 0;
+ int nongit;
const char *cmd, *bundle_file;
int bundle_fd = -1;
char buffer[PATH_MAX];
diff --git a/builtin-config.c b/builtin-config.c
index 2b9a4261d..c34bc8b6a 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -264,7 +264,7 @@ static int get_colorbool(int argc, const char **argv)
int cmd_config(int argc, const char **argv, const char *prefix)
{
- int nongit = 0;
+ int nongit;
char* value;
const char *file = setup_git_directory_gently(&nongit);
diff --git a/builtin-diff-files.c b/builtin-diff-files.c
index 4abe3c28f..e2306c162 100644
--- a/builtin-diff-files.c
+++ b/builtin-diff-files.c
@@ -16,7 +16,7 @@ COMMON_DIFF_OPTIONS_HELP;
int cmd_diff_files(int argc, const char **argv, const char *prefix)
{
struct rev_info rev;
- int nongit = 0;
+ int nongit;
int result;
prefix = setup_git_directory_gently(&nongit);
diff --git a/builtin-diff.c b/builtin-diff.c
index 444ff2fd9..7c2a8412f 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -210,7 +210,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
int ents = 0, blobs = 0, paths = 0;
const char *path = NULL;
struct blobinfo blob[2];
- int nongit = 0;
+ int nongit;
int result = 0;
/*
diff --git a/builtin-ls-remote.c b/builtin-ls-remote.c
index 8907a89d6..06ab8da1f 100644
--- a/builtin-ls-remote.c
+++ b/builtin-ls-remote.c
@@ -31,7 +31,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
{
int i;
const char *dest = NULL;
- int nongit = 0;
+ int nongit;
unsigned flags = 0;
const char *uploadpack = NULL;
const char **pattern = NULL;
diff --git a/git.c b/git.c
index 13de8018f..b7729d72c 100644
--- a/git.c
+++ b/git.c
@@ -142,14 +142,14 @@ static int split_cmdline(char *cmdline, const char ***argv)
static int handle_alias(int *argcp, const char ***argv)
{
- int nongit = 0, envchanged = 0, ret = 0, saved_errno = errno;
+ int envchanged = 0, ret = 0, saved_errno = errno;
const char *subdir;
int count, option_count;
const char** new_argv;
const char *alias_command;
char *alias_string;
- subdir = setup_git_directory_gently(&nongit);
+ subdir = setup_git_directory_gently(NULL);
alias_command = (*argv)[0];
alias_string = alias_lookup(alias_command);
diff --git a/setup.c b/setup.c
index 41e298b8f..3d2d9580f 100644
--- a/setup.c
+++ b/setup.c
@@ -326,6 +326,14 @@ const char *setup_git_directory_gently(int *nongit_ok)
int len, offset;
/*
+ * Let's assume that we are in a git repository.
+ * If it turns out later that we are somewhere else, the value will be
+ * updated accordingly.
+ */
+ if (nongit_ok)
+ *nongit_ok = 0;
+
+ /*
* If GIT_DIR is set explicitly, we're not going
* to do any discovery, but we still do repository
* validation.