rugged icon indicating copy to clipboard operation
rugged copied to clipboard

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

Open ioquatix opened this issue 9 years ago • 0 comments

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.

ioquatix avatar Feb 11 '17 23:02 ioquatix