summaryrefslogtreecommitdiff
path: root/builtin/var.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/var.c')
-rw-r--r--builtin/var.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/builtin/var.c b/builtin/var.c
index 8cf7dd9e2e..2ecaed51b4 100644
--- a/builtin/var.c
+++ b/builtin/var.c
@@ -3,7 +3,9 @@
*
* Copyright (C) Eric Biederman, 2005
*/
+#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
+
#include "attr.h"
#include "config.h"
#include "editor.h"
@@ -12,6 +14,7 @@
#include "refs.h"
#include "path.h"
#include "strbuf.h"
+#include "run-command.h"
static const char var_usage[] = "git var (-l | <variable>)";
@@ -46,12 +49,12 @@ static char *pager(int ident_flag UNUSED)
static char *default_branch(int ident_flag UNUSED)
{
- return xstrdup_or_null(git_default_branch_name(1));
+ return repo_default_branch_name(the_repository, 1);
}
static char *shell_path(int ident_flag UNUSED)
{
- return xstrdup(SHELL_PATH);
+ return git_shell_path();
}
static char *git_attr_val_system(int ident_flag UNUSED)
@@ -90,7 +93,7 @@ static char *git_config_val_global(int ident_flag UNUSED)
char *user, *xdg;
size_t unused;
- git_global_config(&user, &xdg);
+ git_global_config_paths(&user, &xdg);
if (xdg && *xdg) {
normalize_path_copy(xdg, xdg);
strbuf_addf(&buf, "%s\n", xdg);
@@ -209,7 +212,10 @@ static int show_config(const char *var, const char *value,
return git_default_config(var, value, ctx, cb);
}
-int cmd_var(int argc, const char **argv, const char *prefix UNUSED)
+int cmd_var(int argc,
+ const char **argv,
+ const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
const struct git_var *git_var;
char *val;