Re: [PATCH v3 24/25] prune: strategies for linked checkouts

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

 



On Tue, Feb 18, 2014 at 8:40 AM, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> The pruning rules are:
>
>  - if $REPO/locked exists, repos/<id> is not supposed to be pruned.
>
>  - if $REPO/locked exists and $REPO/gitdir's mtimer is older than a

s/mtimer/mtime/

>    really long limit, warn about old unused repo.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 7b86f2b..c501e9c 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -854,6 +854,17 @@ static void remove_junk_on_signal(int signo)
>         raise(signo);
>  }
>
> +static dev_t get_device_or_die(const char *path)
> +{
> +       struct stat buf;
> +       if (stat(path, &buf))
> +               die_errno("failed to stat '%s'", path);
> +       /* Ah Windows! Make different drives different "partitions" */
> +       if (buf.st_dev == 0 && has_dos_drive_prefix("c:\\"))
> +               buf.st_dev = toupper(real_path(path)[0]);

This invocation of has_dos_drive_prefix() with hardcoded "c:\\" at
first looks like an error until the reader realizes that it's an
#ifdef-less check if the platforms is Windows. Would it make more
sense to encapsulate this anomaly and abstract it away by fixing
compat/mingw.c:do_lstat() to instead set 'st_dev' automatically like
you do here? In particular, this line in mingw.c:

    buf->st_dev = buf->st_rdev = 0; /* not used by Git */

> +       return buf.st_dev;
> +}
--
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]