Merge branch 'jk/setup-sequence-update'
There were numerous corner cases in which the configuration files are read and used or not read at all depending on the directory a Git command was run, leading to inconsistent behaviour. The code to set-up repository access at the beginning of a Git process has been updated to fix them. * jk/setup-sequence-update: t1007: factor out repeated setup init: reset cached config when entering new repo init: expand comments explaining config trickery config: only read .git/config from configured repos test-config: setup git directory t1302: use "git -C" pager: handle early config pager: use callbacks instead of configset pager: make pager_program a file-local static pager: stop loading git_default_config() pager: remove obsolete comment diff: always try to set up the repository diff: handle --no-index prefixes consistently diff: skip implicit no-index check when given --no-index patch-id: use RUN_SETUP_GENTLY hash-object: always try to set up the git repository
This commit is contained in:
@@ -301,20 +301,21 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!no_index)
|
||||
prefix = setup_git_directory_gently(&nongit);
|
||||
prefix = setup_git_directory_gently(&nongit);
|
||||
|
||||
/*
|
||||
* Treat git diff with at least one path outside of the
|
||||
* repo the same as if the command would have been executed
|
||||
* outside of a git repository. In this case it behaves
|
||||
* the same way as "git diff --no-index <a> <b>", which acts
|
||||
* as a colourful "diff" replacement.
|
||||
*/
|
||||
if (nongit || ((argc == i + 2) &&
|
||||
(!path_inside_repo(prefix, argv[i]) ||
|
||||
!path_inside_repo(prefix, argv[i + 1]))))
|
||||
no_index = DIFF_NO_INDEX_IMPLICIT;
|
||||
if (!no_index) {
|
||||
/*
|
||||
* Treat git diff with at least one path outside of the
|
||||
* repo the same as if the command would have been executed
|
||||
* outside of a git repository. In this case it behaves
|
||||
* the same way as "git diff --no-index <a> <b>", which acts
|
||||
* as a colourful "diff" replacement.
|
||||
*/
|
||||
if (nongit || ((argc == i + 2) &&
|
||||
(!path_inside_repo(prefix, argv[i]) ||
|
||||
!path_inside_repo(prefix, argv[i + 1]))))
|
||||
no_index = DIFF_NO_INDEX_IMPLICIT;
|
||||
}
|
||||
|
||||
if (!no_index)
|
||||
gitmodules_config();
|
||||
|
||||
Reference in New Issue
Block a user