Search code examples
gitperl

Can't use "Git add -i"


Trying to patch a file to last commit, so I run "git add -p" and "git add -i", but received the following error:

Output

That is:

D:\Working\test>git add-i
      0 [main] perl 375 child_copy: stack write copy failed, 6xFFFFC480..8x10000000e, done 6444523849, windows pid 15080, Win32 error 5
      [main] perl 375 child_copy: stack write copy failed, exFFFFC480..9x1000eeeee, done 6444523049, windows pid 15880, Win32 error 5
    481 [main) perl 375 dofork: child 376 - pid 13800, exitval ex183, errno 11 
     Can't fork, trying again in 5 seconds at C:/Program Files/Git/ming64/share/per15/Git.pm line 1647.
     main) perl 375 dofork: child 377 pid 4888, exitval ex103, errno 11 Can't fork, trying again in 5 seconds at C:/Program Files/Git/mingw64/share/per15/Git.pm line 1647.

D:\Working\test>git add -p
    0 [main] perl 9 child_copy: stack write copy failed, exFFFFC460..ex1eeeeeeee, done 6444523849, windows pid 7892, Min32 error S ses [main] perl 9 dofork: child 10 pid 11876, exitval ex183, errno 11
    Can't fork, trying again in 5 seconds at C:/Program Files/Git/mingw64/share/per15/Git.pm line 1647. 5033325 [main] perl 9 child 
     copy: stack write copy failed, exFFFFC460..9x100000000, done 6444523849, windows pid 7892, Win32 error 5 5033826 [main] perl 9 dofork: child 11 - pid 12220, exitval ex103, errno 11 Can't fork, trying again in 5 seconds at C:/Program Files/Git/ming 64/share/per15/it.pm line 1647.

Tried to uninstall and install Git, but the issue still persist.


Solution

  • Thanks to comment of @torek, I managed to use the commands after installing Per

    You should not have.

    1. The latest versions of Git for Windows no longer use Perl for git add (mingw64/libexec/git-core/git-add.exe). This is rewritten in C since Git 2.25, Q1 2020.
    2. perl.exe is part of the Git for Windows distribution: make sure your %PATH% includes C:\path\to\Git\usr\bin

    There is no need to install Perl for Git to run.


    2 years later (Q1 2022), With Git 2.36 (Q2 2022), there are still finishing touches to C rewrite of "git add -i"(man) in single-key interactive mode.

    See commit 0f584de, commit 6606d99, commit e4938ce, commit 02af15d (16 Mar 2022) by Phillip Wood (phillipwood).
    See commit 32f3ac2 (09 Mar 2022) by Junio C Hamano (gitster).
    (Merged by Junio C Hamano -- gitster -- in commit d723492, 30 Mar 2022)

    terminal: restore settings on SIGTSTP

    Signed-off-by: Phillip Wood

    If the user suspends git while it is waiting for a keypress reset the terminal before stopping and restore the settings when git resumes.
    If the user tries to resume in the background print an error message (taking care to use async safe functions) before stopping again.
    Ideally we would reprint the prompt for the user when git resumes but this patch just restarts the read().

    The signal handler is established with sigaction() rather than using sigchain_push() as this allows us to control the signal mask when the handler is invoked and ensure SA_RESTART is used to restart the read() when resuming.