git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] prevent HEAD reflog to be interpreted as current branch reflog
@ 2007-02-01 17:33 Nicolas Pitre
  2007-02-01 19:13 ` Shawn O. Pearce
  2007-02-02 13:08 ` Andy Parkins
  0 siblings, 2 replies; 35+ messages in thread
From: Nicolas Pitre @ 2007-02-01 17:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

The work in progress to enable separate reflog for HEAD will make it
independent from reflog of any branch HEAD might be pointing to. In
the mean time disallow HEAD@{...} until that work is completed. Otherwise
people might get used to the current behavior which makes HEAD@{...} an
alias for <current_branch>@{...} which won't be the case later.

Signed-off-by: Nicolas Pitre <nico@cam.org>
---
 sha1_name.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/sha1_name.c b/sha1_name.c
index 9dfb3ac..70c6e42 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -301,12 +301,26 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
 		fprintf(stderr, warning, len, str);
 
 	if (reflog_len) {
-		/* Is it asking for N-th entry, or approxidate? */
 		int nth, i;
 		unsigned long at_time;
 		unsigned long co_time;
 		int co_tz, co_cnt;
 
+		/*
+		 * We'll have an independent reflog for "HEAD" eventually
+		 * which won't be a synonym for the current branch reflog.
+		 * In the mean time prevent people from getting used to
+		 * such a synonym until the work is completed.
+		 */
+		if (!strncmp("HEAD", str, len) &&
+		    !strncmp(real_ref, "refs/", 5)) {
+			error("reflog for HEAD has not been implemented yet\n"
+			      "Maybe you could try %s%s instead.",
+			      strchr(real_ref+5, '/')+1, str + len);
+			exit(-1);
+		}
+
+		/* Is it asking for N-th entry, or approxidate? */
 		for (i = nth = 0; 0 <= nth && i < reflog_len; i++) {
 			char ch = str[at+2+i];
 			if ('0' <= ch && ch <= '9')
-- 
1.5.0.rc2.131.g4b01-dirty

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

end of thread, other threads:[~2007-02-05 23:11 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-01 17:33 [PATCH 3/3] prevent HEAD reflog to be interpreted as current branch reflog Nicolas Pitre
2007-02-01 19:13 ` Shawn O. Pearce
2007-02-01 20:58   ` Junio C Hamano
2007-02-01 21:29     ` Simon 'corecode' Schubert
2007-02-01 22:12       ` Nicolas Pitre
2007-02-01 22:17         ` Matthias Lederhofer
2007-02-01 22:29           ` [PATCH 4/3] provide a nice @{...} syntax to always mean the " Nicolas Pitre
2007-02-01 23:07             ` [PATCH 5/3], was " Johannes Schindelin
2007-02-01 23:21               ` [PATCH 6/3], was " Johannes Schindelin
2007-02-02  1:15             ` Junio C Hamano
2007-02-01 21:46     ` [PATCH 3/3] prevent HEAD reflog to be interpreted as " Nicolas Pitre
2007-02-02 10:31     ` Jakub Narebski
2007-02-02 10:42       ` Johannes Schindelin
2007-02-02 11:02         ` Lars Hjemli
2007-02-02 13:02           ` Andy Parkins
2007-02-02 14:55             ` Nicolas Pitre
2007-02-02 15:13             ` Nicolas Pitre
2007-02-02 16:11               ` Andy Parkins
2007-02-02 16:35                 ` Simon 'corecode' Schubert
2007-02-02 17:19                 ` Nicolas Pitre
2007-02-03 17:07                 ` Mark Wooding
2007-02-03 17:54                   ` Andy Parkins
2007-02-02 13:21           ` Jakub Narebski
2007-02-02 13:47           ` Simon 'corecode' Schubert
2007-02-02 19:40             ` Simon 'corecode' Schubert
2007-02-02 14:52           ` Nicolas Pitre
2007-02-02 15:39             ` Lars Hjemli
2007-02-05 11:11           ` Johannes Schindelin
2007-02-05 11:21             ` Shawn O. Pearce
2007-02-05 12:43               ` Johannes Schindelin
2007-02-05 23:11             ` Lars Hjemli
2007-02-02 13:08 ` Andy Parkins
2007-02-02 15:15   ` Rogan Dawes
2007-02-02 16:13     ` Andy Parkins
2007-02-03  3:04   ` Junio C Hamano

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).