From: Adam Simpkins <adam@adamsimpkins.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Adam Simpkins <adam@adamsimpkins.net>
Subject: [PATCH 1/3] revision API: split parent rewriting and parent printing options
Date: Sun, 4 May 2008 03:36:52 -0700 [thread overview]
Message-ID: <1209897414-10091-2-git-send-email-adam@adamsimpkins.net> (raw)
In-Reply-To: <1209897414-10091-1-git-send-email-adam@adamsimpkins.net>
This change allows parent rewriting to be performed without causing
the log and rev-list commands to print the parents.
Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
---
builtin-rev-list.c | 2 +-
log-tree.c | 4 ++--
revision.c | 7 ++++---
revision.h | 3 ++-
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index edc0bd3..476a870 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -77,7 +77,7 @@ static void show_commit(struct commit *commit)
stdout);
else
fputs(sha1_to_hex(commit->object.sha1), stdout);
- if (revs.parents) {
+ if (revs.print_parents) {
struct commit_list *parents = commit->parents;
while (parents) {
printf(" %s", sha1_to_hex(parents->item->object.sha1));
diff --git a/log-tree.c b/log-tree.c
index d3fb0e5..74829d7 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -231,7 +231,7 @@ void show_log(struct rev_info *opt)
putchar('>');
}
fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
- if (opt->parents)
+ if (opt->print_parents)
show_parents(commit, abbrev_commit);
show_decorations(commit);
putchar(opt->diffopt.line_termination);
@@ -271,7 +271,7 @@ void show_log(struct rev_info *opt)
}
fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit),
stdout);
- if (opt->parents)
+ if (opt->print_parents)
show_parents(commit, abbrev_commit);
if (parent)
printf(" (from %s)",
diff --git a/revision.c b/revision.c
index 4231ea2..a813304 100644
--- a/revision.c
+++ b/revision.c
@@ -1105,7 +1105,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
}
}
if (!strcmp(arg, "--parents")) {
- revs->parents = 1;
+ revs->rewrite_parents = 1;
+ revs->print_parents = 1;
continue;
}
if (!strcmp(arg, "--dense")) {
@@ -1524,13 +1525,13 @@ enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit)
/* Commit without changes? */
if (commit->object.flags & TREESAME) {
/* drop merges unless we want parenthood */
- if (!revs->parents)
+ if (!revs->rewrite_parents)
return commit_ignore;
/* non-merge - always ignore it */
if (!commit->parents || !commit->parents->next)
return commit_ignore;
}
- if (revs->parents && rewrite_parents(revs, commit) < 0)
+ if (revs->rewrite_parents && rewrite_parents(revs, commit) < 0)
return commit_error;
}
return commit_show;
diff --git a/revision.h b/revision.h
index 31217f8..201bd97 100644
--- a/revision.h
+++ b/revision.h
@@ -46,7 +46,8 @@ struct rev_info {
unpacked:1, /* see also ignore_packed below */
boundary:2,
left_right:1,
- parents:1,
+ rewrite_parents:1,
+ print_parents:1,
reverse:1,
cherry_pick:1,
first_parent_only:1;
--
1.5.5.1.128.gc15ea
next prev parent reply other threads:[~2008-05-04 10:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-04 10:36 [PATCH 0/3] log --graph and rev-list --graph Adam Simpkins
2008-05-04 10:36 ` Adam Simpkins [this message]
2008-05-04 10:36 ` [PATCH 2/3] Add history graph API Adam Simpkins
2008-05-04 10:36 ` [PATCH 3/3] log and rev-list: add --graph option Adam Simpkins
2008-05-05 7:57 ` [PATCH] graph API: eliminate unnecessary indentation Adam Simpkins
2008-05-05 11:38 ` Ping Yin
2008-05-06 6:41 ` [PATCH 3/3] log and rev-list: add --graph option Junio C Hamano
2008-05-06 7:01 ` Adam Simpkins
2008-05-06 6:41 ` [PATCH 2/3] Add history graph API Junio C Hamano
2008-05-04 11:06 ` [PATCH] bash: Add more option completions for 'git log' Teemu Likonen
2008-05-05 2:13 ` [PATCH 0/3] log --graph and rev-list --graph Ping Yin
2008-05-05 6:19 ` Adam Simpkins
2008-05-06 19:03 ` Teemu Likonen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1209897414-10091-2-git-send-email-adam@adamsimpkins.net \
--to=adam@adamsimpkins.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).