def commit(ref)
      if sha?(ref)
        get_cache(:commit, ref) { commit!(ref) }
      else
        if (sha = get_cache(:ref, ref))
          commit(sha)
        else
          if (cm = commit!(ref))
            set_cache(:ref, ref, cm.id)
            set_cache(:commit, cm.id, cm)
          end
        end
      end
    end
def commit(ref)
      if sha?(ref)
        get_cache(:commit, ref) { commit!(ref) }
      else
        if (sha = get_cache(:ref, ref))
          commit(sha)
        else
          if (cm = commit!(ref))
            set_cache(:ref, ref, cm.id)
            set_cache(:commit, cm.id, cm)
          end
        end
      end
    end
Public: Looks up the Git commit using the given Git SHA or ref.

 ref - A String Git SHA or ref.

 Returns a Gollum::Git::Commit.