Re: [PATCH] checkout_entry: only try to create directories when no file existed there

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

 



Hi,

On Wed, 8 Aug 2007, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:
> 
> > It is obvious that we do not have to create directories when the file we
> > want to check out already existed.
> 
> It is not so obvious to me.  In fact I vaguely recall we had
> complaint about opposite case where we did not honor a symlink
> to be checked out as a symlink because an earlier branch had it
> as a directory.

That case is not affected by my patch, AFAICT.  It only affects the case 
when you check out an entry, say "a/b/c/d/e/f/g".  If that file already 
exists, we have to remove it, in order to write over it.  That's the 
"unlink" which is above the hunk of the diff I sent.

Now, if we have to remove it, we did a stat() before that.  It succeeded.  
So we know that "a/b/c/d/e/f/" exists.  It might contain some symlinks, 
but it exists.

So putting the "create_directories()" into the else branch, we avoid doing 
unnecessary work.

Coincidentally, my hackish use case (don't try this at home, kids!) is 
fixed, too.

Ciao,
Dscho

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

  Powered by Linux