fix overstrict :<path> diagnosis
[gitweb.git] / sha1_name.c
index ceb9cdd860da78bf3fe0a1819846ded0e87fda8c..90d8bfa20a153a97dcb3f7a974d9b4b457c02f79 100644 (file)
@@ -208,9 +208,7 @@ const char *find_unique_abbrev(const unsigned char *sha1, int len)
                if (exists
                    ? !status
                    : status == SHORT_NAME_NOT_FOUND) {
-                       int cut_at = len + unique_abbrev_extra_length;
-                       cut_at = (cut_at < 40) ? cut_at : 40;
-                       hex[cut_at] = 0;
+                       hex[len] = 0;
                        return hex;
                }
                len++;
@@ -707,7 +705,7 @@ static int handle_one_ref(const char *path,
        }
        if (object->type != OBJ_COMMIT)
                return 0;
-       insert_by_date((struct commit *)object, list);
+       commit_list_insert_by_date((struct commit *)object, list);
        return 0;
 }
 
@@ -1175,7 +1173,7 @@ int get_sha1_with_context_1(const char *name, unsigned char *sha1,
                        }
                        pos++;
                }
-               if (!gently)
+               if (!gently && name[1] && name[1] != '/')
                        diagnose_invalid_index_path(stage, prefix, cp);
                free(new_path);
                return -1;