git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 8, 2007, 21:42 UTC
Message-ID
<Pine.LNX.4.64.0708082239120.21857@racer.site>
In-Reply-To
<7v4pj93evc.fsf@assigned-by-dhcp.cox.net>
Hi,
On Wed, 8 Aug 2007, Junio C Hamano wrote:
Show 9 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> 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

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 6 in “checkout_entry: only try to create directories when no file existed there”
  1. checkout_entry: only try to create directories when no file existed thereJohannes Schindelin, Aug 8, 2007
  2. Junio C HamanoAug 8, 2007
  3. Johannes SchindelinAug 8, 2007
  4. Junio C HamanoAug 8, 2007
  5. Johannes SchindelinAug 8, 2007
  6. David KastrupAug 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.