Refactor custom expectation
Refactor session commit and branch references.
Added tests.