Re: [Annoyance] "git log .." thinks ".." is ambiguous

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On May 2, 2011, at 12:15 PM, Junio C Hamano wrote:

diff --git a/revision.c b/revision.c
index f4b8b38..26271d1 100644
--- a/revision.c
+++ b/revision.c
@@ -905,14 +905,26 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
		const char *this = arg;
		int symmetric = *next == '.';
		unsigned int flags_exclude = flags ^ UNINTERESTING;
+		static const char head_by_default[] = "HEAD";

		*dotdot = 0;
		next += symmetric;

		if (!*next)
-			next = "HEAD";
+			next = head_by_default;
		if (dotdot == arg)
-			this = "HEAD";
+			this = head_by_default;
+		if (this == head_by_default && next == head_by_default &&
+		    !symmetric) {

Is there a reason not to write

	const char *head_by_default = "HEAD";

or even

	const char *const head_by_default = "HEAD";

instead? Loading a static array and checking an init flag is a pessimization versus just pointing into a read-only segment.

Josh


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]