aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blame.c2
-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.c6
-rw-r--r--builtin-fmt-merge-msg.c3
-rw-r--r--builtin-log.c18
-rw-r--r--builtin-prune.c2
-rw-r--r--builtin-rev-list.c2
-rw-r--r--http-push.c2
-rw-r--r--revision.c4
-rw-r--r--revision.h2
12 files changed, 25 insertions, 22 deletions
diff --git a/blame.c b/blame.c
index b04b8f58a..76712b596 100644
--- a/blame.c
+++ b/blame.c
@@ -834,7 +834,7 @@ int main(int argc, const char **argv)
}
- init_revisions(&rev);
+ init_revisions(&rev, setup_git_directory());
rev.remove_empty_trees = 1;
rev.topo_order = 1;
rev.prune_fn = simplify_commit;
diff --git a/builtin-diff-files.c b/builtin-diff-files.c
index 2e1011862..ea2936a5e 100644
--- a/builtin-diff-files.c
+++ b/builtin-diff-files.c
@@ -18,7 +18,7 @@ int cmd_diff_files(int argc, const char **argv, char **envp)
struct rev_info rev;
int silent = 0;
- init_revisions(&rev);
+ init_revisions(&rev, setup_git_directory());
git_config(git_default_config); /* no "diff" UI options */
rev.abbrev = 0;
diff --git a/builtin-diff-index.c b/builtin-diff-index.c
index dc52c054e..eeeee93fb 100644
--- a/builtin-diff-index.c
+++ b/builtin-diff-index.c
@@ -15,7 +15,7 @@ int cmd_diff_index(int argc, const char **argv, char **envp)
int cached = 0;
int i;
- init_revisions(&rev);
+ init_revisions(&rev, setup_git_directory());
git_config(git_default_config); /* no "diff" UI options */
rev.abbrev = 0;
diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c
index 8957b459d..f8215ea70 100644
--- a/builtin-diff-tree.c
+++ b/builtin-diff-tree.c
@@ -67,7 +67,7 @@ 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);
+ init_revisions(opt, setup_git_directory());
git_config(git_default_config); /* no "diff" UI options */
nr_sha1 = 0;
opt->abbrev = 0;
diff --git a/builtin-diff.c b/builtin-diff.c
index dca223235..45b27cfca 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -227,7 +227,7 @@ int cmd_diff(int argc, const char **argv, char **envp)
struct rev_info rev;
struct object_array_entry ent[100];
int ents = 0, blobs = 0, paths = 0;
- const char *path = NULL;
+ const char *path = NULL, *prefix;
struct blobinfo blob[2];
/*
@@ -250,9 +250,9 @@ int cmd_diff(int argc, const char **argv, char **envp)
* Other cases are errors.
*/
- init_revisions(&rev);
+ prefix = setup_git_directory();
git_config(git_diff_ui_config);
- diff_setup(&rev.diffopt);
+ init_revisions(&rev, prefix);
argc = setup_revisions(argc, argv, &rev, NULL);
if (!rev.diffopt.output_format) {
diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c
index f20b27b8a..338f2094f 100644
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
@@ -250,6 +250,7 @@ int cmd_fmt_merge_msg(int argc, char **argv, char **envp)
const char *sep = "";
unsigned char head_sha1[20];
const char *head, *current_branch;
+ const char *prefix = setup_git_directory();
git_config(fmt_merge_msg_config);
@@ -342,7 +343,7 @@ int cmd_fmt_merge_msg(int argc, char **argv, char **envp)
struct rev_info rev;
head = lookup_commit(head_sha1);
- init_revisions(&rev);
+ init_revisions(&rev, prefix);
rev.commit_format = CMIT_FMT_ONELINE;
rev.ignore_merges = 1;
rev.limited = 1;
diff --git a/builtin-log.c b/builtin-log.c
index 88c835acb..52064cd17 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -48,10 +48,10 @@ static int cmd_log_walk(struct rev_info *rev)
int cmd_whatchanged(int argc, const char **argv, char **envp)
{
struct rev_info rev;
+ const char *prefix = setup_git_directory();
- init_revisions(&rev);
git_config(git_diff_ui_config);
- diff_setup(&rev.diffopt);
+ init_revisions(&rev, prefix);
rev.diff = 1;
rev.diffopt.recursive = 1;
rev.simplify_history = 0;
@@ -64,10 +64,10 @@ int cmd_whatchanged(int argc, const char **argv, char **envp)
int cmd_show(int argc, const char **argv, char **envp)
{
struct rev_info rev;
+ const char *prefix = setup_git_directory();
- init_revisions(&rev);
git_config(git_diff_ui_config);
- diff_setup(&rev.diffopt);
+ init_revisions(&rev, prefix);
rev.diff = 1;
rev.diffopt.recursive = 1;
rev.combine_merges = 1;
@@ -82,10 +82,10 @@ int cmd_show(int argc, const char **argv, char **envp)
int cmd_log(int argc, const char **argv, char **envp)
{
struct rev_info rev;
+ const char *prefix = setup_git_directory();
- init_revisions(&rev);
git_config(git_diff_ui_config);
- diff_setup(&rev.diffopt);
+ init_revisions(&rev, prefix);
rev.always_show_header = 1;
cmd_log_init(argc, argv, envp, &rev);
return cmd_log_walk(&rev);
@@ -188,6 +188,7 @@ static void get_patch_ids(struct rev_info *rev, struct diff_options *options)
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.");
@@ -206,7 +207,7 @@ static void get_patch_ids(struct rev_info *rev, struct diff_options *options)
die("diff_setup_done failed");
/* given a range a..b get all patch ids for b..a */
- init_revisions(&check_rev);
+ init_revisions(&check_rev, prefix);
o1->flags ^= UNINTERESTING;
o2->flags ^= UNINTERESTING;
add_pending_object(&check_rev, o1, "o1");
@@ -260,9 +261,10 @@ 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);
+ init_revisions(&rev, prefix);
rev.commit_format = CMIT_FMT_EMAIL;
rev.verbose_header = 1;
rev.diff = 1;
diff --git a/builtin-prune.c b/builtin-prune.c
index d196c41f1..4ed1e1b43 100644
--- a/builtin-prune.c
+++ b/builtin-prune.c
@@ -234,7 +234,7 @@ int cmd_prune(int argc, const char **argv, char **envp)
* Set up revision parsing, and mark us as being interested
* in all object types, not just commits.
*/
- init_revisions(&revs);
+ init_revisions(&revs, setup_git_directory());
revs.tag_objects = 1;
revs.blob_objects = 1;
revs.tree_objects = 1;
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 8f3287133..2b6691c8e 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -311,7 +311,7 @@ int cmd_rev_list(int argc, const char **argv, char **envp)
struct commit_list *list;
int i;
- init_revisions(&revs);
+ init_revisions(&revs, setup_git_directory());
revs.abbrev = 0;
revs.commit_format = CMIT_FMT_UNSPECIFIED;
argc = setup_revisions(argc, argv, &revs, NULL);
diff --git a/http-push.c b/http-push.c
index 47686195c..4021e7d92 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2521,7 +2521,7 @@ int main(int argc, char **argv)
commit_argv[3] = old_sha1_hex;
commit_argc++;
}
- init_revisions(&revs);
+ init_revisions(&revs, setup_git_directory());
setup_revisions(commit_argc, commit_argv, &revs, NULL);
free(new_sha1_hex);
if (old_sha1_hex) {
diff --git a/revision.c b/revision.c
index 874e349db..a58257ad8 100644
--- a/revision.c
+++ b/revision.c
@@ -509,7 +509,7 @@ static int add_parents_only(struct rev_info *revs, const char *arg, int flags)
return 1;
}
-void init_revisions(struct rev_info *revs)
+void init_revisions(struct rev_info *revs, const char *prefix)
{
memset(revs, 0, sizeof(*revs));
@@ -521,7 +521,7 @@ void init_revisions(struct rev_info *revs)
revs->pruning.change = file_change;
revs->lifo = 1;
revs->dense = 1;
- revs->prefix = setup_git_directory();
+ revs->prefix = prefix;
revs->max_age = -1;
revs->min_age = -1;
revs->max_count = -1;
diff --git a/revision.h b/revision.h
index e23ec8f45..0c3b8d990 100644
--- a/revision.h
+++ b/revision.h
@@ -87,7 +87,7 @@ struct rev_info {
extern int rev_same_tree_as_empty(struct rev_info *, struct tree *t1);
extern int rev_compare_tree(struct rev_info *, struct tree *t1, struct tree *t2);
-extern void init_revisions(struct rev_info *revs);
+extern void init_revisions(struct rev_info *revs, const char *prefix);
extern int setup_revisions(int argc, const char **argv, struct rev_info *revs, const char *def);
extern void prepare_revision_walk(struct rev_info *revs);
extern struct commit *get_revision(struct rev_info *revs);