On Tue, Feb 18, 2014 at 8:40 AM, Nguyễn Thái Ngọc Duy <pclo...@gmail.com> 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 <pclo...@gmail.com>
> ---
> 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to