Я пытаюсь выполнить git add --patch -- <file>
, и команда никогда не завершается.Оболочка MINGW64 просто отображает «Системе не удается найти указанный путь».
При сужении причины путем установки GIT_TRACE = 1 и попытки запуска некоторых команд компонента я обнаружил, что ошибка вызванаОпция --interactive и тот же эффект видны независимо от того, какая команда git выполняется.
Установка GIT_TRACE = 1 для следующей интерактивной команды дает вывод, показанный:
$ GIT_TRACE=1 git add --interactive -- .gitignore
19:16:47.185964 git.c:350 trace: built-in: git 'add' '--interactive' '--' '.gitignore'
19:16:47.185964 run-command.c:336 trace: run_command: 'add--interactive' '--' '.gitignore'
19:16:47.215964 git.c:564 trace: exec: 'git-add--interactive' '--' '.gitignore'
19:16:47.215964 run-command.c:336 trace: run_command: 'git-add--interactive' '--' '.gitignore'
19:16:47.345964 git.c:350 trace: built-in: git 'rev-parse' '--git-dir'
19:16:47.375964 git.c:350 trace: built-in: git 'rev-parse' '--show-prefix'
19:16:47.405964 git.c:350 trace: built-in: git 'config' '--get-colorbool' 'color.interactive' 'false'
19:16:47.436965 git.c:350 trace: built-in: git 'config' '--get-colorbool' 'color.diff' 'false'
19:16:47.466965 git.c:350 trace: built-in: git 'config' '--get-color' 'reset'
19:16:47.496965 git.c:350 trace: built-in: git 'config' '--get' 'diff.algorithm'
19:16:47.546965 git.c:350 trace: built-in: git 'config' '--bool' '--get' 'diff.compactionheuristic'
19:16:47.576965 git.c:350 trace: built-in: git 'config' '--get' 'interactive.difffilter'
19:16:47.606965 git.c:350 trace: built-in: git 'config' '--bool' '--get' 'interactive.singlekey'
19:16:47.636965 git.c:350 trace: built-in: git 'rev-parse' '--git-dir'
19:16:47.666965 git.c:350 trace: built-in: git 'update-index' '--refresh'
19:16:47.793965 git.c:350 trace: built-in: git 'ls-files' '--' '.gitignore'
The system cannot find the path specified.
19:16:47.843965 git.c:350 trace: built-in: git 'diff-index' '--cached' '--numstat' '--summary' '4b825dc642cb6eb9a060e54bf8d69288fbee4904' '--' '.gitignore'
19:16:47.873966 git.c:350 trace: built-in: git 'diff-files' '--numstat' '--summary' '--raw' '--' '.gitignore'
ПопыткаДобавить файл без интерактивной опции работает как положено.Операция завершается ошибкой только при добавленной интерактивной опции (или патче).
Обратите внимание, что у меня изначально возникла следующая проблема при попытке выполнить команду:
Can't locate Git.pm in @INC (you may need to install the Git module) (@INC contains: /mingw64/share/perl5/site_perl D:/Apps/StrawberryPerl/perl/site/lib D:/Apps/StrawberryPerl/perl/vendor/lib D:/Apps/StrawberryPerl/perl/lib) at C:\Program Files\Git\mingw64/libexec/git-core\git-add--interactive line 7.
BEGIN failed--compilation aborted at C:\Program Files\Git\mingw64/libexec/git-core\git-add--interactive line 7.
Однако после копированияМодули Git.pm и Error.pm в папке perl include, проблема изменилась на проблему, описанную в начале этого вопроса.
Наконец, в качестве дальнейшей попытки выяснить это я выполнил команду вВ командной строке Windows (cmd.exe) и произошла совершенно другая ошибка:
c:\code\proj>git add --patch .gitignore
error: wrong number of arguments
usage: git config [<options>]
Config file location
--global use global config file
--system use system config file
--local use repository config file
-f, --file <file> use given config file
--blob <blob-id> read config from given blob object
Action
--get get value: name [value-regex]
--get-all get all values: key [value-regex]
--get-regexp get values for regexp: name-regex [value-regex]
--get-urlmatch get value specific for the URL: section[.var] URL
--replace-all replace all matching variables: name value
[value_regex]
--add add a new variable: name value
--unset remove a variable: name [value-regex]
--unset-all remove all matches: name [value-regex]
--rename-section rename section: old-name new-name
--remove-section remove a section: name
-l, --list list all
-e, --edit open an editor
--get-color find the color configured: slot [default]
--get-colorbool find the color setting: slot [stdout-is-tty]
Type
--bool value is "true" or "false"
--int value is decimal number
--bool-or-int value is --bool or --int
--path value is a path (file or directory name)
Other
-z, --null terminate values with NUL byte
--name-only show variable names only
--includes respect include directives on lookup
--show-origin show origin of config (file, standard input, blob, command line)
config --get-color color.interactive.prompt bold blue: command returned error: 129
Я проверил свои файлы конфигурации git и не установил эту опцию, поэтому я предполагаю, что это где-то по умолчанию.
Помимо очевидного аспекта вопроса (то есть, чтобы опции --interactive
или --patch
работали как положено), я также был бы признателен за любые советы или советы по устранению этой проблемы.Различные опции TRACE, которые я использовал, на самом деле не выдвигали на первый план, где была проблема, кроме того, чтобы показать мне, что проблема была в опции --interactive
.