Re: [PATCH v3 07/25] reflog: avoid constructing .lock path with git_path

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

 



Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> writes:

> git_path() soon understands the path given to it. Some paths "abc" may
> become "def" while other "ghi" may become "ijk". We don't want
> git_path() to interfere with .lock path construction. Concatenate
> ".lock" after the path has been resolved by git_path() so if "abc"
> becomes "def", we'll have "def.lock", not "ijk".

Hmph.  I am not sure if the above is readable (or if I am reading it
correctly).

If "abc" becomes "def", it would take deliberate work to make
"abc.lock" into "ijk", and it would be natural to expect that
"abc.lock" would become "def.lock" without any fancy trick, no?


> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
>  builtin/reflog.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/reflog.c b/builtin/reflog.c
> index 852cff6..ccf2cf6 100644
> --- a/builtin/reflog.c
> +++ b/builtin/reflog.c
> @@ -372,7 +372,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
>  	if (!file_exists(log_file))
>  		goto finish;
>  	if (!cmd->dry_run) {
> -		newlog_path = git_pathdup("logs/%s.lock", ref);
> +		newlog_path = mkpathdup("%s.lock", log_file);
>  		cb.newlog = fopen(newlog_path, "w");
>  	}
--
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]