Torsten Bögershausen wrote:
> On 05/08/2014 08:37 AM, Johannes Sixt wrote:
> > What if both inums are zero? Can this happen on any sane POSIX system? I
> > don't know, but my gut feeling is that inode zero is too special to be
> > allocated for files or directories.
> > In that case, it is safe to assume that the st_ino field is just a
> > placeholder when it is zero, and we have to compare the file name. Then we
> > can either assume that this happens only for our emulation layer on MinGW
> > (and the comparison can be case-insensitive) or choose the comparison mode
> > based on core.ignorecase. This patch does the former, but I think we
> > should do the latter.
> Whatever we do, we should "protect" the strcasecmp() with ignore_case:
> !ignore_case || strcasecmp(src, dst)
> (And once that is done, you don't need to look at st_ino at all)
If both st_inos are zero on POSIX systems, there are two
possibilities: the two files are case-clones, or the two files are
hard-links of one another. Checking st_ino was just an optimization
to avoid the slow string comparison. I hadn't considered the
hard-link case important, but I guess it's better to be correct. So
here's a patch without (as well as a cleaned-up version of the first
patch, to keep the series together).
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