summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 818f477)
raw | patch | inline | side by side (parent: 818f477)
author | Linus Torvalds <torvalds@osdl.org> | |
Sat, 29 Jul 2006 04:21:48 +0000 (21:21 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sat, 29 Jul 2006 05:03:06 +0000 (22:03 -0700) |
Any git command that expects to work in a subdirectory of a project, and
that reads the git config files (which is just about all of them) needs to
make sure that it does the "setup_git_directory()" call before it tries to
read the config file.
This means, among other things, that we need to move the call out of
"init_revisions()", and into the caller.
This does the mostly trivial conversion to do that.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
that reads the git config files (which is just about all of them) needs to
make sure that it does the "setup_git_directory()" call before it tries to
read the config file.
This means, among other things, that we need to move the call out of
"init_revisions()", and into the caller.
This does the mostly trivial conversion to do that.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
12 files changed:
blame.c | patch | blob | history | |
builtin-diff-files.c | patch | blob | history | |
builtin-diff-index.c | patch | blob | history | |
builtin-diff-tree.c | patch | blob | history | |
builtin-diff.c | patch | blob | history | |
builtin-fmt-merge-msg.c | patch | blob | history | |
builtin-log.c | patch | blob | history | |
builtin-prune.c | patch | blob | history | |
builtin-rev-list.c | patch | blob | history | |
http-push.c | patch | blob | history | |
revision.c | patch | blob | history | |
revision.h | patch | blob | history |
index b04b8f58aaf718208ab13e5cbfd8cd2a4444cbd7..76712b5962bcb0f511cc4a18766d1a45dc901675 100644 (file)
--- a/blame.c
+++ b/blame.c
}
- 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 2e10118623e773253d57719fdba853e6fde4f776..ea2936a5ec8112d8d234b5bb3522e7be54c5a2d3 100644 (file)
--- a/builtin-diff-files.c
+++ b/builtin-diff-files.c
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 dc52c054ee680132ea2a5041d84c976cf036c773..eeeee93fb77cc39351d071060cce9fc87f9a0216 100644 (file)
--- a/builtin-diff-index.c
+++ b/builtin-diff-index.c
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 8957b459dee007c51c22e581c2ed7ef0b13b4e7e..f8215ea7072af34072a73221273c1b9cdadd18d6 100644 (file)
--- a/builtin-diff-tree.c
+++ b/builtin-diff-tree.c
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 dca223235de6ef61407bd7e7625687ab71918186..45b27cfca3975d4661651f98e951a0357686a961 100644 (file)
--- a/builtin-diff.c
+++ b/builtin-diff.c
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];
/*
* 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) {
index f20b27b8a9cfd78ad5ae8ba67f08ec25849394e2..338f2094f32504b71d41e16062010b75e33e96a3 100644 (file)
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
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);
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 88c835acba66dc9bca31c8cd33d5425289ade5ca..52064cd178c2b705d6eec16de9f9a40eb4f5272b 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
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;
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;
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);
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.");
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");
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 d196c41f13aee5992fe60febffa01ed4d640a97b..4ed1e1b43ce9971eeae085a3534742c09f621bd0 100644 (file)
--- a/builtin-prune.c
+++ b/builtin-prune.c
* 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 8f328713374679b023f1f8caaacab592c9e4f9a2..2b6691c8e4737a19acf3c57c8d75cbf09da6d939 100644 (file)
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
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 47686195cdf41ad58fe66a606033d3156de8fd82..4021e7d9274b713a7b5c48d66f9ddf21ddc07094 100644 (file)
--- a/http-push.c
+++ b/http-push.c
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 874e349db818d52329e30f2634855e5cf14192b8..a58257ad8037f7009c69ee0502c3669756bb3987 100644 (file)
--- a/revision.c
+++ b/revision.c
return 1;
}
-void init_revisions(struct rev_info *revs)
+void init_revisions(struct rev_info *revs, const char *prefix)
{
memset(revs, 0, sizeof(*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 e23ec8f45a3b635d83f662e4de5d671e41f37919..0c3b8d99059fb272b913a85c2873f5fef64acc00 100644 (file)
--- a/revision.h
+++ b/revision.h
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);