Re: [PATCH] setup: update the right file in multiple checkouts

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

 



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

> This code is introduced in 23af91d (prune: strategies for linked
> checkouts - 2014-11-30), and it's supposed to implement this rule from
> that commit's message:
>
>  - linked checkouts are supposed to keep its location in $R/gitdir up
>    to date. The use case is auto fixup after a manual checkout move.
>
> Note the name, "$R/gitdir", not "$R/gitfile". Correct the path to be
> updated accordingly.
>
> While at there, make sure I/O errors are not silently dropped.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
>  The code was right in v2 [1] and became "gitfile" since v3 [2]. I
>  need to reconsider my code quality after this :(

Heh, don't sweat it.  Everybody makes mistakes and sometimes becomes
sloppy.

Thanks for double checking and correcting.  Perhaps this could have
caught if we had some test coverage, I wonder?

>  [1] http://article.gmane.org/gmane.comp.version-control.git/239299
>  [2] http://article.gmane.org/gmane.comp.version-control.git/242325
>
>  setup.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/setup.c b/setup.c
> index 5f9f07d..64bf2b4 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -402,9 +402,9 @@ static void update_linked_gitdir(const char *gitfile, const char *gitdir)
>  	struct strbuf path = STRBUF_INIT;
>  	struct stat st;
>  
> -	strbuf_addf(&path, "%s/gitfile", gitdir);
> +	strbuf_addf(&path, "%s/gitdir", gitdir);
>  	if (stat(path.buf, &st) || st.st_mtime + 24 * 3600 < time(NULL))
> -		write_file(path.buf, 0, "%s\n", gitfile);
> +		write_file(path.buf, 1, "%s\n", gitfile);
>  	strbuf_release(&path);
>  }
--
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]