mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 12:49:08 -04:00
feat(repository): add api method for revparse_single
This commit is contained in:
parent
2e0486c641
commit
3b13646b1b
5 changed files with 43 additions and 5 deletions
|
@ -1,15 +1,14 @@
|
|||
import 'dart:ffi';
|
||||
import 'package:libgit2dart/src/enums.dart';
|
||||
import 'package:libgit2dart/src/revwalk.dart';
|
||||
|
||||
import 'bindings/libgit2_bindings.dart';
|
||||
import 'bindings/repository.dart' as bindings;
|
||||
import 'commit.dart';
|
||||
import 'config.dart';
|
||||
import 'index.dart';
|
||||
import 'odb.dart';
|
||||
import 'oid.dart';
|
||||
import 'reference.dart';
|
||||
import 'bindings/libgit2_bindings.dart';
|
||||
import 'bindings/repository.dart' as bindings;
|
||||
import 'revwalk.dart';
|
||||
import 'enums.dart';
|
||||
import 'util.dart';
|
||||
|
||||
class Repository {
|
||||
|
@ -324,6 +323,17 @@ class Repository {
|
|||
return Commit.lookup(this, oid);
|
||||
}
|
||||
|
||||
/// Find a single object, as specified by a [spec] string.
|
||||
/// See `man gitrevisions`, or https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions
|
||||
/// for information on the syntax accepted.
|
||||
///
|
||||
/// The returned object should be released when no longer needed.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Commit revParseSingle(String spec) {
|
||||
return Commit(bindings.revParseSingle(_repoPointer, spec).cast());
|
||||
}
|
||||
|
||||
/// Returns the list of commits starting from provided [oid].
|
||||
///
|
||||
/// If [sorting] isn't provided default will be used (reverse chronological order, like in git).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue