A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/gitster/git/commit/86362f7205a31188846de0aed94620c1f0776931 below:

Merge branch 'jk/credential-quit' · gitster/git@86362f7 · GitHub

File tree Expand file treeCollapse file tree 6 files changed

+35

-5

lines changed

Filter options

Expand file treeCollapse file tree 6 files changed

+35

-5

lines changed Original file line number Diff line number Diff line change

@@ -913,6 +913,10 @@ for further details.

913 913

and read the password from its STDOUT. See also the 'core.askpass'

914 914

option in linkgit:git-config[1].

915 915 916 +

'GIT_TERMINAL_PROMPT'::

917 +

If this environment variable is set to `0`, git will not prompt

918 +

on the terminal (e.g., when asking for HTTP authentication).

919 + 916 920

'GIT_CONFIG_NOSYSTEM'::

917 921

Whether to skip reading settings from the system-wide

918 922

`$(prefix)/etc/gitconfig` file. This environment variable can

Original file line number Diff line number Diff line change

@@ -248,7 +248,10 @@ FORMAT` in linkgit:git-credential[7] for a detailed specification).

248 248

For a `get` operation, the helper should produce a list of attributes

249 249

on stdout in the same format. A helper is free to produce a subset, or

250 250

even no values at all if it has nothing useful to provide. Any provided

251 -

attributes will overwrite those already known about by Git.

251 +

attributes will overwrite those already known about by Git. If a helper

252 +

outputs a `quit` attribute with a value of `true` or `1`, no further

253 +

helpers will be consulted, nor will the user be prompted (if no

254 +

credential has been provided, the operation will then fail).

252 255 253 256

For a `store` or `erase` operation, the helper's output is ignored.

254 257

If it fails to perform the requested operation, it may complain to

Original file line number Diff line number Diff line change

@@ -173,6 +173,8 @@ int credential_read(struct credential *c, FILE *fp)

173 173

c->path = xstrdup(value);

174 174

} else if (!strcmp(key, "url")) {

175 175

credential_from_url(c, value);

176 +

} else if (!strcmp(key, "quit")) {

177 +

c->quit = !!git_config_bool("quit", value);

176 178

}

177 179

/*

178 180

* Ignore other lines; we don't know what they mean, but

@@ -274,6 +276,9 @@ void credential_fill(struct credential *c)

274 276

credential_do(c, c->helpers.items[i].string, "get");

275 277

if (c->username && c->password)

276 278

return;

279 +

if (c->quit)

280 +

die("credential helper '%s' told us to quit",

281 +

c->helpers.items[i].string);

277 282

}

278 283 279 284

credential_getpass(c);

Original file line number Diff line number Diff line change

@@ -7,6 +7,7 @@ struct credential {

7 7

struct string_list helpers;

8 8

unsigned approved:1,

9 9

configured:1,

10 +

quit:1,

10 11

use_http_path:1;

11 12 12 13

char *username;

Original file line number Diff line number Diff line change

@@ -57,11 +57,19 @@ char *git_prompt(const char *prompt, int flags)

57 57

r = do_askpass(askpass, prompt);

58 58

}

59 59 60 -

if (!r)

61 -

r = git_terminal_prompt(prompt, flags & PROMPT_ECHO);

62 60

if (!r) {

63 -

/* prompts already contain ": " at the end */

64 -

die("could not read %s%s", prompt, strerror(errno));

61 +

const char *err;

62 + 63 +

if (git_env_bool("GIT_TERMINAL_PROMPT", 1)) {

64 +

r = git_terminal_prompt(prompt, flags & PROMPT_ECHO);

65 +

err = strerror(errno);

66 +

} else {

67 +

err = "terminal prompts disabled";

68 +

}

69 +

if (!r) {

70 +

/* prompts already contain ": " at the end */

71 +

die("could not read %s%s", prompt, err);

72 +

}

65 73

}

66 74

return r;

67 75

}

Original file line number Diff line number Diff line change

@@ -289,4 +289,13 @@ test_expect_success 'http paths can be part of context' '

289 289

EOF

290 290

'

291 291 292 +

test_expect_success 'helpers can abort the process' '

293 +

test_must_fail git \

294 +

-c credential.helper="!f() { echo quit=1; }; f" \

295 +

-c credential.helper="verbatim foo bar" \

296 +

credential fill >stdout &&

297 +

>expect &&

298 +

test_cmp expect stdout

299 +

'

300 + 292 301

test_done

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4