Updated to v2.14.2 on macOS; git add --patch broken

13 messages, 4 authors, 2017-10-03 · open the first message on its own page

Updated to v2.14.2 on macOS; git add --patch broken

From: Toni Uebernickel <hidden>
Date: 2017-09-27 13:23:32

Hi there,

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.

For illustration see: https://asciinema.org/a/fw6cy9Ds6CeNOt4RYknLYgOD3

Kind Regards,
Toni

--
Toni Uebernickel

tuebernickel@gmail.com - https://keybase.io/havvg
https://github.com/havvg - https://www.xing.com/profile/Toni_Uebernickel

Re: Updated to v2.14.2 on macOS; git add --patch broken

From: Jeff King <hidden>
Date: 2017-09-27 17:07:22

On Wed, Sep 27, 2017 at 03:23:21PM +0200, Toni Uebernickel wrote:
Hi there,

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.
What was the previous version that was working? It is possible to bisect
to find the culprit commit?

There weren't any updates to git-add--interactive.perl (the program that
underlies the `--patch` implementation in both cases) in v2.14.2, and
very few even in v2.14.0. Of course the problem may be in one of the
sub-programs it calls.

-Peff

Re: Updated to v2.14.2 on macOS; git add --patch broken

From: Toni Uebernickel <hidden>
Date: 2017-09-27 17:28:57

The previous version was v2.13.2.
I switched back to this version, and it works perfectly fine; without any changes to my system.

--
Toni Uebernickel

tuebernickel@gmail.com - https://keybase.io/havvg
https://github.com/havvg - https://www.xing.com/profile/Toni_Uebernickel
On 27. Sep 2017, at 19:07, Jeff King [off-list ref] wrote:

On Wed, Sep 27, 2017 at 03:23:21PM +0200, Toni Uebernickel wrote:
quoted
Hi there,

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.
What was the previous version that was working? It is possible to bisect
to find the culprit commit?

There weren't any updates to git-add--interactive.perl (the program that
underlies the `--patch` implementation in both cases) in v2.14.2, and
very few even in v2.14.0. Of course the problem may be in one of the
sub-programs it calls.

-Peff

Re: Updated to v2.14.2 on macOS; git add --patch broken

From: Jeff King <hidden>
Date: 2017-09-27 18:01:33

On Wed, Sep 27, 2017 at 07:28:49PM +0200, Toni Uebernickel wrote:
The previous version was v2.13.2.
I switched back to this version, and it works perfectly fine; without any changes to my system.
Thanks for confirming.

There aren't a lot of changes to the script between v2.13.2 and v2.14.2.
The most plausible culprit is d5addcf522 (add--interactive: handle EOF
in prompt_yesno, 2017-06-21), but I'm scratching my head over how that
could cause what you're seeing.

Are you able to build Git from source and bisect the problem? It would
help to know which commit introduced the problem.

-Peff

Re: Updated to v2.14.2 on macOS; git add --patch broken

From: Jonathan Nieder <hidden>
Date: 2017-09-27 19:52:08

Hi,

Jeff King wrote:
On Wed, Sep 27, 2017 at 07:28:49PM +0200, Toni Uebernickel wrote:
quoted
The previous version was v2.13.2.
I switched back to this version, and it works perfectly fine; without any changes to my system.
Thanks for confirming.

There aren't a lot of changes to the script between v2.13.2 and v2.14.2.
The most plausible culprit is d5addcf522 (add--interactive: handle EOF
in prompt_yesno, 2017-06-21), but I'm scratching my head over how that
could cause what you're seeing.

Are you able to build Git from source and bisect the problem? It would
help to know which commit introduced the problem.
How about this change?

 commit 136c8c8b8fa39f1315713248473dececf20f8fe7
 Author: Jeff King [off-list ref]
 Date:   Thu Jul 13 11:07:03 2017 -0400

     color: check color.ui in git_default_config()

Toni, what is the output of "git config -l"?

Thanks,
Jonathan

Re: Updated to v2.14.2 on macOS; git add --patch broken

From: Jonathan Nieder <hidden>
Date: 2017-09-27 19:53:19

