Remove the ugly jit-style parent syntax.
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 2 May 2005 02:16:06 +0000 (19:16 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 2 May 2005 02:16:06 +0000 (19:16 -0700)
If somebody wants it later, we can re-do it, but for now we consider
it an experiment that wasn't worth it. Git will still honor symbolic
names, it just won't look up parents for you.

Of course, you can always do it by hand if you want to.

sha1_file.c

index e1ee0ad349497d6470bc00aa7f1085d9d1b83b43..ced079184702fad6f1e79a3b90aa4fc317aa0b88 100644 (file)
@@ -60,37 +60,6 @@ int get_sha1_file(const char *path, unsigned char *result)
        return get_sha1_hex(buffer, result);
 }
 
-static int get_parent(int index, const char *str, unsigned char *result)
-{
-       unsigned char sha1[20];
-       char *buffer;
-       unsigned long size, offset;
-       int ret;
-
-       if (get_sha1(str, sha1) < 0)
-               return -1;
-       buffer = read_object_with_reference(sha1, "commit", &size, NULL);
-       if (!buffer)
-               return -1;
-       ret = -1;
-       offset = 46;
-       for (;;) {
-               if (offset + 48 > size)
-                       break;
-               if (memcmp(buffer + offset, "parent ", 7))
-                       break;
-               if (index > 0) {
-                       offset += 48;
-                       index--;
-                       continue;
-               }
-               ret = get_sha1_hex(buffer + offset + 7, result);
-               break;
-       }
-       free(buffer);
-       return ret;     
-}
-
 int get_sha1(const char *str, unsigned char *sha1)
 {
        static char pathname[PATH_MAX];
@@ -108,19 +77,6 @@ int get_sha1(const char *str, unsigned char *sha1)
        if (!get_sha1_hex(str, sha1))
                return 0;
 
-       switch (*str) {
-       case '/':
-               if (!get_sha1_file(str, sha1))
-                       return 0;
-               break;
-       case '-':
-               return get_parent(0, str+1, sha1);
-       case '0' ... '9':
-               if (str[1] == '-')
-                       return get_parent(*str - '0', str+2, sha1);
-               break;
-       }
-
        gitdir = ".git";
        for (p = prefix; *p; p++) {
                snprintf(pathname, sizeof(pathname), "%s/%s/%s", gitdir, *p, str);