Re: [PATCH 2/3] config: add git_config_from_sha1() to read from a blob

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

 



2010/12/9 Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx>:
>
> Signed-off-by: Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx>
> ---
> Âconfig.c | Â 34 ++++++++++++++++++++++++++++++++++
> Â1 files changed, 34 insertions(+), 0 deletions(-)
>
> diff --git a/config.c b/config.c
> index c8bf46f..e7a9ff4 100644
> --- a/config.c
> +++ b/config.c
> @@ -809,6 +809,40 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data)
> Â Â Â Âreturn ret;
> Â}
>

> +static int git_config_from_sha1(config_fn_t fn, const char *sha1_name, void *data)
> +{

Is worth documenting the return value of this function and what it
does? It returns 0 on success otherwise returns -1.

> + Â Â Â unsigned char sha1[20];
> + Â Â Â enum object_type type;
> + Â Â Â unsigned long size;
> + Â Â Â int ret;
> +
> + Â Â Â if (get_sha1(sha1_name, sha1)) {
> + Â Â Â Â Â Â Â error("bad shared config reference '%s'", sha1_name);
> + Â Â Â Â Â Â Â return -1;
> + Â Â Â }
> +
> + Â Â Â config_file = read_sha1_file(sha1, &type, &size);
> + Â Â Â if (!config_file) {
> + Â Â Â Â Â Â Â error("bad shared config '%s'", sha1_name);
> + Â Â Â Â Â Â Â return -1;
> + Â Â Â }
> + Â Â Â if (type == OBJ_BLOB) {
> + Â Â Â Â Â Â Â config_file_pos = 0;
> + Â Â Â Â Â Â Â config_file_size = size;
> + Â Â Â Â Â Â Â config_file_name = sha1_name;
> + Â Â Â Â Â Â Â config_linenr = 1;
> + Â Â Â Â Â Â Â config_file_eof = 0;
> + Â Â Â Â Â Â Â ret = git_parse_file(fn, data);
> + Â Â Â }
> + Â Â Â else {

style nit: Shouldn't this else be on the end of the previous line?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]