git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v2 0/3] Small log simplifications
@ 2012-07-29 23:25 Martin von Zweigbergk
  2012-07-29 23:25 ` [PATCH v2 1/3] remove unnecessary parameter from get_patch_ids() Martin von Zweigbergk
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Martin von Zweigbergk @ 2012-07-29 23:25 UTC (permalink / raw)
  To: git; +Cc: Martin von Zweigbergk

Separated out the removal of the unused diff options into patch 2/3
and added the necessary max_parents=1 in patch 3/3.

Martin von Zweigbergk (3):
  remove unnecessary parameter from get_patch_ids()
  cherry: don't set ignored rev_info options
  log: remove redundant check for merge commit

 builtin/log.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

-- 
1.7.11.1.104.ge7b44f1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/3] remove unnecessary parameter from get_patch_ids()
  2012-07-29 23:25 [PATCH v2 0/3] Small log simplifications Martin von Zweigbergk
@ 2012-07-29 23:25 ` Martin von Zweigbergk
  2012-07-29 23:25 ` [PATCH v2 2/3] cherry: don't set ignored rev_info options Martin von Zweigbergk
  2012-07-29 23:25 ` [PATCH v2 3/3] log: remove redundant check for merge commit Martin von Zweigbergk
  2 siblings, 0 replies; 4+ messages in thread
From: Martin von Zweigbergk @ 2012-07-29 23:25 UTC (permalink / raw)
  To: git; +Cc: Martin von Zweigbergk

get_patch_ids() takes an already initialized rev_info and a
prefix. The prefix is used when initalizing a second rev_info. Since
the initialized rev_info already has a prefix and the prefix never
changes, we can used the prefix from the initialized rev_info to
initialize the second rev_info.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
---
 builtin/log.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin/log.c b/builtin/log.c
index ecc2793..7a92e3f 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -696,7 +696,7 @@ static int reopen_stdout(struct commit *commit, const char *subject,
 	return 0;
 }
 
-static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const char *prefix)
+static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
 {
 	struct rev_info check_rev;
 	struct commit *commit;
@@ -717,7 +717,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha
 	init_patch_ids(ids);
 
 	/* given a range a..b get all patch ids for b..a */
-	init_revisions(&check_rev, prefix);
+	init_revisions(&check_rev, rev->prefix);
 	o1->flags ^= UNINTERESTING;
 	o2->flags ^= UNINTERESTING;
 	add_pending_object(&check_rev, o1, "o1");
@@ -1306,7 +1306,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 			if (hashcmp(o[0].item->sha1, o[1].item->sha1) == 0)
 				return 0;
 		}
-		get_patch_ids(&rev, &ids, prefix);
+		get_patch_ids(&rev, &ids);
 	}
 
 	if (!use_stdout)
@@ -1525,7 +1525,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
 			return 0;
 	}
 
-	get_patch_ids(&revs, &ids, prefix);
+	get_patch_ids(&revs, &ids);
 
 	if (limit && add_pending_commit(limit, &revs, UNINTERESTING))
 		die(_("Unknown commit %s"), limit);
-- 
1.7.11.1.104.ge7b44f1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/3] cherry: don't set ignored rev_info options
  2012-07-29 23:25 [PATCH v2 0/3] Small log simplifications Martin von Zweigbergk
  2012-07-29 23:25 ` [PATCH v2 1/3] remove unnecessary parameter from get_patch_ids() Martin von Zweigbergk
@ 2012-07-29 23:25 ` Martin von Zweigbergk
  2012-07-29 23:25 ` [PATCH v2 3/3] log: remove redundant check for merge commit Martin von Zweigbergk
  2 siblings, 0 replies; 4+ messages in thread
From: Martin von Zweigbergk @ 2012-07-29 23:25 UTC (permalink / raw)
  To: git; +Cc: Martin von Zweigbergk

Ever since cherry was built-in in e827633 (Built-in cherry,
2006-10-24), it has set a bunch of options on the the rev_info that
are only used while outputting a patch. But since the built-in cherry
command never needs to output any patch (it uses add_commit_patch_id
and has_commit_patch_id instead), these options are just distractions,
so remove them.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
---
 builtin/log.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/builtin/log.c b/builtin/log.c
index 7a92e3f..8cea1e5 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1508,10 +1508,6 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
 	}
 
 	init_revisions(&revs, prefix);
-	revs.diff = 1;
-	revs.combine_merges = 0;
-	revs.ignore_merges = 1;
-	DIFF_OPT_SET(&revs.diffopt, RECURSIVE);
 
 	if (add_pending_commit(head, &revs, 0))
 		die(_("Unknown commit %s"), head);
-- 
1.7.11.1.104.ge7b44f1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 3/3] log: remove redundant check for merge commit
  2012-07-29 23:25 [PATCH v2 0/3] Small log simplifications Martin von Zweigbergk
  2012-07-29 23:25 ` [PATCH v2 1/3] remove unnecessary parameter from get_patch_ids() Martin von Zweigbergk
  2012-07-29 23:25 ` [PATCH v2 2/3] cherry: don't set ignored rev_info options Martin von Zweigbergk
@ 2012-07-29 23:25 ` Martin von Zweigbergk
  2 siblings, 0 replies; 4+ messages in thread
From: Martin von Zweigbergk @ 2012-07-29 23:25 UTC (permalink / raw)
  To: git; +Cc: Martin von Zweigbergk

While walking the revision list in get_patch_ids and cmd_cherry, we
check for each commit if there is more than one parent and ignore the
commit if that is the case. Instead, set rev_info.max_parents to 1 and
let the revision traversal code handle it for us.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
---
 builtin/log.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/builtin/log.c b/builtin/log.c
index 8cea1e5..3423d11 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -718,6 +718,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
 
 	/* given a range a..b get all patch ids for b..a */
 	init_revisions(&check_rev, rev->prefix);
+	check_rev.max_parents = 1;
 	o1->flags ^= UNINTERESTING;
 	o2->flags ^= UNINTERESTING;
 	add_pending_object(&check_rev, o1, "o1");
@@ -726,10 +727,6 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
 		die(_("revision walk setup failed"));
 
 	while ((commit = get_revision(&check_rev)) != NULL) {
-		/* ignore merges */
-		if (commit->parents && commit->parents->next)
-			continue;
-
 		add_commit_patch_id(commit, ids);
 	}
 
@@ -1508,6 +1505,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
 	}
 
 	init_revisions(&revs, prefix);
+	revs.max_parents = 1;
 
 	if (add_pending_commit(head, &revs, 0))
 		die(_("Unknown commit %s"), head);
@@ -1530,10 +1528,6 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
 	if (prepare_revision_walk(&revs))
 		die(_("revision walk setup failed"));
 	while ((commit = get_revision(&revs)) != NULL) {
-		/* ignore merges */
-		if (commit->parents && commit->parents->next)
-			continue;
-
 		commit_list_insert(commit, &list);
 	}
 
-- 
1.7.11.1.104.ge7b44f1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-29 23:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-29 23:25 [PATCH v2 0/3] Small log simplifications Martin von Zweigbergk
2012-07-29 23:25 ` [PATCH v2 1/3] remove unnecessary parameter from get_patch_ids() Martin von Zweigbergk
2012-07-29 23:25 ` [PATCH v2 2/3] cherry: don't set ignored rev_info options Martin von Zweigbergk
2012-07-29 23:25 ` [PATCH v2 3/3] log: remove redundant check for merge commit Martin von Zweigbergk

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).