Linus Torvalds <torvalds@linux-foundation.org> writes:
quoted text > On Thu, 19 Jul 2007, David Kastrup wrote:
>>
>> Well, kudos. Together with the analysis from Junio, this seems like a
>> good start. Would you have any recommendations about what stuff one
>> should really read in order to get up to scratch about git internals?
>
> Well, you do need to understand the index. That's where all the new
> subtlety happens.
>
> The data structures themselves are trivial, and we've supported empty
> trees (at the top level) from the beginning, so that part is not anything
> new.
>
> However, now having a new entry type in the index (S_IFDIR) means that
> anything that interacts with the index needs to think twice. But a lot of
> that is just testing what happens, and so the first thing to do is to have
> a test-suite.
>
> There's also the question about how to show an empty tree in a diff. We've
> never had that: the only time we had empty trees was when we compared a
> totally empty "root" tree against another tree, and then it was obvious.
> But what if the empty tree is a subdirectory of another tree - how do you
> express that in a diff? Do you care? Right now, since we always recurse
> into the tree (and then not find anything), empty trees will simply not
> show up _at_all_ in any diffs.
>
> And what about usability issues elsewhere? With my patch, doing something
> like a
>
> git add directory/
>
> still won't do anything, because the behaviour of "git add" has always
> been to recurse into directories. So to add a new empty directory, you'd
> have to do
>
> git update-index --add directory
>
> and that's not exactly user-friendly.
>
> So do you add a "-n" flag to "git add" to tell it to not recurse? Or do
> you always recurse, but then if you notice that the end result is empty,
> you add it as a directory?
Another issue I thought about was what you would do in the step
3 in the following:
1. David says "mkdir D; git add D"; you add S_IFDIR entry in
the index at D;
2. David says "date >D/F; git add D/F"; presumably you drop D
from the index (to keep the index more backward compatible)
and add S_IFREG entry at D/F.
3. David says "git rm D/F".
Have we stopped keeping track of the "empty directory" at this
point?
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html