* RFH: refactor read-tree
@ 2006-07-08 22:28 Johannes Schindelin
2006-07-09 3:15 ` Linus Torvalds
0 siblings, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2006-07-08 22:28 UTC (permalink / raw)
To: git
Hi,
the last thing to do with merge-recursive to speed it up, would be to
avoid reading/writing the cache all the time.
Unfortunately, builtin-read-tree.c grew into a pretty big monster, with so
many different options which completely change behaviour.
So, how should I go about it? Should I make a struct a la diff_options to
hold the options to unpack_trees? Where should it go?
I also played a little with git-merge-tree, because it seems so much
simpler and easier to refactor. But there is a problem: Either I call it
the wrong way, or it does not yet work correctly: I tried
git-merge-tree $(git-merge-base branch1 branch2) branch1 branch2
with what is in 'next'. But it only showed the _new_ files, not the
modified ones.
Help, please?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: RFH: refactor read-tree
2006-07-08 22:28 RFH: refactor read-tree Johannes Schindelin
@ 2006-07-09 3:15 ` Linus Torvalds
2006-07-09 12:43 ` Alex Riesen
2006-07-09 14:55 ` Johannes Schindelin
0 siblings, 2 replies; 7+ messages in thread
From: Linus Torvalds @ 2006-07-09 3:15 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
On Sun, 9 Jul 2006, Johannes Schindelin wrote:
>
> I also played a little with git-merge-tree, because it seems so much
> simpler and easier to refactor. But there is a problem: Either I call it
> the wrong way, or it does not yet work correctly: I tried
>
> git-merge-tree $(git-merge-base branch1 branch2) branch1 branch2
>
> with what is in 'next'. But it only showed the _new_ files, not the
> modified ones.
What git-merge-tree does is to show the _difference_ to "branch1".
So if the result of the merge would be totally identical to "branch1",
then git-merge-tree should be totally silent.
The basic idea is that "branch1" should be your current branch, and it
obviously is also expected to match (more or less) the current index. So
you can do a merge by
- reading in "branch1" into the index:
GIT_INDEX_FILE=.git/tmp-index git-read-tree -m branch1
- doing a "git-merge-tree $base $branch1 $branch2"
- using the _result_ of "git-merge-tree" to modify the index you just
read in.
- write out the end result as the result of the merge.
And yes, I agree 100% that "git-read-tree" has become an unholy mess. I
looked at it, and I think it's unfixable. I considered re-writing it from
scratch, at least for some specific cases, but I couldn't bring myself to
do it.
Linus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: RFH: refactor read-tree
2006-07-09 3:15 ` Linus Torvalds
@ 2006-07-09 12:43 ` Alex Riesen
2006-07-09 14:30 ` Johannes Schindelin
2006-07-09 14:55 ` Johannes Schindelin
1 sibling, 1 reply; 7+ messages in thread
From: Alex Riesen @ 2006-07-09 12:43 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Johannes Schindelin, git
Linus Torvalds, Sun, Jul 09, 2006 05:15:41 +0200:
> The basic idea is that "branch1" should be your current branch, and it
> obviously is also expected to match (more or less) the current index. So
> you can do a merge by
>
> - reading in "branch1" into the index:
>
> GIT_INDEX_FILE=.git/tmp-index git-read-tree -m branch1
what is "-m" here for?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: RFH: refactor read-tree
2006-07-09 12:43 ` Alex Riesen
@ 2006-07-09 14:30 ` Johannes Schindelin
2006-07-09 15:30 ` Linus Torvalds
0 siblings, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2006-07-09 14:30 UTC (permalink / raw)
To: Alex Riesen; +Cc: Linus Torvalds, git
Hi,
On Sun, 9 Jul 2006, Alex Riesen wrote:
> Linus Torvalds, Sun, Jul 09, 2006 05:15:41 +0200:
> > The basic idea is that "branch1" should be your current branch, and it
> > obviously is also expected to match (more or less) the current index. So
> > you can do a merge by
> >
> > - reading in "branch1" into the index:
> >
> > GIT_INDEX_FILE=.git/tmp-index git-read-tree -m branch1
>
> what is "-m" here for?
It means that git-read-tree tries to merge the current index with branch1.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: RFH: refactor read-tree
2006-07-09 3:15 ` Linus Torvalds
2006-07-09 12:43 ` Alex Riesen
@ 2006-07-09 14:55 ` Johannes Schindelin
1 sibling, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2006-07-09 14:55 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
Hi,
On Sat, 8 Jul 2006, Linus Torvalds wrote:
> On Sun, 9 Jul 2006, Johannes Schindelin wrote:
> >
> > I also played a little with git-merge-tree, because it seems so much
> > simpler and easier to refactor. But there is a problem: Either I call it
> > the wrong way, or it does not yet work correctly: I tried
> >
> > git-merge-tree $(git-merge-base branch1 branch2) branch1 branch2
> >
> > with what is in 'next'. But it only showed the _new_ files, not the
> > modified ones.
>
> What git-merge-tree does is to show the _difference_ to "branch1".
I see my problem: branch1 is not the "upstream" branch, but my own. Tsk.
Too easy.
Now, if only merge-tree knew about renames. *sigh*.
> And yes, I agree 100% that "git-read-tree" has become an unholy mess. I
> looked at it, and I think it's unfixable. I considered re-writing it from
> scratch, at least for some specific cases, but I couldn't bring myself to
> do it.
Well, I think that at least the unpack_tree() thing should be relatively
easy to extract. And the rest _should_ be relatively easy to clean up,
provided we introduce a read_tree_options struct, which gets passed around
a la "this" in Java/C++.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: RFH: refactor read-tree
2006-07-09 14:30 ` Johannes Schindelin
@ 2006-07-09 15:30 ` Linus Torvalds
2006-07-09 22:17 ` Alex Riesen
0 siblings, 1 reply; 7+ messages in thread
From: Linus Torvalds @ 2006-07-09 15:30 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Alex Riesen, git
On Sun, 9 Jul 2006, Johannes Schindelin wrote:
>
> On Sun, 9 Jul 2006, Alex Riesen wrote:
>
> > Linus Torvalds, Sun, Jul 09, 2006 05:15:41 +0200:
> > > The basic idea is that "branch1" should be your current branch, and it
> > > obviously is also expected to match (more or less) the current index. So
> > > you can do a merge by
> > >
> > > - reading in "branch1" into the index:
> > >
> > > GIT_INDEX_FILE=.git/tmp-index git-read-tree -m branch1
> >
> > what is "-m" here for?
>
> It means that git-read-tree tries to merge the current index with branch1.
Well, the current index always "merges" by just taking the timestamps from
it. The actual _content_ doesn't matter for the single-tree case.
For the two- and three-tree case, "git-read-tree -m" will verify that the
parts that got changed still _match_ in the index, but for a single-tree
"git-read-tree", there's nothing to match against, just the target, so
the only thing it does is that for matching index/target-tree entries it
will re-use the index timestamps (and other stat info).
Linus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: RFH: refactor read-tree
2006-07-09 15:30 ` Linus Torvalds
@ 2006-07-09 22:17 ` Alex Riesen
0 siblings, 0 replies; 7+ messages in thread
From: Alex Riesen @ 2006-07-09 22:17 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Johannes Schindelin, git
Linus Torvalds, Sun, Jul 09, 2006 17:30:26 +0200:
> > > > The basic idea is that "branch1" should be your current branch, and it
> > > > obviously is also expected to match (more or less) the current index. So
> > > > you can do a merge by
> > > >
> > > > - reading in "branch1" into the index:
> > > >
> > > > GIT_INDEX_FILE=.git/tmp-index git-read-tree -m branch1
> > >
> > > what is "-m" here for?
> >
> > It means that git-read-tree tries to merge the current index with branch1.
>
> Well, the current index always "merges" by just taking the timestamps from
> it. The actual _content_ doesn't matter for the single-tree case.
But the name suggests it's a temporary index, which would not have
anything in it and even the .git/tmp-index is not supposed to exist.
So I'd actually understand this as creating an index from the tree-ish
branch1, without merging anything. And continue wondering what that -m
is for...
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-07-09 22:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-08 22:28 RFH: refactor read-tree Johannes Schindelin
2006-07-09 3:15 ` Linus Torvalds
2006-07-09 12:43 ` Alex Riesen
2006-07-09 14:30 ` Johannes Schindelin
2006-07-09 15:30 ` Linus Torvalds
2006-07-09 22:17 ` Alex Riesen
2006-07-09 14:55 ` Johannes Schindelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox