aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/var.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/var.c')
-rw-r--r--builtin/var.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin/var.c b/builtin/var.c
index 2ecaed51b4..ada642a9fe 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"
@@ -40,7 +42,7 @@ static char *sequence_editor(int ident_flag UNUSED)
static char *pager(int ident_flag UNUSED)
{
- const char *pgm = git_pager(1);
+ const char *pgm = git_pager(the_repository, 1);
if (!pgm)
pgm = "cat";
@@ -178,10 +180,9 @@ static void list_vars(void)
if ((val = ptr->read(0))) {
if (ptr->multivalued && *val) {
struct string_list list = STRING_LIST_INIT_DUP;
- int i;
string_list_split(&list, val, '\n', -1);
- for (i = 0; i < list.nr; i++)
+ for (size_t i = 0; i < list.nr; i++)
printf("%s=%s\n", ptr->name, list.items[i].string);
string_list_clear(&list, 0);
} else {
@@ -220,6 +221,7 @@ int cmd_var(int argc,
const struct git_var *git_var;
char *val;
+ show_usage_if_asked(argc, argv, var_usage);
if (argc != 2)
usage(var_usage);