Как остановить git add -patch не отображая подсказку в mintty

Когда используешь git add --patch somefile.txt в Cygwin я получаю странный ответ.

После первого ввода команды он ждет, пока я нажму клавишу ввода, ничего не показывая. Как только я нажимаю Enter, я получаю следующий вывод

--- a/somefile.txt
+++ b/somefile.txt  
@@ -m,n +m,n @@
-Aple
+Apple
 Bear
 Cat
 Dog

Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk nor any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk nor any of the later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk un

И оставляет карат после un

После выбора, в этом случае n Я получаю отдых

J - leave this hunk unn
decided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
? - print help
@@ -1,4 +1,4 @@
-Lne 1
+Line 1
 Line 2
 Line 3
 Line 4
Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? @@ -289,6 +289,8 @@
 Line 289
 Line 290
 Line 291
+Line 292
+Line 293
 Line 294
 Line 295
 Line 296

Шаблон продолжается для остальной части файла, оставляя меня неспособным сказать, какой блок мне предлагается.

2 ответа

Решение

Учитывая количество голосов, это получилось, похоже, я не единственный с этой проблемой.

Казалось бы, установка Cygwin по умолчанию не включает git. Однако, если вы установили git отдельно, он будет добавлен в ваш путь к Windows и будет работать во всех остальных отношениях.

т.е.

> which git
c:\Program Files (x86)\Git\bin\git

После того, как я установил git через Cygwin и использовал эту версию, проблема была решена

т.е.

> which git
/usr/bin/git

Я обычно вижу две настройки при использовании git с Cygwin.

Первый (если ваш git config -l не включать его) о пейджере (как в этом gitconfig файл)

git config core.pager C:/cygwin/root/bin/less.exe

[core]
        # we want to use cygwin's less, because msys's doesn't play well
        # with i/o via cygwin bash. This would be the default, but for the fact
        # that msysgit prepends `dirname argv[0]` to $PATH.
        pager = C:/cygwin/root/bin/less.exe

Другие о TTY, как в этом сообщении в блоге:

export TERM=cygwin
export LESS=FRSX

Одна из этих настроек должна сделать ваш git add -p работает более плавно

Другие вопросы по тегам