Method: Git::Lib#empty?
- Defined in:
- lib/git/lib.rb
#empty? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns true if the repository is empty (meaning it has no commits)
1146 1147 1148 1149 1150 1151 1152 1153 1154 |
# File 'lib/git/lib.rb', line 1146 def empty? command('rev-parse', '--verify', 'HEAD') false rescue Git::FailedError => e raise unless e.result.status.exitstatus == 128 && e.result.stderr == 'fatal: Needed a single revision' true end |