#4521 Get last commit from mongo instead of repo on disk

v1.0.0
closed
sf-2 (994)
SCM
Cory Johns
2015-08-20
2012-07-10
No

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.

Discussion

  • forge:tv/4521

    On a sandbox, create a project with a Git and Hg repo. For both repos:

    • commit something
    • push
    • make sure you see the latest commit in the repo browser

    Now service reactor stop. Then, for both repos:

    • commit something new
    • push
    • Click on the tool icon in the nav bar. Click on 'master' in the sidebar (for git). Click on 'default' and 'tip' in the sidebar (for Hg). In each case you should see the 1st commit as the latest, and not the empty repo help screen.
    • Now service reactor start. Click on all the same things, and confirm that you see your latest commit.
     
    • status: in-progress --> code-review
    • qa: Cory Johns
     
  • Cory Johns - 2012-07-10
    • status: code-review --> closed
     

Log in to post a comment.