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

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

 



On Thu, Feb 20, 2014 at 5:08 AM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
>> +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 */
>

I don't want to hide too much magic behind compat curtain, especially
when these magic is just about 90% as real, the rest is mysterious
corner cases. I guess we could just add an inline function
is_windows() that always returns 0 or 1 based on #ifdef.
-- 
Duy
--
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]