# Buggy code
def _collect_experiment(repo, branch, stash=False, sha_only=True):
    from git.exc import GitCommandError

    res = defaultdict(dict)
    for rev in repo.brancher(revs=[branch]):
        if rev == "workspace":
            res["timestamp"] = None
        else:
            commit = repo.scm.repo.rev_parse(rev)
            res["timestamp"] = datetime.fromtimestamp(commit.committed_date)

        configs = _collect_configs(repo)
        params = _read_params(repo, configs, rev)
        if params:
            res["params"] = params

        res["queued"] = stash
        if not stash:
            metrics = _collect_metrics(repo, None, False)
            vals = _read_metrics(repo, metrics, rev)
            res["metrics"] = vals

        if not sha_only and rev != "workspace":
            try:
                name = repo.scm.repo.git.describe(rev, all=True, exact_match=True)
                name = name.rsplit("/")[-1]
                res["name"] = name
            except GitCommandError:
                pass

    return res


# Traceback (dvc.scm.base.RevError)
dvc exp show -T -v
2020-09-21 17:33:07,541 DEBUG: Check for update is enabled.
2020-09-21 17:33:07,570 DEBUG: fetched: [(3,)]
2020-09-21 17:33:08,049 DEBUG: fetched: [(75,)]
2020-09-21 17:33:08,058 ERROR: failed to show experiments - unknown Git revision 'f97e3cca64d10c299f7e9e54dd22889c6ee7a1b4, decouple/base'
------------------------------------------------------------
Traceback (most recent call last):
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/command/experiments.py", line 258, in run
sha_only=self.args.sha,
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 616, in show
return show(self.repo, *args, **kwargs)
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/__init__.py", line 51, in wrapper
return f(repo, *args, **kwargs)
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/experiments/show.py", line 73, in show
repo, rev, sha_only=sha_only
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/experiments/show.py", line 16, in _collect_experiment
for rev in repo.brancher(revs=[branch]):
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/brancher.py", line 49, in brancher
for sha, names in group_by(scm.resolve_rev, revs).items():
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/funcy/seqs.py", line 317, in group_by
result[f(item)].append(item)
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/scm/git.py", line 432, in resolve_rev
raise RevError(f"unknown Git revision '{rev}'")
dvc.scm.base.RevError: unknown Git revision 'f97e3cca64d10c299f7e9e54dd22889c6ee7a1b4, decouple/base'

# Fixed code
def _collect_experiment(repo, branch, stash=False, sha_only=True):
    from git.exc import GitCommandError

    res = defaultdict(dict)
    for rev in repo.brancher(revs=[branch]):
        if rev == "workspace":
            res["timestamp"] = None
        else:
            commit = _resolve_commit(repo, rev)
            res["timestamp"] = datetime.fromtimestamp(commit.committed_date)

        configs = _collect_configs(repo)
        params = _read_params(repo, configs, rev)
        if params:
            res["params"] = params

        res["queued"] = stash
        if not stash:
            metrics = _collect_metrics(repo, None, False)
            vals = _read_metrics(repo, metrics, rev)
            res["metrics"] = vals

        if not sha_only and rev != "workspace":
            try:
                name = repo.scm.repo.git.describe(rev, all=True, exact_match=True)
                name = name.rsplit("/")[-1]
                res["name"] = name
            except GitCommandError:
                pass

    return res