Re: [PATCH] Do not change the file type if the filesystem does not support symlinks.

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

 



On Tuesday 27 February 2007 23:54, Johannes Schindelin wrote:
> On Tue, 27 Feb 2007, Johannes Sixt wrote:
> > diff --git a/read-cache.c b/read-cache.c
> > index 605b352..f09ee2e 100644
> > --- a/read-cache.c
> > +++ b/read-cache.c
> > @@ -116,7 +116,8 @@ static int ce_match_stat_basic(struct cache_entry
> > *ce, struct stat *st)
> >
> >  	switch (ntohl(ce->ce_mode) & S_IFMT) {
> >  	case S_IFREG:
> > -		changed |= !S_ISREG(st->st_mode) ? TYPE_CHANGED : 0;
> > +		if (trust_symlink_fmt && !S_ISREG(st->st_mode))
> > +			changed |= TYPE_CHANGED;
>
> Really? If the cache entry says S_IFREG we should not expect a symlink
> here, right?

Don't know what I was smoking here. This hunk just doesn't need to be there at 
all...

>
> > @@ -125,7 +126,8 @@ static int ce_match_stat_basic(struct cache_entry
> > *ce, struct stat *st) changed |= MODE_CHANGED;
> >  		break;
> >  	case S_IFLNK:
> > -		changed |= !S_ISLNK(st->st_mode) ? TYPE_CHANGED : 0;
> > +		if (trust_symlink_fmt && !S_ISLNK(st->st_mode))
> > +			changed |= TYPE_CHANGED;
>
> This does not handle the case symlink->directory, right?

Something like:

		if (!S_ISLNK(st->st_mode) &&
		    (trust_symlink_fmt || !S_ISREG(st->st_mode)))
			changed |= TYPE_CHANGE;

BTW, considering the size of the entire patch series, I'm thinking of 
submitting it in a single patch.

-- Hannes
-
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]