aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-07-27 22:55:44 -0700
committerJunio C Hamano <junkio@cox.net>2006-07-27 22:55:44 -0700
commitef1d9c5aa4c8fd57b2a8043c0cd9fea1c507db6a (patch)
tree8e5537ca7f1be31caad67d68310d0ec3e805b3af
parentdee4e384f376020e08cb78f6dfaf00ae84e97a9e (diff)
downloadgit-ef1d9c5aa4c8fd57b2a8043c0cd9fea1c507db6a.tar.gz
git-ef1d9c5aa4c8fd57b2a8043c0cd9fea1c507db6a.tar.xz
log and diff family: honor config even from subdirectories
There currently is an unfortunate circular dependency between what init_revisions (the command line revision specification parser) does and setting up the log and diff options. The function uses setup_git_directory() to find the root of the project relative to the current directory and calls diff_setup() to prepare diff generation. However, some of the things that diff_setup() does needs to depend on the configuration variable, which needs to be read after setup_git_directory() is called. This patch is a low impact workaround. It first lets init_revisions() to run and do its thing, then uses git_config() and diff_setup() after it returns, so that configuration variables that affects the diff operation can be used from subdirectories. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--builtin-diff-files.c2
-rw-r--r--builtin-diff-index.c2
-rw-r--r--builtin-diff-tree.c2
-rw-r--r--builtin-diff.c3
-rw-r--r--builtin-log.c9
5 files changed, 11 insertions, 7 deletions
diff --git a/builtin-diff-files.c b/builtin-diff-files.c
index 81ac2fe64..2e1011862 100644
--- a/builtin-diff-files.c
+++ b/builtin-diff-files.c
@@ -18,8 +18,8 @@ int cmd_diff_files(int argc, const char **argv, char **envp)
struct rev_info rev;
int silent = 0;
- git_config(git_default_config); /* no "diff" UI options */
init_revisions(&rev);
+ git_config(git_default_config); /* no "diff" UI options */
rev.abbrev = 0;
argc = setup_revisions(argc, argv, &rev, NULL);
diff --git a/builtin-diff-index.c b/builtin-diff-index.c
index a1fa1b85c..dc52c054e 100644
--- a/builtin-diff-index.c
+++ b/builtin-diff-index.c
@@ -15,8 +15,8 @@ int cmd_diff_index(int argc, const char **argv, char **envp)
int cached = 0;
int i;
- git_config(git_default_config); /* no "diff" UI options */
init_revisions(&rev);
+ git_config(git_default_config); /* no "diff" UI options */
rev.abbrev = 0;
argc = setup_revisions(argc, argv, &rev, NULL);
diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c
index b61066859..8957b459d 100644
--- a/builtin-diff-tree.c
+++ b/builtin-diff-tree.c
@@ -67,9 +67,9 @@ int cmd_diff_tree(int argc, const char **argv, char **envp)
static struct rev_info *opt = &log_tree_opt;
int read_stdin = 0;
+ init_revisions(opt);
git_config(git_default_config); /* no "diff" UI options */
nr_sha1 = 0;
- init_revisions(opt);
opt->abbrev = 0;
opt->diff = 1;
argc = setup_revisions(argc, argv, opt, NULL);
diff --git a/builtin-diff.c b/builtin-diff.c
index cb38f4456..7d5ad6271 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -250,8 +250,9 @@ int cmd_diff(int argc, const char **argv, char **envp)
* Other cases are errors.
*/
- git_config(git_diff_ui_config);
init_revisions(&rev);
+ git_config(git_diff_ui_config);
+ diff_setup(&rev.diffopt);
argc = setup_revisions(argc, argv, &rev, NULL);
if (!rev.diffopt.output_format) {
diff --git a/builtin-log.c b/builtin-log.c
index 4052cc75b..88c835acb 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -49,8 +49,9 @@ int cmd_whatchanged(int argc, const char **argv, char **envp)
{
struct rev_info rev;
- git_config(git_diff_ui_config);
init_revisions(&rev);
+ git_config(git_diff_ui_config);
+ diff_setup(&rev.diffopt);
rev.diff = 1;
rev.diffopt.recursive = 1;
rev.simplify_history = 0;
@@ -64,8 +65,9 @@ int cmd_show(int argc, const char **argv, char **envp)
{
struct rev_info rev;
- git_config(git_diff_ui_config);
init_revisions(&rev);
+ git_config(git_diff_ui_config);
+ diff_setup(&rev.diffopt);
rev.diff = 1;
rev.diffopt.recursive = 1;
rev.combine_merges = 1;
@@ -81,8 +83,9 @@ int cmd_log(int argc, const char **argv, char **envp)
{
struct rev_info rev;
- git_config(git_diff_ui_config);
init_revisions(&rev);
+ git_config(git_diff_ui_config);
+ diff_setup(&rev.diffopt);
rev.always_show_header = 1;
cmd_log_init(argc, argv, envp, &rev);
return cmd_log_walk(&rev);