aboutsummaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-04-16 02:42:00 -0700
committerJunio C Hamano <junkio@cox.net>2006-04-16 02:42:00 -0700
commitd4ed9793fd981ea5a35ebaa8e337446bb29f6d55 (patch)
treecd04446711ff849a2e8b96ba91026dbdc0fe17c6 /git.c
parentb2934926dd7455de61577c1dfdf4c12d224e7ae0 (diff)
downloadgit-d4ed9793fd981ea5a35ebaa8e337446bb29f6d55.tar.gz
git-d4ed9793fd981ea5a35ebaa8e337446bb29f6d55.tar.xz
Simplify common default options setup for built-in log family.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git.c')
-rw-r--r--git.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/git.c b/git.c
index a6cfd1d8a..cc43bfcab 100644
--- a/git.c
+++ b/git.c
@@ -286,6 +286,11 @@ static int cmd_log_wc(int argc, const char **argv, char **envp,
const char *commit_prefix = "commit ";
int shown = 0;
+ rev->abbrev = DEFAULT_ABBREV;
+ rev->commit_format = CMIT_FMT_DEFAULT;
+ rev->no_commit_id = 1;
+ argc = setup_revisions(argc, argv, rev, "HEAD");
+
if (argc > 1)
die("unrecognized argument: %s", argv[1]);
if (rev->commit_format == CMIT_FMT_ONELINE)
@@ -347,12 +352,8 @@ static int cmd_wc(int argc, const char **argv, char **envp)
struct rev_info rev;
init_revisions(&rev);
- rev.abbrev = DEFAULT_ABBREV;
- rev.no_commit_id = 1;
- rev.commit_format = CMIT_FMT_DEFAULT;
rev.diff = 1;
rev.diffopt.recursive = 1;
- argc = setup_revisions(argc, argv, &rev, "HEAD");
return cmd_log_wc(argc, argv, envp, &rev);
}
@@ -362,14 +363,11 @@ static int cmd_show(int argc, const char **argv, char **envp)
init_revisions(&rev);
rev.diff = 1;
- rev.ignore_merges = 0;
+ rev.diffopt.recursive = 1;
rev.combine_merges = 1;
rev.dense_combined_merges = 1;
- rev.abbrev = DEFAULT_ABBREV;
- rev.commit_format = CMIT_FMT_DEFAULT;
- rev.diffopt.recursive = 1;
+ rev.ignore_merges = 0;
rev.no_walk = 1;
- argc = setup_revisions(argc, argv, &rev, "HEAD");
return cmd_log_wc(argc, argv, envp, &rev);
}
@@ -378,10 +376,6 @@ static int cmd_log(int argc, const char **argv, char **envp)
struct rev_info rev;
init_revisions(&rev);
- rev.abbrev = DEFAULT_ABBREV;
- rev.no_commit_id = 1;
- rev.commit_format = CMIT_FMT_DEFAULT;
- argc = setup_revisions(argc, argv, &rev, "HEAD");
return cmd_log_wc(argc, argv, envp, &rev);
}