Re: [PATCH 22/27] sha1_file: allow sha1_file_name to handle arbitrary repositories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 20 Feb 2018 17:54:25 -0800
Stefan Beller <sbeller@xxxxxxxxxx> wrote:

> Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
> Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>

Reviewed-by: Jonathan Tan <jonathantanmy@xxxxxxxxxx>

> -void sha1_file_name_the_repository(struct strbuf *buf, const unsigned char *sha1)
> +void sha1_file_name(struct repository *r, struct strbuf *buf, const unsigned char *sha1)
>  {
> -	strbuf_addstr(buf, get_object_directory());
> +	strbuf_addstr(buf, r->objects.objectdir);
>  	strbuf_addch(buf, '/');
>  	fill_sha1_path(buf, sha1);
>  }

In the future, we should probably have:
 - a function to get the object store out of a repo (so that it can
   lazily initialize the object store struct if necessary)
 - when the object store is obtained, its objectdir field is guaranteed
   to be populated
 - sha1_file_name should take the object store struct, not the repo
   struct

but this is outside the scope of this patch.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux