aaafd603
|
38
|
static int disable_bits(tcflag_t bits)
|
aaafd603
|
49
|
t.c_lflag &= ~bits;
|
aaafd603
|
59
|
static int disable_echo(void)
|
aaafd603
|
61
|
return disable_bits(ECHO);
|
74e42899
|
64
|
static int enable_non_canonical(void)
|
74e42899
|
66
|
return disable_bits(ICANON | ECHO);
|
61131685
|
255
|
static int sequence_entry_cmp(const void *hashmap_cmp_fn_data,
|
61131685
|
260
|
return strcmp(e1->sequence, keydata ? keydata : e2->sequence);
|
61131685
|
263
|
static int is_known_escape_sequence(const char *sequence)
|
61131685
|
268
|
if (!initialized) {
|
61131685
|
269
|
struct child_process cp = CHILD_PROCESS_INIT;
|
61131685
|
270
|
struct strbuf buf = STRBUF_INIT;
|
61131685
|
273
|
hashmap_init(&sequences, (hashmap_cmp_fn)sequence_entry_cmp,
|
61131685
|
276
|
argv_array_pushl(&cp.args, "infocmp", "-L", "-1", NULL);
|
61131685
|
277
|
if (pipe_command(&cp, NULL, 0, &buf, 0, NULL, 0))
|
61131685
|
278
|
strbuf_setlen(&buf, 0);
|
61131685
|
280
|
for (eol = p = buf.buf; *p; p = eol + 1) {
|
61131685
|
281
|
p = strchr(p, '=');
|
61131685
|
282
|
if (!p)
|
61131685
|
283
|
break;
|
61131685
|
284
|
p++;
|
61131685
|
285
|
eol = strchrnul(p, '\n');
|
61131685
|
287
|
if (starts_with(p, "\\E")) {
|
61131685
|
288
|
char *comma = memchr(p, ',', eol - p);
|
61131685
|
291
|
p[0] = '^';
|
61131685
|
292
|
p[1] = '[';
|
61131685
|
293
|
FLEX_ALLOC_MEM(e, sequence, p, comma - p);
|
61131685
|
294
|
hashmap_entry_init(&e->entry,
|
61131685
|
295
|
strhash(e->sequence));
|
61131685
|
296
|
hashmap_add(&sequences, &e->entry);
|
61131685
|
298
|
if (!*eol)
|
61131685
|
299
|
break;
|
61131685
|
301
|
initialized = 1;
|
61131685
|
304
|
return !!hashmap_get_from_hash(&sequences, strhash(sequence), sequence);
|
74e42899
|
307
|
int read_key_without_echo(struct strbuf *buf)
|
74e42899
|
312
|
if (warning_displayed || enable_non_canonical() < 0) {
|
74e42899
|
313
|
if (!warning_displayed) {
|
74e42899
|
316
|
warning_displayed = 1;
|
74e42899
|
319
|
return strbuf_getline(buf, stdin);
|
74e42899
|
322
|
strbuf_reset(buf);
|
74e42899
|
323
|
ch = getchar();
|
74e42899
|
324
|
if (ch == EOF) {
|
74e42899
|
325
|
restore_term();
|
74e42899
|
326
|
return EOF;
|
74e42899
|
328
|
strbuf_addch(buf, ch);
|
53fa2153
|
330
|
if (ch == '\033' /* ESC */) {
|
53fa2153
|
338
|
strbuf_splice(buf, buf->len - 1, 1, "^[", 2);
|
61131685
|
345
|
while (!is_known_escape_sequence(buf->buf)) {
|
53fa2153
|
346
|
struct pollfd pfd = { .fd = 0, .events = POLLIN };
|
53fa2153
|
348
|
if (poll(&pfd, 1, 500) < 1)
|
53fa2153
|
349
|
break;
|
53fa2153
|
351
|
ch = getchar();
|
53fa2153
|
352
|
if (ch == EOF)
|
53fa2153
|
353
|
return 0;
|
53fa2153
|
354
|
strbuf_addch(buf, ch);
|
74e42899
|
358
|
restore_term();
|
74e42899
|
359
|
return 0;
|
Denton Liu
|
38ac131a
|
sequencer: extract perform_autostash() from rebase
|
Denton Liu
|
daf6b9e4
|
sequencer: use file strbuf for read_oneliner()
|
Denton Liu
|
afc27b82
|
rebase: use read_oneliner()
|
Denton Liu
|
d4e8a655
|
rebase: generify reset_head()
|
Denton Liu
|
82c638ef
|
rebase: use apply_autostash() from sequencer.c
|
Denton Liu
|
f2096173
|
reset: extract reset_head() from rebase
|
Emily Shaffer
|
fae9bc5a
|
grep: support the --pathspec-from-file option
|
Johannes Schindelin
|
53fa2153
|
built-in add -p: handle Escape sequences in interactive.singlekey mode
|
Johannes Schindelin
|
61131685
|
built-in add -p: handle Escape sequences more efficiently
|
Johannes Schindelin
|
74e42899
|
terminal: add a new function to read a single keystroke
|
Johannes Schindelin
|
aaafd603
|
terminal: make the code of disable_echo() reusable
|
Johannes Schindelin
|
60b7e674
|
built-in add -p: respect the `interactive.singlekey` config setting
|
Johannes Schindelin
|
ad9af7e8
|
built-in add -p: support interactive.diffFilter
|
Jonathan Nieder
|
ee70c128
|
index: offer advice for unknown index extensions
|
Josh Steadmon
|
6da1f1a9
|
protocol: advertise multiple supported versions
|
Matheus Tavares
|
beebb9d2
|
object-store: allow threaded access to object reading
|
Phillip Wood
|
430b75f7
|
commit: give correct advice for empty commit during a rebase
|
Phillip Wood
|
012ecfce
|
rebase: fix advice when a fixup creates an empty commit
|
Elijah Newren
|
4d861fad
|
rebase, sequencer: remove the broken GIT_QUIET handling
|
Elijah Newren
|
7ee11336
|
rebase: extend the options for handling of empty commits
|
Elijah Newren
|
e8c1d7e0
|
rebase: make the backend configurable via config setting
|
Hans Jerry Illikainen
|
63add83b
|
gpg-interface: add minTrustLevel as a configuration option
|
Jeff King
|
4f0bd8b9
|
pack-objects: improve partial packfile reuse
|
Jeff King
|
7cb9754e
|
pack-objects: introduce pack.allowPackReuse
|
Jeff King
|
7b143c16
|
pack-bitmap: introduce bitmap_walk_contains()
|
Johannes Schindelin
|
52628f94
|
built-in add -p: implement the "checkout" patch modes
|
Johannes Schindelin
|
d2a233cb
|
built-in add -p: prepare for patch modes other than "stage"
|
Johannes Schindelin
|
90a6bb98
|
legacy stash -p: respect the add.interactive.usebuiltin setting
|
Johannes Schindelin
|
6610e462
|
built-in stash: use the built-in `git add -p` if so configured
|