Skip to content

Commit 66fd231

Browse files
author
Junio C Hamano
committed
Merge branch 'lt/push-config'
* lt/push-config: git push: add verbose flag and allow overriding of default target repository Allow '-' in config variable names
2 parents 67e78c3 + bcc785f commit 66fd231

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

builtin-push.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
static const char push_usage[] = "git-push [--all] [--tags] [-f | --force] <repository> [<refspec>...]";
1212

13-
static int all, tags, force, thin = 1;
13+
static int all, tags, force, thin = 1, verbose;
1414
static const char *execute;
1515

1616
#define BUF_SIZE (2084)
@@ -248,6 +248,8 @@ static int do_push(const char *repo)
248248
while (dest_refspec_nr--)
249249
argv[dest_argc++] = *dest_refspec++;
250250
argv[dest_argc] = NULL;
251+
if (verbose)
252+
fprintf(stderr, "Pushing to %s\n", dest);
251253
err = run_command_v(argc, argv);
252254
if (!err)
253255
continue;
@@ -281,6 +283,14 @@ int cmd_push(int argc, const char **argv, const char *prefix)
281283
i++;
282284
break;
283285
}
286+
if (!strcmp(arg, "-v")) {
287+
verbose=1;
288+
continue;
289+
}
290+
if (!strncmp(arg, "--repo=", 7)) {
291+
repo = arg+7;
292+
continue;
293+
}
284294
if (!strcmp(arg, "--all")) {
285295
all = 1;
286296
continue;

config.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ static char *parse_value(void)
103103
}
104104
}
105105

106+
static inline int iskeychar(int c)
107+
{
108+
return isalnum(c) || c == '-';
109+
}
110+
106111
static int get_value(config_fn_t fn, char *name, unsigned int len)
107112
{
108113
int c;
@@ -113,7 +118,7 @@ static int get_value(config_fn_t fn, char *name, unsigned int len)
113118
c = get_next_char();
114119
if (c == EOF)
115120
break;
116-
if (!isalnum(c))
121+
if (!iskeychar(c))
117122
break;
118123
name[len++] = tolower(c);
119124
if (len >= MAXNAME)
@@ -181,7 +186,7 @@ static int get_base_var(char *name)
181186
return baselen;
182187
if (isspace(c))
183188
return get_extended_base_var(name, baselen, c);
184-
if (!isalnum(c) && c != '.')
189+
if (!iskeychar(c) && c != '.')
185190
return -1;
186191
if (baselen > MAXNAME / 2)
187192
return -1;
@@ -573,7 +578,7 @@ int git_config_set_multivar(const char* key, const char* value,
573578
dot = 1;
574579
/* Leave the extended basename untouched.. */
575580
if (!dot || i > store.baselen) {
576-
if (!isalnum(c) || (i == store.baselen+1 && !isalpha(c))) {
581+
if (!iskeychar(c) || (i == store.baselen+1 && !isalpha(c))) {
577582
fprintf(stderr, "invalid key: %s\n", key);
578583
free(store.key);
579584
ret = 1;

0 commit comments

Comments
 (0)