Hi,

Toni Uebernickel wrote:

> I updated to git version v2.14.2 on macOS using homebrew.
>
> Since then `git add --patch` and `git stash save --patch` are not
> working anymore. It's just printing the complete diff without ever
> stopping to ask for actions. This results in an unusable state, as
> the whole command option is rendered useless.

Would a patch like the following help?

I am worried that other scripts using diff-files would need the same
kind of patch.  So it seems worthwhile to look for alternatives.

An alternative would be to partially roll back v2.14.2~61^2~4 (color:
check color.ui in git_default_config, 2017-07-13) by making it not
take effect for plumbing commands (i.e., by adding a boolean to
"struct startup_info" to indicate whether a command is low-level
plumbing).  That would make the behavior of Git harder to explain so I
don't particularly like it.  Plus it defeats the point of the patch.

Yet another alternative would be to treat color.ui=always as a
deprecated synonym for color.ui=auto.  I think that's my preferred
fix.

What do you think?

Thanks again for reporting,
Jonathan

diff --git i/git-add--interactive.perl w/git-add--interactive.perl
index 28b325d754..4ea69538c7 100755
--- i/git-add--interactive.perl
+++ w/git-add--interactive.perl
@@ -101,49 +101,49 @@ sub apply_patch_for_stash;
 
 my %patch_modes = (
        'stage' => {
-               DIFF => 'diff-files -p',
+               DIFF => 'diff-files --no-color -p',
                APPLY => sub { apply_patch 'apply --cached', @_; },
                APPLY_CHECK => 'apply --cached',
                FILTER => 'file-only',
                IS_REVERSE => 0,
        },
        'stash' => {
-               DIFF => 'diff-index -p HEAD',
+               DIFF => 'diff-index --no-color -p HEAD',
                APPLY => sub { apply_patch 'apply --cached', @_; },
                APPLY_CHECK => 'apply --cached',
                FILTER => undef,
                IS_REVERSE => 0,
        },
        'reset_head' => {
-               DIFF => 'diff-index -p --cached',
+               DIFF => 'diff-index --no-color -p --cached',
                APPLY => sub { apply_patch 'apply -R --cached', @_; },
                APPLY_CHECK => 'apply -R --cached',
                FILTER => 'index-only',
                IS_REVERSE => 1,
        },
        'reset_nothead' => {
-               DIFF => 'diff-index -R -p --cached',
+               DIFF => 'diff-index --no-color -R -p --cached',
                APPLY => sub { apply_patch 'apply --cached', @_; },
                APPLY_CHECK => 'apply --cached',
                FILTER => 'index-only',
                IS_REVERSE => 0,
        },
        'checkout_index' => {
-               DIFF => 'diff-files -p',
+               DIFF => 'diff-files --no-color -p',
                APPLY => sub { apply_patch 'apply -R', @_; },
                APPLY_CHECK => 'apply -R',
                FILTER => 'file-only',
                IS_REVERSE => 1,
        },
        'checkout_head' => {
-               DIFF => 'diff-index -p',
+               DIFF => 'diff-index --no-color -p',
                APPLY => sub { apply_patch_for_checkout_commit '-R', @_ },
                APPLY_CHECK => 'apply -R',
                FILTER => undef,
                IS_REVERSE => 1,
        },
        'checkout_nothead' => {
-               DIFF => 'diff-index -R -p',
+               DIFF => 'diff-index --no-color -R -p',
                APPLY => sub { apply_patch_for_checkout_commit '', @_ },
                APPLY_CHECK => 'apply',
                FILTER => undef,

Reply via email to