git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/4] var: Don't require to be in a git repository.

From
Frank Lichtenheld <frank@lichtenheld.de>
Date
Mar 14, 2008, 17:29 UTC
Message-ID
<1205515770-3424-2-git-send-email-frank@lichtenheld.de>
In-Reply-To
<1205515770-3424-1-git-send-email-frank@lichtenheld.de>

git var works fine even when not called in a git repository. So don't require it.

This will make it possible to remove this pre-condition for some other git commands as well.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
---
 var.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/var.c b/var.c
index 0de0efa..c20ac91 100644
--- a/var.c
+++ b/var.c
@@ -51,11 +51,12 @@ static int show_config(const char *var, const char *value)
 int main(int argc, char **argv)
 {
 	const char *val;
+	int nongit;
 	if (argc != 2) {
 		usage(var_usage);
 	}
 
-	setup_git_directory();
+	setup_git_directory_gently(&nongit);
 	val = NULL;
 
 	if (strcmp(argv[1], "-l") == 0) {
-- 
1.5.4.4
Previous: Frank LichtenheldNext: Frank Lichtenheld
Message 2 of 6 in “Don't require to be in the repository if we don't need to”
  1. 0/4 Don't require to be in the repository if we don't need toFrank Lichtenheld, Mar 14, 2008
  2. 1/4 var: Don't require to be in a git repository.Frank Lichtenheld, Mar 14, 2008
  3. 2/4 Git.pm: Don't require a repository instance for configFrank Lichtenheld, Mar 14, 2008
  4. 3/4 Git.pm: Don't require repository instance for identFrank Lichtenheld, Mar 14, 2008
  5. 4/4 send-email: Don't require to be called in a repositoryFrank Lichtenheld, Mar 14, 2008
  6. Junio C HamanoMar 16, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.