Thread (1 message) 1 message, 1 author, 2016-09-12

Re: [PATCH v3 0/2] patch-id for merges

From: Junio C Hamano <hidden>
Date: 2016-09-12 20:45:17

Jeff King [off-list ref] writes:
On Mon, Sep 12, 2016 at 10:18:33AM -0700, Junio C Hamano wrote:
quoted
quoted
+static int patch_id_defined(struct commit *commit)
+{
+	/* must be 0 or 1 parents */
+	return !commit->parents || !commit->parents->next;
+}
If we make the first hunk begin like so:
quoted
+	if (commit->parents) {
+		if (!patch_id_defined(commit))
+			return -1;
I wonder if the compiler gives us the same code.
Good idea. I actually put the "patch_id_defined" check outside the "if"
block you've quoted (otherwise we're making assumptions about the
contents of patch_id_defined).
Facepalm.  I was mis-reading the condition in the helper function.
Of course, guarding up-front makes more sense.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help