From: Junio C Hamano Date: Sat, 14 May 2016 18:40:47 GMT Subject: Re: 'git diff-index' doesn't honor the 'diff.algorithm' variable Message-ID: In-Reply-To: <9d15b6c8-ed97-7352-3df1-efab1b4ffadb@yandex.ru> Dmitry Gutov writes: > Hi all, > > Subj. ...even though it's explicitly mentioned in the subcommand's man > page. Git version 2.7.4 here. > > To elaborate: > > - Call 'git config --global diff.algorithm histogram'. The variable belongs to UI config, meant for Porcelain "git diff", together with things like "diff.color", "diff.context", etc. As the point of lower-level plumbing commands in the diff family, i.e. diff-files, diff-index and diff-tree, are about giving stable output, which are _not_ affected by random end-user configuration, for scripted use, it is very much deliberate design decision that they ignore the UI config variables. A script that calls diff-index, if it wants to honor end-users' UI config variables, is allowed to use 'git config' to read them and turn them into appropriate command line options. e.g. algo=$(git config diff.algorithm) case "$algo" in minimal|histogram|patience) algo=--$algo ;; *) algo= ;; esac ... git diff-index $algo ... other args ... or something like that.