@@ -719,67 +719,6 @@ void *xmmap(void *start, size_t length,
719719 return ret ;
720720}
721721
722- static struct packed_git * alloc_packed_git (int extra )
723- {
724- struct packed_git * p = xmalloc (st_add (sizeof (* p ), extra ));
725- memset (p , 0 , sizeof (* p ));
726- p -> pack_fd = -1 ;
727- return p ;
728- }
729-
730- static void try_to_free_pack_memory (size_t size )
731- {
732- release_pack_memory (size );
733- }
734-
735- struct packed_git * add_packed_git (const char * path , size_t path_len , int local )
736- {
737- static int have_set_try_to_free_routine ;
738- struct stat st ;
739- size_t alloc ;
740- struct packed_git * p ;
741-
742- if (!have_set_try_to_free_routine ) {
743- have_set_try_to_free_routine = 1 ;
744- set_try_to_free_routine (try_to_free_pack_memory );
745- }
746-
747- /*
748- * Make sure a corresponding .pack file exists and that
749- * the index looks sane.
750- */
751- if (!strip_suffix_mem (path , & path_len , ".idx" ))
752- return NULL ;
753-
754- /*
755- * ".pack" is long enough to hold any suffix we're adding (and
756- * the use xsnprintf double-checks that)
757- */
758- alloc = st_add3 (path_len , strlen (".pack" ), 1 );
759- p = alloc_packed_git (alloc );
760- memcpy (p -> pack_name , path , path_len );
761-
762- xsnprintf (p -> pack_name + path_len , alloc - path_len , ".keep" );
763- if (!access (p -> pack_name , F_OK ))
764- p -> pack_keep = 1 ;
765-
766- xsnprintf (p -> pack_name + path_len , alloc - path_len , ".pack" );
767- if (stat (p -> pack_name , & st ) || !S_ISREG (st .st_mode )) {
768- free (p );
769- return NULL ;
770- }
771-
772- /* ok, it looks sane as far as we can check without
773- * actually mapping the pack file.
774- */
775- p -> pack_size = st .st_size ;
776- p -> pack_local = local ;
777- p -> mtime = st .st_mtime ;
778- if (path_len < 40 || get_sha1_hex (path + path_len - 40 , p -> sha1 ))
779- hashclr (p -> sha1 );
780- return p ;
781- }
782-
783722void install_packed_git (struct packed_git * pack )
784723{
785724 if (pack -> pack_fd != -1 )
0 commit comments