* Couple of read-tree questions
@ 2005-09-01 4:17 Daniel Barkalow
2005-09-01 5:16 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Barkalow @ 2005-09-01 4:17 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
Is there any current use for read-tree with multiple trees without -m or
equivalent?
Why does --emu23 use I+H for stage 2, rather than just I? Wouldn't this
just reintroduce removed files?
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Couple of read-tree questions
2005-09-01 4:17 Couple of read-tree questions Daniel Barkalow
@ 2005-09-01 5:16 ` Junio C Hamano
2005-09-01 5:52 ` Junio C Hamano
2005-09-01 6:16 ` Daniel Barkalow
0 siblings, 2 replies; 7+ messages in thread
From: Junio C Hamano @ 2005-09-01 5:16 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: git
Daniel Barkalow <barkalow@iabervon.org> writes:
> Is there any current use for read-tree with multiple trees without -m or
> equivalent?
I did not know it even allowed multiple trees without -m, but
you are right. It does not seem to complain.
I have never thought about using multiple trees without -m, and
I do not remember hearing any plan nor purpose of using it to do
something interesting from Linus. I think its allowing multiple
trees without -m is simply a bug.
> Why does --emu23 use I+H for stage 2, rather than just I? Wouldn't this
> just reintroduce removed files?
They are not "removed files", at least in the original context.
The original intention was that git was supposed to work without
having _any_ files in the working tree. The reason why
multi-tree read-tree has so many special cases that says "must
match *if* work file exists", is that not having a corresponding
working file was supposed to be equivalent to having the file
checked out *and* unmodified.
That assumption and design goal was partially broken at around
the beginning of June when we started touching working tree
during a merge. Until that timeframe, we did not touch (nor
even look at) files in the working tree during the merge, mainly
due to the desire of performing the merge operation entirely in
the cache (which was the name of "index file" back then).
I do not think anybody currently uses --emu23. I did it because
it has a potential of making the two-tree fast forward (which is
used in "git checkout" to switch between branches) easier to
manage when the working tree is dirty than doing straight
two-tree merge, but that is just a theoretical potential never
tested in the field. Frankly, I do not mind, and I do not think
anybody else minds, too much if you need to break or remove
emu23 if that would make your code clean-up and redoing
read-tree easier.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Couple of read-tree questions
2005-09-01 5:16 ` Junio C Hamano
@ 2005-09-01 5:52 ` Junio C Hamano
2005-09-01 6:16 ` Daniel Barkalow
1 sibling, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2005-09-01 5:52 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: git
Junio C Hamano <junkio@cox.net> writes:
>> Why does --emu23 use I+H for stage 2, rather than just I? Wouldn't this
>> just reintroduce removed files?
>
> They are not "removed files", at least in the original context.
>
> The original intention was...
Gmane turns out to be better remembering things than my faulty
memory. The thread beginning here is a good summary of the
thinking behind the current design:
http://article.gmane.org/gmane.comp.version-control.git/4737
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Couple of read-tree questions
2005-09-01 5:16 ` Junio C Hamano
2005-09-01 5:52 ` Junio C Hamano
@ 2005-09-01 6:16 ` Daniel Barkalow
2005-09-01 6:32 ` Junio C Hamano
1 sibling, 1 reply; 7+ messages in thread
From: Daniel Barkalow @ 2005-09-01 6:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wed, 31 Aug 2005, Junio C Hamano wrote:
> Daniel Barkalow <barkalow@iabervon.org> writes:
>
> > Is there any current use for read-tree with multiple trees without -m or
> > equivalent?
>
> I did not know it even allowed multiple trees without -m, but
> you are right. It does not seem to complain.
>
> I have never thought about using multiple trees without -m, and
> I do not remember hearing any plan nor purpose of using it to do
> something interesting from Linus. I think its allowing multiple
> trees without -m is simply a bug.
I guess it was probably that its behavior was obvious and didn't require
any extra code. It still follows entirely from one tree without -m, but it
might be worth prohibiting unless someone has a reason to do it
intentionally.
> > Why does --emu23 use I+H for stage 2, rather than just I? Wouldn't this
> > just reintroduce removed files?
>
> They are not "removed files", at least in the original context.
>
> The original intention was that git was supposed to work without
> having _any_ files in the working tree. The reason why
> multi-tree read-tree has so many special cases that says "must
> match *if* work file exists", is that not having a corresponding
> working file was supposed to be equivalent to having the file
> checked out *and* unmodified.
But they'd not only be missing from the working tree but also from the
(pre-read-tree) index, which should only happen, assuming the index came
from "read-tree H", if they were subsequently removed from the index. I'd
understand treating index entries for files missing from the working tree
as up to date.
(The thread you mention seems to say that we accept entries being missing
from the index as if they were unchanged, but I don't see a good reason
for this; you'd be dealing with the full set in the index for the merge,
even if you don't have a populated working tree)
> I do not think anybody currently uses --emu23. I did it because
> it has a potential of making the two-tree fast forward (which is
> used in "git checkout" to switch between branches) easier to
> manage when the working tree is dirty than doing straight
> two-tree merge, but that is just a theoretical potential never
> tested in the field. Frankly, I do not mind, and I do not think
> anybody else minds, too much if you need to break or remove
> emu23 if that would make your code clean-up and redoing
> read-tree easier.
I should have asked sooner, then. :) There's a bunch of clutter to get it
to work that I can remove if it's not actually necessary.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Couple of read-tree questions
2005-09-01 6:16 ` Daniel Barkalow
@ 2005-09-01 6:32 ` Junio C Hamano
2005-09-01 7:10 ` Reworked read-tree Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2005-09-01 6:32 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: git
Daniel Barkalow <barkalow@iabervon.org> writes:
> (The thread you mention seems to say that we accept entries being missing
> from the index as if they were unchanged, but I don't see a good reason
> for this; you'd be dealing with the full set in the index for the merge,
> even if you don't have a populated working tree)
You are correct. I was wondering myself why *both* of us
thought (or Linus *seemed* to be agreeing, at least to me) what I
was referring to as I+H made any sense while re-reaing the
thread.
> I should have asked sooner, then. :) There's a bunch of clutter to get it
> to work that I can remove if it's not actually necessary.
Yeah, removal of dead code! Go wild, please.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Reworked read-tree.
2005-09-01 6:32 ` Junio C Hamano
@ 2005-09-01 7:10 ` Junio C Hamano
2005-09-01 15:55 ` Daniel Barkalow
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2005-09-01 7:10 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: git
Daniel, I do not know what your current status is, but I think
you need something like this.
I was scratching my head figuring out why it passes all the t/
tests but couldn't do a simple 'git-read-tree HEAD'.
---
diff --git a/tree.c b/tree.c
--- a/tree.c
+++ b/tree.c
@@ -224,10 +224,12 @@ struct tree *parse_tree_indirect(const u
if (obj->type == tree_type)
return (struct tree *) obj;
else if (obj->type == commit_type)
- return ((struct commit *) obj)->tree;
+ obj = (struct object *)(((struct commit *) obj)->tree);
else if (obj->type == tag_type)
- obj = ((struct tag *) obj)->tagged;
+ obj = deref_tag(obj);
else
return NULL;
+ if (!obj->parsed)
+ parse_object(obj->sha1);
} while (1);
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Reworked read-tree.
2005-09-01 7:10 ` Reworked read-tree Junio C Hamano
@ 2005-09-01 15:55 ` Daniel Barkalow
0 siblings, 0 replies; 7+ messages in thread
From: Daniel Barkalow @ 2005-09-01 15:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Thu, 1 Sep 2005, Junio C Hamano wrote:
> Daniel, I do not know what your current status is, but I think
> you need something like this.
Yup, I forgot to actually test that functionality.
> ---
> diff --git a/tree.c b/tree.c
> --- a/tree.c
> +++ b/tree.c
> @@ -224,10 +224,12 @@ struct tree *parse_tree_indirect(const u
> if (obj->type == tree_type)
> return (struct tree *) obj;
> else if (obj->type == commit_type)
> - return ((struct commit *) obj)->tree;
> + obj = (struct object *)(((struct commit *) obj)->tree);
obj = &((struct commit *) obj)->tree->object;
Multiple sequential casts always bother me, and we do actually have a
field for this.
> else if (obj->type == tag_type)
> - obj = ((struct tag *) obj)->tagged;
> + obj = deref_tag(obj);
Shouldn't be necessary (once you've got the parse_object below); we're
already in a loop dereferencing things.
> else
> return NULL;
> + if (!obj->parsed)
> + parse_object(obj->sha1);
> } while (1);
> }
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-09-01 15:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-01 4:17 Couple of read-tree questions Daniel Barkalow
2005-09-01 5:16 ` Junio C Hamano
2005-09-01 5:52 ` Junio C Hamano
2005-09-01 6:16 ` Daniel Barkalow
2005-09-01 6:32 ` Junio C Hamano
2005-09-01 7:10 ` Reworked read-tree Junio C Hamano
2005-09-01 15:55 ` Daniel Barkalow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).