Merge branch 'lt/objformat'
[gitweb.git] / sha1_name.c
index cd85d1fa0f9f2afb4e159cb635db435e75ef3e58..5fe8e5d4bf25d79c3fa76610d1617ee07c1f1e2c 100644 (file)
@@ -262,7 +262,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
                if (str[am] == '@' && str[am+1] == '{' && str[len-1] == '}') {
                        int date_len = len - am - 3;
                        char *date_spec = xmalloc(date_len + 1);
-                       safe_strncpy(date_spec, str + am + 2, date_len + 1);
+                       strlcpy(date_spec, str + am + 2, date_len + 1);
                        at_time = approxidate(date_spec);
                        free(date_spec);
                        len = am;
@@ -381,13 +381,13 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
 
        sp++; /* beginning of type name, or closing brace for empty */
        if (!strncmp(commit_type, sp, 6) && sp[6] == '}')
-               expected_type = TYPE_COMMIT;
+               expected_type = OBJ_COMMIT;
        else if (!strncmp(tree_type, sp, 4) && sp[4] == '}')
-               expected_type = TYPE_TREE;
+               expected_type = OBJ_TREE;
        else if (!strncmp(blob_type, sp, 4) && sp[4] == '}')
-               expected_type = TYPE_BLOB;
+               expected_type = OBJ_BLOB;
        else if (sp[0] == '}')
-               expected_type = TYPE_NONE;
+               expected_type = OBJ_NONE;
        else
                return -1;
 
@@ -416,9 +416,9 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
                                memcpy(sha1, o->sha1, 20);
                                return 0;
                        }
-                       if (o->type == TYPE_TAG)
+                       if (o->type == OBJ_TAG)
                                o = ((struct tag*) o)->tagged;
-                       else if (o->type == TYPE_COMMIT)
+                       else if (o->type == OBJ_COMMIT)
                                o = &(((struct commit *) o)->tree->object);
                        else
                                return error("%.*s: expected %s type, but the object dereferences to %s type",