Skip to content

Rugged::Tree#path throws exception when path doesn't exist #683

@ioquatix

Description

@ioquatix

Rugged::Tree#path throws an exception if the path doesn't exist. But this can often be normal control flow.

> @tree.path("foo/bar")
Rugged::TreeError: the path 'foo' does not exist in the given tree

There are definitely exceptional cases - e.g. corruption of the git repository.

Solution:

  • Mark this method as deprecated.
  • Introduce new method fetch(path, default=nil, &block) which works similar to Hash#fetch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions