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>
Nicolas Pitre committed
Feb 1, 2007 at 12:33 UTC
fe55851624bbdb4f08e17e27ef8197ed610ac586
1 file changed
+15
-1
sha1_name.c
+15
-1
@@ -301,12 +301,26 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
301
fprintf(stderr, warning, len, str);
302
303
if (reflog_len) {
304
- /* Is it asking for N-th entry, or approxidate? */
304
int nth, i;
305
unsigned long at_time;
306
unsigned long co_time;
307
int co_tz, co_cnt;
308
309
+ /*
310
+ * We'll have an independent reflog for "HEAD" eventually
311
+ * which won't be a synonym for the current branch reflog.
312
+ * In the mean time prevent people from getting used to
313
+ * such a synonym until the work is completed.
314
+ */
315
+ if (!strncmp("HEAD", str, len) &&
316
+ !strncmp(real_ref, "refs/", 5)) {
317
+ error("reflog for HEAD has not been implemented yet\n"
318
+ "Maybe you could try %s%s instead.",
319
+ strchr(real_ref+5, '/')+1, str + len);
320
+ exit(-1);
321
+ }
322
+
323
+ /* Is it asking for N-th entry, or approxidate? */
324
for (i = nth = 0; 0 <= nth && i < reflog_len; i++) {
325
char ch = str[at+2+i];
326
if ('0' <= ch && ch <= '9')