Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
WIP use TreeDefinition instead of index to make trees #524
Conversation
Jan 10, 2014
This was referenced
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
KindDragon
Jan 10, 2014
Contributor
Clone in this PR works several times faster for me :+1: :+1: :+1:
My mistake, a little faster
My mistake, a little faster |
pmiossec
reviewed
Jan 10, 2014
@@ -237,7 +237,7 @@ private Process Start(string[] command) | ||
protected virtual Process Start(string [] command, Action<ProcessStartInfo> initialize) | ||
{ | ||
var startInfo = new ProcessStartInfo(); | ||
- startInfo.FileName = "git"; |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
pmiossec
Jan 10, 2014
Owner
I think you should let the previous value (and add git to your path). Everyone doesn't install git in the "program files" folder....
pmiossec
Jan 10, 2014
Owner
I think you should let the previous value (and add git to your path). Everyone doesn't install git in the "program files" folder....
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
sc68cal
Jan 10, 2014
Contributor
@KindDragon Awesome - do you have a comparison in runtime between this PR and using the temporary index? It would be a useful stat to see how much faster we get from not shelling out to the Git binary.
@KindDragon Awesome - do you have a comparison in runtime between this PR and using the temporary index? It would be a useful stat to see how much faster we get from not shelling out to the Git binary. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
pmiossec
Jan 10, 2014
Owner
I have made some tests with my codeplex test repository (with some interesting cases inside) and I end up with exactly the same sha1. So, that's good...
So, after some little cleaning, I am good for merging.
PS :
- I can't see (and measure) improvements because I am constraint by the network.
- Some tests failed on Travis build but not on my computer. I hope Travis will pass in the next build or we will have to have a look why before merging...
I have made some tests with my codeplex test repository (with some interesting cases inside) and I end up with exactly the same sha1. So, that's good... So, after some little cleaning, I am good for merging. PS :
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
sc68cal
Jan 10, 2014
Contributor
Going to kick travis again - that's how badly I want this to get merged
Going to kick travis again - that's how badly I want this to get merged |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
sc68cal
Jan 10, 2014
Contributor
Ah. I know why. It's because he hard coded in that path to Git, and Travis runs the build and tests on Mono+Linux.
@kgybels please fix that and we should be good to go!
---- System.ComponentModel.Win32Exception : ApplicationName='c:\program files (x86)\git\bin\git.exe', CommandLine='log --no-color --pretty=medium HEAD --', CurrentDirectory=''
Ah. I know why. It's because he hard coded in that path to Git, and Travis runs the build and tests on Mono+Linux. @kgybels please fix that and we should be good to go!
|
@pmiossec Would it be useful to investigate automating a smoke test, that does a clone from that codeplex test repository and makes sure the SHA ends up being the right one? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
@sc68cal It could be done but this repository is the one I use for development and there is 2 cases not supported by the current version of git-tfs and only supported by my work in progress. The current version of git-tfs can't clone the tfs repository :( |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
KindDragon
Jan 10, 2014
Contributor
@KindDragon Awesome - do you have a comparison in runtime between this PR and using the temporary index? It would be a useful stat to see how much faster we get from not shelling out to the Git binary.
My mistake, new version a little faster.
But new code consume a lot more memory. 1,5Gb after 2 hours (old code around 0,5Gb). Maybe we have some memory leaks.
My mistake, new version a little faster. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
kgybels
Jan 10, 2014
Contributor
Main problem with GitRepository.ParseEntries not solved
We need a case-insensitive TreeDefinition to be able to get rid of GitRepository.ParseEntries.
See comment on libgit2/libgit2sharp#587 for more information.
We need a case-insensitive TreeDefinition to be able to get rid of GitRepository.ParseEntries. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
kgybels
Jan 10, 2014
Contributor
VS2013 insists on adding BOMs to all my new code files and changed project files. Is it a problem to leave them in?
VS2013 insists on adding BOMs to all my new code files and changed project files. Is it a problem to leave them in? |
kgybels
added some commits
Jan 10, 2014
kgybels
referenced this pull request
in libgit2/libgit2sharp
Jan 10, 2014
Closed
Exposing low level method for external application #602
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
spraints
Jan 10, 2014
Owner
VS2013 insists on adding BOMs to all my new code files and changed project files. Is it a problem to leave them in?
BOMs should be fine.
Main problem with GitRepository.ParseEntries not solved
We need a case-insensitive TreeDefinition to be able to get rid of GitRepository.ParseEntries.
See comment on libgit2/libgit2sharp#587 for more information.
I wonder if we should replace initialTree
with something that can do the same thing (i.e. same interface), but make it lazy and based off of a LibGit2Sharp Tree?
BOMs should be fine.
I wonder if we should replace |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
spraints
Jan 10, 2014
Owner
... and then I look at the code, and see that you've started doing this. Doing the case-insensitive tree manipulation should be doable. Instead of _treeDefinition.Add(path, file, Mode.ToFileMode(mode));
, we could do something like this (make-believe code with make-believe APIs):
var parts = path.Split('/');
var tree = _treeDefinition.Tree;
while(parts.Length > 1) {
var subdir = tree.Entries.SingleOrDefault(e => e.Name.ToLower() == parts[0].ToLower());
if(subdir == null) {
subdir = new Tree();
tree.Add(parts[0], subdir);
}
tree = subdir;
}
tree.Add(parts[0], file, mode);
... and then I look at the code, and see that you've started doing this. Doing the case-insensitive tree manipulation should be doable. Instead of
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
kgybels
Jan 10, 2014
Contributor
I wonder if we should replace initialTree with something that can do the same thing (i.e. same interface), but make it lazy and based off of a LibGit2Sharp Tree?
That is what I did in my last 2 commits, except I used TreeDefinition instead of Tree.
I also think we can consolidate IGitTreeBuilder and IGitTreeInformation. The information of the tree with some changes already applied to it, should be sufficient, I don't think we need the tree exactly like it is "initially" (the parent tree), while applying changes. The responsibility of preserving file mode when a change is an update can also be moved to IGitTreeBuilder entirely. To summarize, with IGitTreeBuilder working case-insensitive and handling the file mode on its own, IGitTreeInformation becomes redundant.
That is what I did in my last 2 commits, except I used TreeDefinition instead of Tree. I also think we can consolidate IGitTreeBuilder and IGitTreeInformation. The information of the tree with some changes already applied to it, should be sufficient, I don't think we need the tree exactly like it is "initially" (the parent tree), while applying changes. The responsibility of preserving file mode when a change is an update can also be moved to IGitTreeBuilder entirely. To summarize, with IGitTreeBuilder working case-insensitive and handling the file mode on its own, IGitTreeInformation becomes redundant. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
kgybels
Jan 10, 2014
Contributor
... and then I look at the code, and see that you've started doing this. Doing the case-insensitive tree manipulation should be doable. Instead of _treeDefinition.Add(path, file, Mode.ToFileMode(mode));
I made TreeDefinition itself handle the case-insensitive part (like this). Still need to think about how to properly expose both use cases, though.
I made TreeDefinition itself handle the case-insensitive part (like this). Still need to think about how to properly expose both use cases, though. |
Looks great @kgybels ! Keep up the great work! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
kgybels
Jan 12, 2014
Contributor
@KindDragon Would you be so kind as to rerun your performance benchmark with the latest version of this PR? It would also be nice to know how big the repository that you are testing against is? I am using a repository with about 18000 files and the improvement is not that impressive, but I hope improvement scales with the size of the repository.
@KindDragon Would you be so kind as to rerun your performance benchmark with the latest version of this PR? It would also be nice to know how big the repository that you are testing against is? I am using a repository with about 18000 files and the improvement is not that impressive, but I hope improvement scales with the size of the repository. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
spraints
Jan 15, 2014
Owner
#519 had major conflicts with this. I spent some time with the two branches and git-imerge and I think I have a good merge of the two (spraints/git-tfs@1f75d48).
We need to get libgit2sharp back to the libgit2 repo before merging this. @kgybels - can you work on a PR based on the libgit2sharp version this branch is using (https://github.com/kgybels/libgit2sharp/compare/experimental)?
#519 had major conflicts with this. I spent some time with the two branches and git-imerge and I think I have a good merge of the two (spraints/git-tfs@1f75d48). We need to get libgit2sharp back to the libgit2 repo before merging this. @kgybels - can you work on a PR based on the libgit2sharp version this branch is using (https://github.com/kgybels/libgit2sharp/compare/experimental)? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
kgybels
Jan 15, 2014
Contributor
@spraints It's not sure yet that this is something that LibGit2Sharp wants to support (see libgit2/libgit2sharp#587 and libgit2/libgit2sharp#607 for discussion). However, I'm willing to make the PR for it, but if we want any chance of getting it in, it needs to be decent, preferably with unit tests.
The first commit is something we could already put on master, even without the case-insensitive TreeDefinition
. It already gets rid of calling git update-index
and git write-tree
for creating the tree. Once we have a version of LibGit2Sharp with the case-insenstive TreeDefinition
, I'll rebase the rest of the work on git-tfs's master.
@KindDragon I toke a quick look at the code where that GetInstance
is used. It seems like it is a bad idea to use that in a hotspot like that. However, it seems trivial to rework that code a bit to get rid of it, if only I had more time!
@spraints It's not sure yet that this is something that LibGit2Sharp wants to support (see libgit2/libgit2sharp#587 and libgit2/libgit2sharp#607 for discussion). However, I'm willing to make the PR for it, but if we want any chance of getting it in, it needs to be decent, preferably with unit tests. The first commit is something we could already put on master, even without the case-insensitive @KindDragon I toke a quick look at the code where that |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
spraints
Jan 17, 2014
Owner
@spraints It's not sure yet that this is something that LibGit2Sharp wants to support (see libgit2/libgit2sharp#587 and libgit2/libgit2sharp#607 for discussion). However, I'm willing to make the PR for it, but if we want any chance of getting it in, it needs to be decent, preferably with unit tests.
I just read up on that, and I'd be fine with making this solely a concern in git-tfs. IGitTreeDefinition and IGitTreeBuilder both provide places where we can do the necessary work.
The first commit is something we could already put on master, even without the case-insensitive TreeDefinition. It already gets rid of calling git update-index and git write-tree for creating the tree. Once we have a version of LibGit2Sharp with the case-insenstive TreeDefinition, I'll rebase the rest of the work on git-tfs's master.
#529 has just the first commit (and some minor cleanup). Also, merge commits aren't a big deal to me. Feel free to use spraints/git-tfs@1f75d48 as a starting point for working on the case-sensitivity stuff.
I just read up on that, and I'd be fine with making this solely a concern in git-tfs. IGitTreeDefinition and IGitTreeBuilder both provide places where we can do the necessary work.
#529 has just the first commit (and some minor cleanup). Also, merge commits aren't a big deal to me. Feel free to use spraints/git-tfs@1f75d48 as a starting point for working on the case-sensitivity stuff. |
Seems merged with #529 (no?) |
kgybels commentedJan 10, 2014
No description provided.