When looking up the last commit for a repo, if a reference is passed instead of a sha1, the sha1 for the ref is looked up on disk. If the mongo index for the repo is stale, you might get a sha1 that doesn't exist in mongo yet. This can result in the repo appearing to be empty (last commit is None).
Instead, when a ref lookup is performed, look for the ref by name in the heads, branches, and repo_tags collections for the repo, and if found, use the associated sha1, thereby ensuring that the "last commit" does exist in mongo.
Applies to Git and Hg only.
forge:tv/4521
On a sandbox, create a project with a Git and Hg repo. For both repos:
Now
service reactor stop
. Then, for both repos:service reactor start
. Click on all the same things, and confirm that you see your latest commit.