Jonathan Nieder wrote:
Jeff King wrote:
quoted
There aren't a lot of changes to the script between v2.13.2 and v2.14.2.
The most plausible culprit is d5addcf522 (add--interactive: handle EOF
in prompt_yesno, 2017-06-21), but I'm scratching my head over how that
could cause what you're seeing.

Are you able to build Git from source and bisect the problem? It would
help to know which commit introduced the problem.
How about this change?

 commit 136c8c8b8fa39f1315713248473dececf20f8fe7
 Author: Jeff King [off-list ref]
 Date:   Thu Jul 13 11:07:03 2017 -0400

     color: check color.ui in git_default_config()
Uh, I think I was thinking of another thread when I wrote this.  Sorry
for the nonsense.
Toni, what is the output of "git config -l"?
I'm still curious about this.

Thanks,
Jonathan

Re: Updated to v2.14.2 on macOS; git add --patch broken

From: Toni Uebernickel <hidden>
Date: 2017-09-28 05:04:07

Hi Jonathan,

my configuration reads as follows, I only removed private tokens content.
I will try to get more details on which version exactly breaks the command.

Kind Regards,
Toni

core.excludesfile=/usr/local/etc/gitignore
core.whitespace=trailing-space,space-before-tab,-indent-with-non-tab,tab-in-indent,tabwidth=2
core.autocrlf=input
core.ignorecase=true
gpg.program=gpg2
credential.helper=osxkeychain
diff.patience=true
diff.algorithm=patience
diff.compactionheuristic=true
notes.displayref=refs/notes/*
advice.detachedhead=false
pull.rebase=preserve
push.default=upstream
merge.ff=false
merge.summary=true
merge.log=false
rerere.enabled=true
rebase.autosquash=true
rebase.autostash=true
stash.showpatch=true
branch.autosetuprebase=always
color.ui=always
color.branch.current=yellow reverse
color.branch.local=yellow
color.branch.remote=green
color.diff.meta=yellow
color.diff.func=cyan bold
color.diff.frag=magenta
color.diff.old=red
color.diff.new=green
color.diff.whitespace=red reverse
color.status.added=green
color.status.changed=yellow
color.status.untracked=cyan
color.status.nobranch=red
pretty.changelog=format:* %h %s
pretty.public-changelog=format:* %s
pretty.pretty-history=format:%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset
gitflow.multi-hotfix=true
gitflow.prefix.feature=feature/
gitflow.prefix.release=release/
gitflow.prefix.bugfix=bugfix/
gitflow.prefix.hotfix=hotfix/
gitflow.prefix.support=support/
gitflow.prefix.versiontag=v
gitflow.feature.finish.rebase=true
gitflow.feature.finish.no-ff=true
gitflow.feature.finish.keepremote=true
gitflow.feature.finish.keeplocal=false
gitflow.release.finish.keepremote=true
gitflow.release.finish.keeplocal=false
gitflow.hotfix.finish.keepremote=true
gitflow.hotfix.finish.keeplocal=false
alias.st=status
alias.co=checkout
alias.di=diff
alias.ci=commit
alias.ci-rm=!git commit && git notes --ref=redmine add
alias.ci-gh=!git commit && git notes --ref=github.issues add
alias.ci-n=!git commit && git notes add
alias.amend=commit --amend
alias.update=add -u
alias.up-head=!f() { git diff-tree --no-commit-id --name-only --diff-filter=ACMR -r HEAD; }; git add -p `f`
alias.staged=diff --cached
alias.ls-staged=diff-index --cached --name-only HEAD
alias.di-staged=!git diff-index --cached --name-only --diff-filter=ACMR HEAD | xargs git di
alias.co-staged=!git diff-index --cached --name-only --diff-filter=ACMR HEAD | xargs git co
alias.up-staged=!f() { git ls-staged; }; git add -p `f`
alias.coding-standards=!php-cs-fixer fix
alias.cs=!f() { git diff-tree --no-commit-id --name-only --diff-filter=ACMR -r "$1" | xargs -n1 git coding-standards; }; f
alias.cs-staged=!git diff-index --cached --name-only --diff-filter=ACMR HEAD | xargs -n1 git coding-standards
alias.cs-head=!git diff-tree --no-commit-id --name-only --diff-filter=ACMR -r HEAD | xargs -n1 git coding-standards
alias.cs-tree=!f() { git ls-tree -r --name-only HEAD "$1" | xargs -n1 git coding-standards; }; f
alias.ph=log --graph --pretty=pretty-history --abbrev-commit --date=relative
alias.cl=log --pretty=changelog  --no-merges --cherry --abbrev-commit --date-order
alias.sl=log --oneline --reverse --no-merges --stat
alias.rv=remote -v
alias.fa=fetch --all -v
alias.ff=pull --ff-only
alias.wu=branch -a --no-merged
alias.latest-version=!git tag --sort=v:refname | tail -n1
alias.pt=push --tags origin master:master develop:develop
git-up.fetch.prune=true
git-up.fetch.all=true
filter.lfs.clean=git-lfs clean %f
filter.lfs.smudge=git-lfs smudge %f
filter.lfs.required=true
user.name=Toni Uebernickel
user.email=tuebernickel@gmail.com
user.signingkey=F6035C7A
core.editor=mate -w -l 1
commit.gpgsign=true
github.user=havvg
github.token=PRIVATE_CREDENTIALS_REMOVED
travis.user=tuebernickel@gmail.com
travis.token=PRIVATE_CREDENTIALS_REMOVED
alias.review=!f() { git ph --author="$1" ; }; f
alias.rf=!f() { git flow feature track "$1" && git co feature/"$1" && git ff && git flow finish; }; f
alias.upstream=!git merge --ff-only upstream/`git branch --list --no-color | grep -e '^\*' | cut -d" " -f2
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=git@gitlab.tarifhaus.ag:tarifhaus/thengine.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.develop.remote=origin
branch.develop.merge=refs/heads/develop
branch.develop.rebase=true
commit.gpgsign=false
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.master.rebase=true
gitflow.branch.master=master
gitflow.branch.develop=develop
gitflow.path.hooks=/Users/toni.uebernickel/Development/Tarifhaus/repositories/thengine/.git/hooks
user.email=toni.uebernickel@tarifhaus.ag
gitflow.branch.feature/ITTPL-36-coupon-token-email-limit.base=develop
gitflow.branch.feature/ITTPL-49-command-locking.base=develop
gitflow.branch.release/2.5.0.base=develop
gitflow.branch.feature/ITTHE-243-landingpage-content-tags.base=develop
gitflow.branch.release/2.6.0.base=develop
gitflow.branch.feature/ITTHE-246-json-web-token.base=develop
gitflow.branch.release/2.7.0.base=develop
gitflow.branch.feature/ITTHE-249-post-request-daten.base=develop
gitflow.branch.feature/ITTHE-248-users-api.base=develop
gitflow.branch.release/2.8.0.base=develop
gitflow.branch.feature/ITTPL-92-url-shortener.base=develop
gitflow.branch.release/2.9.0.base=develop
gitflow.branch.feature/ITTHE-255-basic-orders-api.base=develop
gitflow.branch.feature/ITTHE-260-migrate-databases-helper.base=develop
gitflow.branch.feature/ITTHE-257-signup.base=develop
gitflow.branch.feature/ITTHE-256-api-profile.base=develop
gitflow.branch.feature/ITTHE-267-convert-to-testdox.base=develop
gitflow.branch.release/2.10.0.base=develop
gitflow.branch.feature/ITTPL-137-besser-mobile-portal.base=develop
gitflow.branch.feature/ITTHE-251-HTTP-500-api-problem.base=develop
gitflow.branch.feature/ITTHE-272-message-queue.base=develop
gitflow.branch.feature/ITTBO-7-einfache-faq-verwaltung.base=hotfix/2.9.2
gitflow.branch.feature/Tarifporfolio-V3.base=master
gitflow.branch.release/2.11.0.base=develop
gitflow.branch.release/2.12.0.base=develop
branch.support/ITTHE-262.remote=origin
branch.support/ITTHE-262.merge=refs/heads/support/ITTHE-262
branch.support/ITTHE-262.rebase=true
gitflow.branch.feature/ITTHE-277-change-password.base=develop
gitflow.branch.feature/ITTHE-280-TEF-MyPay.base=develop
gitflow.branch.feature/ITTHE-292-msisdn-on-contract-activation.base=release/2.14.0
gitflow.branch.feature/ITTHE-280-mypay-vouchercode-transactions.base=release/2.14.0
branch.feature/ITTHE-280-mypay-vouchercode-transactions.remote=origin
branch.feature/ITTHE-280-mypay-vouchercode-transactions.merge=refs/heads/feature/ITTHE-280-mypay-vouchercode-transactions
branch.feature/ITTHE-280-mypay-vouchercode-transactions.rebase=true
gitflow.branch.feature/ITTHE-293-translate-security-error-messages.base=develop
gitflow.branch.feature/ITTHE-295-combined-contract-endpoint.base=release/2.14.0
gitflow.branch.feature/ITTHE-294-simcard-activation.base=release/2.14.0
branch.support/json-rpc-form-type.remote=origin
branch.support/json-rpc-form-type.merge=refs/heads/support/json-rpc-form-type
branch.support/json-rpc-form-type.rebase=true
gitflow.branch.feature/ITTHE-310-user-profile-for-existing-users.base=develop
gitflow.branch.feature/ITTHE-312-refactor-obtaining-vouchers.base=develop
gitflow.branch.feature/ITTHE-298-vouchers-for-user-subset.base=develop
gitflow.branch.feature/ITTHE-313-send-signup-message.base=develop
gitflow.branch.release/2.16.0.base=develop
gitflow.branch.release/2.17.0.base=develop
gitflow.branch.feature/ITTHE-315-explicit-persist-attribute-value.base=develop
gitflow.branch.release/2.18.0.base=develop
gitflow.branch.feature/ITTPL-350-bcc-club-email-to-lbe.base=develop
gitflow.branch.feature/ITTHE-321-promotion-voucher-on-contract-basis.base=develop
gitflow.branch.feature/ITTHE-325-lock-voucher-when-obtaining.base=develop
gitflow.branch.release/2.19.0.base=develop
gitflow.branch.hotfix/2.19.1.base=master
gitflow.branch.feature/ITTHE-339-api-access-control.base=develop
gitflow.branch.release/2.20.0.base=develop
gitflow.branch.feature/ITTHE-334-promotion-for-all-customers.base=develop
gitflow.branch.feature/ITTHE-331-behat-context-api-problem.base=develop
gitflow.branch.feature/ITTHE-336-canonical-user-email-address.base=develop
gitflow.branch.feature/ITTHE-138-address-validation-setup-wrapper.base=develop
lfs.https://gitlab.tarifhaus.ag/tarifhaus/thengine.git/info/lfs.locksverify=false
gitflow.branch.feature/ITTHE-351-behat-assert-response-content.base=develop
gitflow.branch.release/2.21.0.base=develop
gitflow.branch.feature/ITTHE-355-refactor-chat-api.base=develop
gitflow.branch.feature/ITADM-48-feature-deployments.base=develop
gitflow.branch.release/2.22.0.base=develop
gitflow.branch.feature/ITTHE-360-media-service.base=develop
branch.feature/ITTHE-360-media-service.remote=origin
branch.feature/ITTHE-360-media-service.merge=refs/heads/feature/ITTHE-360-media-service
branch.feature/ITTHE-360-media-service.rebase=true
gitflow.branch.feature/tarifhaus-club-support.base=develop
gitflow.branch.feature/ITTHE-370-open-promotions-not-listed.base=develop
gitflow.branch.feature/ITTHE-371-support-registration-vouchers.base=develop
gitflow.branch.release/2.23.0.base=develop
gitflow.branch.feature/ITTHE-375-support-promotion-participants.base=develop
gitflow.branch.feature/ITTHE-288-aboalarm-bank-account-check.base=develop
gitflow.branch.release/2.25.0.base=develop
branch.feature/ITTHE-384-products-and-attributes-new-portal-strategy.remote=origin
branch.feature/ITTHE-384-products-and-attributes-new-portal-strategy.merge=refs/heads/feature/ITTHE-384-products-and-attributes-new-portal-strategy
branch.feature/ITTHE-384-products-and-attributes-new-portal-strategy.rebase=true
gitflow.branch.feature/ITTHE-388-json-rpc.base=develop
gitflow.branch.feature/ITTHE-382-anonymise-order-notification.base=develop
branch.feature/ITTHE-388-json-rpc.remote=origin
branch.feature/ITTHE-388-json-rpc.merge=refs/heads/feature/ITTHE-388-json-rpc
branch.feature/ITTHE-388-json-rpc.rebase=true
gitflow.branch.feature/ITTHE-372-vouchers-on-monthly-basis.base=develop
branch.feature/ITTHE-385-timeline.remote=origin
branch.feature/ITTHE-385-timeline.merge=refs/heads/feature/ITTHE-385-timeline
branch.feature/ITTHE-385-timeline.rebase=true
gitflow.branch.release/2.26.0.base=develop
branch.release/2.26.0.remote=origin
branch.release/2.26.0.merge=refs/heads/release/2.26.0
branch.release/2.26.0.rebase=true
branch.feature/ITTHE-386-member-connections.remote=origin
branch.feature/ITTHE-386-member-connections.merge=refs/heads/feature/ITTHE-386-member-connections
branch.feature/ITTHE-386-member-connections.rebase=true

--
Toni Uebernickel

tuebernickel@gmail.com - https://keybase.io/havvg
https://github.com/havvg - https://www.xing.com/profile/Toni_Uebernickel
On 27. Sep 2017, at 21:53, Jonathan Nieder [off-list ref] wrote:

Jonathan Nieder wrote:
quoted
Jeff King wrote:
quoted
quoted
There aren't a lot of changes to the script between v2.13.2 and v2.14.2.
The most plausible culprit is d5addcf522 (add--interactive: handle EOF
in prompt_yesno, 2017-06-21), but I'm scratching my head over how that
could cause what you're seeing.

Are you able to build Git from source and bisect the problem? It would
help to know which commit introduced the problem.
How about this change?

commit 136c8c8b8fa39f1315713248473dececf20f8fe7
Author: Jeff King [off-list ref]
Date:   Thu Jul 13 11:07:03 2017 -0400

    color: check color.ui in git_default_config()
Uh, I think I was thinking of another thread when I wrote this.  Sorry
for the nonsense.
quoted
Toni, what is the output of "git config -l"?
I'm still curious about this.

Thanks,
Jonathan

Re: Updated to v2.14.2 on macOS; git add --patch broken

From: Jeff King <hidden>
Date: 2017-09-28 05:21:03

On Thu, Sep 28, 2017 at 07:03:55AM +0200, Toni Uebernickel wrote:
color.ui=always
This is the problem, and Jonathan's guess was correct that 136c8c8b8f
(color: check color.ui in git_default_config(), 2017-07-13) is related.

Re-reading that commit message, I'm inclined to say that the commit
isn't wrong, and that setting color.ui to "always" has always been a bad
idea. Of course, I also wrote that commit message, so I may be biased. :)

What led you to setting color.ui to "always" in your config?  The more
usual value is "auto" (which is also the default these days).

-Peff

Re: Updated to v2.14.2 on macOS; git add --patch broken

From: Toni Uebernickel <hidden>
Date: 2017-09-28 05:31:54

That's a very very old setting :)
Honestly, I don't know why it's "always". I have set up this setting years ago and never thought about it again, as it worked out.

I changed it to "auto" and the --patch options are working again on v2.14.2!

Thank you very much for your time & efforts.
If I can be of any further help on this matter, just let me know.

Kind Regards,
Toni

--
Toni Uebernickel

tuebernickel@gmail.com - https://keybase.io/havvg
https://github.com/havvg - https://www.xing.com/profile/Toni_Uebernickel
On 28. Sep 2017, at 07:20, Jeff King [off-list ref] wrote:

On Thu, Sep 28, 2017 at 07:03:55AM +0200, Toni Uebernickel wrote:
quoted
color.ui=always
This is the problem, and Jonathan's guess was correct that 136c8c8b8f
(color: check color.ui in git_default_config(), 2017-07-13) is related.

Re-reading that commit message, I'm inclined to say that the commit
isn't wrong, and that setting color.ui to "always" has always been a bad
idea. Of course, I also wrote that commit message, so I may be biased. :)

What led you to setting color.ui to "always" in your config?  The more
usual value is "auto" (which is also the default these days).

-Peff

Re: Updated to v2.14.2 on macOS; git add --patch broken

From: Jonathan Nieder <hidden>
Date: 2017-10-02 23:00:27

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,

[PATCH 0/2] fixing "add -p" regression

From: Junio C Hamano <hidden>
Date: 2017-10-03 04:07:44

We were a bit too agressive in pushing color.ui configuration to
plumbing commands.  A real fix must be found to override the default
"auto" use of colors for any color-capable plumbing commands, but
let's leave that to a later round and concentrate on fixing the
regression first.

Junio C Hamano (2):
  Revert "color: check color.ui in git_default_config()"
  colors: git_default_config() does not read color.ui

 builtin/branch.c       | 2 +-
 builtin/clean.c        | 3 ++-
 builtin/for-each-ref.c | 3 ++-
 builtin/grep.c         | 2 +-
 builtin/show-branch.c  | 2 +-
 builtin/tag.c          | 2 +-
 color.c                | 8 ++++++++
 config.c               | 4 ----
 diff.c                 | 3 +++
 9 files changed, 19 insertions(+), 10 deletions(-)

-- 
2.14.2-882-gfe33df219d

[PATCH 1/2] Revert "color: check color.ui in git_default_config()"

From: Junio C Hamano <hidden>
Date: 2017-10-03 04:07:48

This reverts commit 136c8c8b8fa39f1315713248473dececf20f8fe7.

Even though we do want to fix the fallout from 4c7f1819 ("make
color.ui default to 'auto'", 2013-06-10), which made it impossible
to override it with "git -c color.ui={never,always} $plumbing",
allowing the plumbing commands to pay attention to color.ui
configuration variable turned out to be an unsatisfactory fix.

People who had color.ui=always, thinking that it should be safe to
do, because it won't apply to plumbing commands, got burned by it.

A bit of fix-up patches are needed, as the series that included the
patch being reverted, and changes after the series landed, have
and/or added code that assumes git_default_config() would read the
color.ui, and they need to be adjusted.

Signed-off-by: Junio C Hamano <redacted>
---
 builtin/branch.c      | 2 +-
 builtin/clean.c       | 3 ++-
 builtin/grep.c        | 2 +-
 builtin/show-branch.c | 2 +-
 color.c               | 8 ++++++++
 config.c              | 4 ----
 diff.c                | 3 +++
 7 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index 16d391b407..1969c7116c 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -92,7 +92,7 @@ static int git_branch_config(const char *var, const char *value, void *cb)
 			return config_error_nonbool(var);
 		return color_parse(value, branch_colors[slot]);
 	}
-	return git_default_config(var, value, cb);
+	return git_color_default_config(var, value, cb);
 }
 
 static const char *branch_get_color(enum color_branch ix)
diff --git a/builtin/clean.c b/builtin/clean.c
index c1bafda5b6..057fc97fe4 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -125,7 +125,8 @@ static int git_clean_config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 
-	return git_default_config(var, value, cb);
+	/* inspect the color.ui config variable and others */
+	return git_color_default_config(var, value, cb);
 }
 
 static const char *clean_get_color(enum color_clean ix)
