The following corner cases exist for displaying last commit information correctly. There should be explicit test cases for these cases. It will almost certainly require a change to the LastCommitDoc structure.
/file1
/file2
/file1
) == hash(/file2
)/dir1/file1
/dir2/file2
/dir1/file1
) == hash(/dir2/file2
)/dir1/
) == hash(/dir2/
)/dir2/file3
/dir2/file2
) != hash(/dir2/file3
)/dir1/
) != hash(/dir2/
)/dir1/file1
/dir1-copy/file1
/dir1/file1
) == hash(/dir1-copy/file1
)/dir1/
) == hash(/dir1-copy/
)/file1
/file1
) == F0/
) == T0/file1
/file1
) == F1/
) == T1/file1
/file1
) == F0/
) == T0All of these cases also have to work across repos, though ideally with minimal duplication of data (forks)
Given a commit ID and a path, the solution needs to be able to find the most recent values for the tree's nodes that are not newer than the given commit. This means we need to have some way of determining ordering: is the tree information for commit ID X before or after the info for commit ID Y.
Diff:
It's looking more and more like a tree walking solution is the only way to get this 100% correct. However, there are some optimizations that can potentially be done to make tree walking less expensive.
Some ideas:
Alternatively, we might want to investigate further and profile the tradeoffs of just getting this info from the file system would be.
If we do it on-demand, a git implementation should probably use rev-list. E.g.
git rev-list --max-count=1 commit-or-symbolic -- path/to/file.txt
allura:cj/4691
Currently setup to fall back to existing LastCommitDoc data until the new format is pre-populated or, if the old-style data is missing, auto-vivify in the new format.
Still having some performance issues with the pre-populate of LCD data. It may simply be an artifact of the increasing tree size, but it grows steadily so I wonder if there's some kind of leak that I'm not accounting for.
Leaf node (file) hrefs are incorrectly generated (they contain /tree/).
https://sf-tvansteenburgh-7025.sb.sf.net/p/test4691/git2/ci/b140e04c6094dd861a0b3b37dcf245112107e1d3/tree/dir1/
click file3, get: http://pastie.org/5485540
https://sf-tvansteenburgh-7025.sb.sf.net/p/test4691/git2/ci/b140e04c6094dd861a0b3b37dcf245112107e1d3/tree/file2
I pushed some small bug fixes to origin/cj/4691, so make sure you pull those.
Latest test was pushing two new (no history in mongo) repos to the sandbox - Allura (git) and vim (hg).
The refresh succeeded without error, and the repo browser worked fine, but there are no (or very few) last_commit_docs in mongo. Fixing this may force us to get to the root of the performance issues.
allura:cj/4691
Could maybe squash some of the commits together to clean up the history. shrug