summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-04-15 23:46:36 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-04-15 23:46:36 -0700
commit6b9c58f4669b3832ed2830f0cb1a307ea6bc6063 (patch)
treec245781ec9db1307e82a6b5a7cbc0e4f4c89c6fc
parentFix up rev-list option parsing. (diff)
downloadtgif-6b9c58f4669b3832ed2830f0cb1a307ea6bc6063.tar.xz
Split init_revisions() out of setup_revisions()
Merging all three option parsers related to whatchanged is unarguably the right thing, but the fallout was too big to scare me away. Let's try it once again, but once step at time. This splits out init_revisions() call from setup_revisions(), so that the callers can set different defaults to match the traditional benaviour. The rev-list command is still broken in a big way, which is the topic of next step. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--commit.h2
-rw-r--r--diff-tree.c1
-rw-r--r--git.c1
-rw-r--r--http-push.c1
-rw-r--r--revision.c6
5 files changed, 6 insertions, 5 deletions
diff --git a/commit.h b/commit.h
index 918c9ab5e4..de142afe73 100644
--- a/commit.h
+++ b/commit.h
@@ -45,6 +45,8 @@ enum cmit_fmt {
CMIT_FMT_FULL,
CMIT_FMT_FULLER,
CMIT_FMT_ONELINE,
+
+ CMIT_FMT_UNSPECIFIED,
};
extern enum cmit_fmt get_commit_format(const char *arg);
diff --git a/diff-tree.c b/diff-tree.c
index 979f792b67..e578798537 100644
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -69,6 +69,7 @@ int main(int argc, const char **argv)
git_config(git_diff_config);
nr_sha1 = 0;
+ init_revisions(opt);
opt->abbrev = 0;
argc = setup_revisions(argc, argv, opt, NULL);
diff --git a/git.c b/git.c
index 9d885569d8..d172626230 100644
--- a/git.c
+++ b/git.c
@@ -286,6 +286,7 @@ static int cmd_log(int argc, const char **argv, char **envp)
const char *commit_prefix = "commit ";
int shown = 0;
+ init_revisions(&rev);
rev.abbrev = DEFAULT_ABBREV;
argc = setup_revisions(argc, argv, &rev, "HEAD");
if (argc > 1)
diff --git a/http-push.c b/http-push.c
index 19a0f772e7..4a9dcf2bf6 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2498,6 +2498,7 @@ int main(int argc, char **argv)
commit_argv[3] = old_sha1_hex;
commit_argc++;
}
+ init_revisions(&revs);
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 bdf8005aec..9693b6e4c7 100644
--- a/revision.c
+++ b/revision.c
@@ -475,11 +475,9 @@ static void handle_all(struct rev_info *revs, unsigned flags)
void init_revisions(struct rev_info *revs)
{
- unsigned abbrev = revs->abbrev;
-
memset(revs, 0, sizeof(*revs));
- revs->abbrev = abbrev;
+ revs->abbrev = DEFAULT_ABBREV;
revs->ignore_merges = 1;
revs->pruning.recursive = 1;
revs->pruning.add_remove = file_add_remove;
@@ -516,8 +514,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
const char **unrecognized = argv + 1;
int left = 1;
- init_revisions(revs);
-
/* First, search for "--" */
seen_dashdash = 0;
for (i = 1; i < argc; i++) {