diff --git a/builtin/grep.c b/builtin/grep.c
index a7157f5632..0d6e669732 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -284,7 +284,7 @@ static int wait_all(void)
 static int grep_cmd_config(const char *var, const char *value, void *cb)
 {
 	int st = grep_config(var, value, cb);
-	if (git_default_config(var, value, cb) < 0)
+	if (git_color_default_config(var, value, cb) < 0)
 		st = -1;
 
 	if (!strcmp(var, "grep.threads")) {
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 28f245c8cc..7073a3eb97 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -554,7 +554,7 @@ static int git_show_branch_config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 
-	return git_default_config(var, value, cb);
+	return git_color_default_config(var, value, cb);
 }
 
 static int omit_in_dense(struct commit *commit, struct commit **rev, int n)
diff --git a/color.c b/color.c
index 7aa8b076f0..31b6207a00 100644
--- a/color.c
+++ b/color.c
@@ -361,6 +361,14 @@ int git_color_config(const char *var, const char *value, void *cb)
 	return 0;
 }
 
+int git_color_default_config(const char *var, const char *value, void *cb)
+{
+	if (git_color_config(var, value, cb) < 0)
+		return -1;
+
+	return git_default_config(var, value, cb);
+}
+
 void color_print_strbuf(FILE *fp, const char *color, const struct strbuf *sb)
 {
 	if (*color)
diff --git a/config.c b/config.c
index bc290e7563..a9356c1383 100644
--- a/config.c
+++ b/config.c
@@ -16,7 +16,6 @@
 #include "string-list.h"
 #include "utf8.h"
 #include "dir.h"
-#include "color.h"
 
 struct config_source {
 	struct config_source *prev;
@@ -1351,9 +1350,6 @@ int git_default_config(const char *var, const char *value, void *dummy)
 	if (starts_with(var, "advice."))
 		return git_default_advice_config(var, value);
 
-	if (git_color_config(var, value, dummy) < 0)
-		return -1;
-
 	if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) {
 		pager_use_color = git_config_bool(var,value);
 		return 0;
diff --git a/diff.c b/diff.c
index 9c38258030..85e714f6c6 100644
--- a/diff.c
+++ b/diff.c
@@ -299,6 +299,9 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 
+	if (git_color_config(var, value, cb) < 0)
+		return -1;
+
 	return git_diff_basic_config(var, value, cb);
 }
 
-- 
2.14.2-882-gfe33df219d

[PATCH 2/2] colors: git_default_config() does not read color.ui

From: Junio C Hamano <hidden>
Date: 2017-10-03 04:07:53

As we reverted 136c8c8b ("color: check color.ui in
git_default_config()", 2017-07-13), these need to be added back to
the codebase so that "git tag --list" and "git for-each-ref" would
still pay attention to color.ui setting.

A real fix to the problem introduced by 4c7f1819 ("make color.ui
default to 'auto'", 2013-06-10) must be found, to allow users to
override the default "auto" use of colors for any color-capable
plumbing commands, but let's leave that to a later round.

Signed-off-by: Junio C Hamano <redacted>
---
 builtin/for-each-ref.c | 3 ++-
 builtin/tag.c          | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 5d7c921a77..238eb00e09 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -5,6 +5,7 @@
 #include "object.h"
 #include "parse-options.h"
 #include "ref-filter.h"
+#include "color.h"
 
 static char const * const for_each_ref_usage[] = {
 	N_("git for-each-ref [<options>] [<pattern>]"),
@@ -54,7 +55,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
 
 	format.format = "%(objectname) %(objecttype)\t%(refname)";
 
-	git_config(git_default_config, NULL);
+	git_config(git_color_default_config, NULL);
 
 	parse_options(argc, argv, prefix, opts, for_each_ref_usage, 0);
 	if (maxcount < 0) {
diff --git a/builtin/tag.c b/builtin/tag.c
index 66e35b823b..46c3e78b55 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -158,7 +158,7 @@ static int git_tag_config(const char *var, const char *value, void *cb)
 
 	if (starts_with(var, "column."))
 		return git_column_config(var, value, "tag", &colopts);
-	return git_default_config(var, value, cb);
+	return git_color_default_config(var, value, cb);
 }
 
 static void write_tag_body(int fd, const struct object_id *oid)
-- 
2.14.2-882-gfe33df219d
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help