aboutsummaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-07-28 22:44:25 -0700
committerJunio C Hamano <junkio@cox.net>2006-07-29 01:34:07 -0700
commita633fca0c056aa221d23493c276d3713191621b3 (patch)
tree6dcb10b511201ad3e83f736e7eba214e301e5805 /builtin-log.c
parentdb6296a566eb1a8007a84330a911b38055720743 (diff)
downloadgit-a633fca0c056aa221d23493c276d3713191621b3.tar.gz
git-a633fca0c056aa221d23493c276d3713191621b3.tar.xz
Call setup_git_directory() much earlier
This changes the calling convention of built-in commands and passes the "prefix" (i.e. pathname of $PWD relative to the project root level) down to them. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/builtin-log.c b/builtin-log.c
index 52064cd17..82c69d1d0 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -16,7 +16,7 @@
/* this is in builtin-diff.c */
void add_head(struct rev_info *revs);
-static void cmd_log_init(int argc, const char **argv, char **envp,
+static void cmd_log_init(int argc, const char **argv, const char *prefix,
struct rev_info *rev)
{
rev->abbrev = DEFAULT_ABBREV;
@@ -45,26 +45,24 @@ static int cmd_log_walk(struct rev_info *rev)
return 0;
}
-int cmd_whatchanged(int argc, const char **argv, char **envp)
+int cmd_whatchanged(int argc, const char **argv, const char *prefix)
{
struct rev_info rev;
- const char *prefix = setup_git_directory();
git_config(git_diff_ui_config);
init_revisions(&rev, prefix);
rev.diff = 1;
rev.diffopt.recursive = 1;
rev.simplify_history = 0;
- cmd_log_init(argc, argv, envp, &rev);
+ cmd_log_init(argc, argv, prefix, &rev);
if (!rev.diffopt.output_format)
rev.diffopt.output_format = DIFF_FORMAT_RAW;
return cmd_log_walk(&rev);
}
-int cmd_show(int argc, const char **argv, char **envp)
+int cmd_show(int argc, const char **argv, const char *prefix)
{
struct rev_info rev;
- const char *prefix = setup_git_directory();
git_config(git_diff_ui_config);
init_revisions(&rev, prefix);
@@ -75,19 +73,18 @@ int cmd_show(int argc, const char **argv, char **envp)
rev.always_show_header = 1;
rev.ignore_merges = 0;
rev.no_walk = 1;
- cmd_log_init(argc, argv, envp, &rev);
+ cmd_log_init(argc, argv, prefix, &rev);
return cmd_log_walk(&rev);
}
-int cmd_log(int argc, const char **argv, char **envp)
+int cmd_log(int argc, const char **argv, const char *prefix)
{
struct rev_info rev;
- const char *prefix = setup_git_directory();
git_config(git_diff_ui_config);
init_revisions(&rev, prefix);
rev.always_show_header = 1;
- cmd_log_init(argc, argv, envp, &rev);
+ cmd_log_init(argc, argv, prefix, &rev);
return cmd_log_walk(&rev);
}
@@ -181,14 +178,13 @@ static int get_patch_id(struct commit *commit, struct diff_options *options,
return diff_flush_patch_id(options, sha1);
}
-static void get_patch_ids(struct rev_info *rev, struct diff_options *options)
+static void get_patch_ids(struct rev_info *rev, struct diff_options *options, const char *prefix)
{
struct rev_info check_rev;
struct commit *commit;
struct object *o1, *o2;
unsigned flags1, flags2;
unsigned char sha1[20];
- const char *prefix = setup_git_directory();
if (rev->pending.nr != 2)
die("Need exactly one range.");
@@ -244,7 +240,7 @@ static void gen_message_id(char *dest, unsigned int length, char *base)
(int)(email_end - email_start - 1), email_start + 1);
}
-int cmd_format_patch(int argc, const char **argv, char **envp)
+int cmd_format_patch(int argc, const char **argv, const char *prefix)
{
struct commit *commit;
struct commit **list = NULL;
@@ -261,7 +257,6 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
char *add_signoff = NULL;
char message_id[1024];
char ref_message_id[1024];
- const char *prefix = setup_git_directory();
git_config(git_format_config);
init_revisions(&rev, prefix);
@@ -368,7 +363,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
}
if (ignore_if_in_upstream)
- get_patch_ids(&rev, &patch_id_opts);
+ get_patch_ids(&rev, &patch_id_opts, prefix);
if (!use_stdout)
realstdout = fdopen(dup(1), "w");