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>
Junio C Hamano committed
Apr 15, 2006 at 23:46 UTC
6b9c58f4669b3832ed2830f0cb1a307ea6bc6063
5 files changed
+6
-5
commit.h
+2
@@ -45,6 +45,8 @@ enum cmit_fmt {
45
CMIT_FMT_FULL,
46
CMIT_FMT_FULLER,
47
CMIT_FMT_ONELINE,
48
+
49
+ CMIT_FMT_UNSPECIFIED,
50
};
51
52
extern enum cmit_fmt get_commit_format(const char *arg);
diff-tree.c
+1
@@ -69,6 +69,7 @@ int main(int argc, const char **argv)
69
70
git_config(git_diff_config);
71
nr_sha1 = 0;
72
+ init_revisions(opt);
73
opt->abbrev = 0;
74
argc = setup_revisions(argc, argv, opt, NULL);
75
git.c
+1
@@ -286,6 +286,7 @@ static int cmd_log(int argc, const char **argv, char **envp)
286
const char *commit_prefix = "commit ";
287
int shown = 0;
288
289
+ init_revisions(&rev);
290
rev.abbrev = DEFAULT_ABBREV;
291
argc = setup_revisions(argc, argv, &rev, "HEAD");
292
if (argc > 1)
http-push.c
+1
@@ -2498,6 +2498,7 @@ int main(int argc, char **argv)
2498
commit_argv[3] = old_sha1_hex;
2499
commit_argc++;
2500
}
2501
+ init_revisions(&revs);
2502
setup_revisions(commit_argc, commit_argv, &revs, NULL);
2503
free(new_sha1_hex);
2504
if (old_sha1_hex) {
revision.c
+1
-5
@@ -475,11 +475,9 @@ static void handle_all(struct rev_info *revs, unsigned flags)
475
476
void init_revisions(struct rev_info *revs)
477
{
478
- unsigned abbrev = revs->abbrev;
479
-
478
memset(revs, 0, sizeof(*revs));
479
482
- revs->abbrev = abbrev;
480
+ revs->abbrev = DEFAULT_ABBREV;
481
revs->ignore_merges = 1;
482
revs->pruning.recursive = 1;
483
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
514
const char **unrecognized = argv + 1;
515
int left = 1;
516
519
- init_revisions(revs);
520
-
517
/* First, search for "--" */
518
seen_dashdash = 0;
519
for (i = 1; i < argc; i++) {