public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Linus Torvalds <torvalds@linux-foundation•org>
Cc: Git Mailing List <git@vger•kernel.org>,
	Frank <streamlake@tiscali•it>,
	Dmitry Potapov <dpotapov@gmail•com>
Subject: Re: [PATCH 7/7] Make unpack-tree update removed files before any updated files
Date: Sat, 22 Mar 2008 22:49:53 -0700	[thread overview]
Message-ID: <7vbq56f0qm.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: alpine.LFD.1.00.0803221038320.3020@woody.linux-foundation.org

Linus Torvalds <torvalds@linux-foundation•org> writes:

> Ok, this one looks - and is, really - trivial, but it's actually the only 
> one in the whole series that I'm even remotely nervous about. First off, 
> it actually does what it does regardless of that "core.ignorecase" 
> variable, but that wouldn't worry me if it wasn't for the fact that I 
> don't remember/understand what the heck that "last_symlink" logic was 
> there for.

last_symlink is just a cached information used by underlying
has_symlink_leading_path() function for optimization.

The motivation behind has_symlink_leading_path() is reasonably well
described in

 - f859c84: Add has_symlink_leading_path() function., 2007-05-11,

 - 64cab59: apply: do not get confused by symlinks in the middle,
   2007-05-11, and

 - 16a4c61: read-tree -m -u: avoid getting confused by intermediate
   symlinks., 2007-05-10

The short version is that:

 - sometimes we want to make sure a path a/b/c/d exists (or does not
   exist) in the work tree;

 - however, !lstat("a/b/c/d") is not quite it.  if a/b is a symlink in the
   work tree that points at somewhere that happens to have c/d underneath,
   !lstat() says "yeah, there is", but that one is _different_ from what
   checking out a cache entry a/b/c/d would produce (because in that case
   we will remove a/b symlink, create a/b/ directory and deposit blob b
   there).

 - So we often need to see if a given path has symlink component in the
   leading part in the work tree (e.g. given "a/b/c/d", we would need to
   check if any of "a", "a/b", "a/b/c" is a symlink).

The function has_symlink_leading_path() answers that question, and its
second argument is a buffer to cache "the last work tree path found to be
a symlink", so if you call it with "a/b/c/d" and then with "a/b/c/e" in
the above example situation, the second call can re-use the information
the first call found out, which is "a/b is a symlink".


I do not think your patch breaks the passing around of last_symlink cached
information.  Although the three commits I quoted above are all backed by
real-world breakage cases that they did fix, the issues they deal with are
indeed tricky cases.  Although your patch (the change in 7/7) should not
make any difference to the issues, thinking about them is already making
me feel nervous.

  parent reply	other threads:[~2008-03-23  5:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-22 17:21 [PATCH 0/7] Case-insensitive filesystem support, take 1 Linus Torvalds
2008-03-22 17:22 ` [PATCH 1/7] Make unpack_trees_options bit flags actual bitfields Linus Torvalds
2008-03-22 17:25   ` [PATCH 2/7] Move name hashing functions into a file of its own Linus Torvalds
2008-03-22 17:28     ` [PATCH 3/7] Make "index_name_exists()" return the cache_entry it found Linus Torvalds
2008-03-22 17:30       ` [PATCH 4/7] Make hash_name_lookup able to do case-independent lookups Linus Torvalds
2008-03-22 17:33         ` [PATCH 5/7] Add 'core.ignorecase' option Linus Torvalds
2008-03-22 17:38           ` [PATCH 6/7] Make branch merging aware of underlying case-insensitive filsystems Linus Torvalds
2008-03-22 17:45             ` [PATCH 7/7] Make unpack-tree update removed files before any updated files Linus Torvalds
2008-03-22 18:06               ` [PATCH 0/7] Final words Linus Torvalds
2008-03-22 18:28                 ` Linus Torvalds
2008-03-22 21:19               ` [PATCH 8/7] When adding files to the index, add support for case-independent matches Linus Torvalds
2008-03-22 21:22                 ` [PATCH 9/7] Make git-add behave more sensibly in a case-insensitive environment Linus Torvalds
2008-03-23  5:49               ` Junio C Hamano [this message]
2008-03-23  6:13             ` [PATCH 6/7] Make branch merging aware of underlying case-insensitive filsystems Junio C Hamano
2008-03-23 15:41               ` Linus Torvalds
2008-03-22 17:36   ` [PATCH 1/7] Make unpack_trees_options bit flags actual bitfields Johannes Schindelin
2008-03-22 17:47     ` Linus Torvalds
2008-03-22 17:57       ` Johannes Schindelin
2008-03-22 22:01 ` [PATCH] t0050: Set core.ignorecase case to activate case insensitivity Steffen Prohaska
2008-03-25  6:57 ` [PATCH] git-init: autodetect core.ignorecase Dmitry Potapov
2008-03-25  9:59   ` Johannes Schindelin
2008-03-25 10:49     ` [PATCH v2] " Dmitry Potapov
2008-03-25 11:03     ` [PATCH] " Dmitry Potapov
2008-03-25  8:14 ` [PATCH 0/7] Case-insensitive filesystem support, take 1 Dmitry Potapov
2008-03-25 21:04   ` Linus Torvalds
2008-03-26  2:46     ` Dmitry Potapov
2008-03-26  3:37       ` Linus Torvalds
2008-03-25 11:39 ` Derek Fawcus
2008-03-25 18:26   ` Jan Hudec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vbq56f0qm.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox$(echo .)com \
    --cc=dpotapov@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=streamlake@tiscali$(echo .)it \
    --cc=torvalds@linux-foundation$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox