mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat(signature): add bindings and api for default signature
This commit is contained in:
parent
72107dea60
commit
3b883c49e3
5 changed files with 55 additions and 9 deletions
|
@ -2,6 +2,7 @@ import 'dart:ffi';
|
|||
import 'package:ffi/ffi.dart';
|
||||
import 'bindings/libgit2_bindings.dart';
|
||||
import 'bindings/signature.dart' as bindings;
|
||||
import 'repository.dart';
|
||||
import 'util.dart';
|
||||
|
||||
class Signature {
|
||||
|
@ -39,6 +40,15 @@ class Signature {
|
|||
/// Pointer to memory address for allocated signature object.
|
||||
Pointer<git_signature> get pointer => _signaturePointer;
|
||||
|
||||
/// Creates a new action signature with default user and now timestamp.
|
||||
///
|
||||
/// This looks up the user.name and user.email from the configuration and uses the
|
||||
/// current time as the timestamp, and creates a new signature based on that information.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
static Signature defaultSignature(Repository repo) =>
|
||||
Signature(bindings.defaultSignature(repo.pointer));
|
||||
|
||||
/// Returns full name of the author.
|
||||
String get name => _signaturePointer.ref.name.cast<Utf8>().toDartString();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue