aboutsummaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2007-02-01 12:33:23 -0500
committerJunio C Hamano <junkio@cox.net>2007-02-01 21:48:26 -0800
commitfe55851624bbdb4f08e17e27ef8197ed610ac586 (patch)
tree07e25a789a96efb3a0b32c236437b51463a0d1cb /sha1_name.c
parent08f1675059c09b7ee0b8ed16bc059472d07bb9e5 (diff)
downloadgit-fe55851624bbdb4f08e17e27ef8197ed610ac586.tar.gz
git-fe55851624bbdb4f08e17e27ef8197ed610ac586.tar.xz
prevent HEAD reflog to be interpreted as current branch reflog
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> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 9dfb3ac57..70c6e42b0 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')