Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit ugit2;
- (* Common configuration.
- This file is included by library units to configure the compiler. It isn't
- neccessary to include it in your projects. *)
- {TODO: Detect MacOS and iOS}
- {TODO: Detect Android?}
- {TODO: Detect GNU/Pascal?}
- (* Code to detect Delphi.
- Seems that old Delphi (i.e: Delphi6) defines DELPHI but newer ones
- doesn't (or at least Tokio 10.2 doesn't) so some tweaking should be done.
- Note that this code was tested with Delphi Tokio 10.2 Starter Edition only.
- I've tryed Delphi 6 proffesional and IT DOESN'T WORK AT ALL and I don't see
- how to make it run. Theoretically it should work with Delphi 7 (as I've
- tryed to keep Cieslak's changes) but I haven't a copy so it isn't tested.
- Also I've used a table from Embarcadero's Delphi Wiki.
- http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Conditional_compilation_(Delphi)
- *)
- {$IFNDEF DELPHI}
- {$IFDEF DCC}
- {$DEFINE DELPHI}
- {$ENDIF}
- {$ENDIF}
- {$IFNDEF FPC}
- {$IFNDEF DELPHI}
- {
- This version wasn't tested with other compilers than Free Pascal and Delphi.
- May be you want to help porting it to other systems and compilers, won't you?
- }
- {$ERROR ugit2.pas wasn't tested with this compiler. Do you want to help? }
- {$ENDIF}
- {$ENDIF}
- { Configure the compiler. }
- {$IFDEF FPC}
- { Free Pascal. }
- { Checks platform. }
- {$IFDEF UNIX}
- {$IF DEFINED(DARWIN) OR DEFINED(QNX) OR DEFINED(BEOS)}
- {
- This version wasn't tested on those systems.
- May be you want to help porting it to other systems and compilers, won't you?
- }
- {$ERROR ugit2.pas wasn't tested on your Operating System. Do you want to help? }
- {$ENDIF}
- {$ELSE}
- {$IFNDEF WINDOWS}
- {$ERROR ugit2.pas wasn't tested on your Operating System. Do you want to help? }
- {$ENDIF}
- {$ENDIF}
- { Sets dialect. }
- {$IF NOT DEFINED(FPC_DELPHI)}
- {$MODE DELPHI}
- {$ENDIF}
- {$MACRO ON}
- {$LONGSTRINGS ON}
- {$PACKRECORDS C}
- {$PACKENUM 4}
- {$IFNDEF DEBUGMODE}
- {$SMARTLINK ON}
- {$ELSE}
- {$INLINE OFF}
- {$ENDIF}
- {$ENDIF}
- {$IFDEF DELPHI}
- { Delphi }
- { Checks platform }
- {$IFDEF CONDITIONALEXPRESSIONS}
- {$IF CompilerVersion >= 18.5}
- {$DEFINE ISDELPHI2007ANDUP}
- {$ENDIF}
- {$IF CompilerVersion >= 20.0}
- {$DEFINE ISDELPHI2009ANDUP}
- {$ENDIF}
- {$ENDIF}
- { Delphi and Free Pascal have different ways to tell they're generating an
- executable for Windows. }
- {$IFNDEF WINDOWS}
- {$IFDEF MSWINDOWS}
- {$DEFINE WINDOWS}
- {$ENDIF}
- {$ENDIF}
- { CPU has some issues as well. }
- {$IFNDEF CPU64}
- {$IFDEF CPU64BITS}
- {$DEFINE CPU64}
- {$ENDIF}
- {$ENDIF}
- { Set compiler options. }
- {$LONGSTRINGS ON}
- {TODO: Next directive works on 32bit, it wasn''t tested on 64bit.}
- {$ALIGN 8}
- {$MINENUMSIZE 4}
- {$ENDIF}
- interface
- uses ctypes, MultiLog;
- (* Defines some constants to build the correct names of the library files. *)
- const
- {$IFDEF DEBUGMODE}
- _DBG_ = '-debug';{<@exclude }
- {$ELSE}
- _DBG_ = ''; {<@exclude }
- {$ENDIF}
- {$IF DEFINED(LINUX)}
- (* @exclude Prefix for libraries. *)
- _LG2_LIB_PREFIX_ = 'lib';
- (* @exclude Sufix/extension for libraries. *)
- _LG2_LIB_EXT_ = '.so';
- {$ELSEIF DEFINED(UNIX)}
- (* @exclude Prefix for libraries. *)
- _LG2_LIB_PREFIX_ = 'lib';
- (* @exclude Sufix/extension for libraries. *)
- _LG2_LIB_EXT_ = '.so';
- {$ELSEIF DEFINED(WINDOWS)}
- (* @exclude Prefix for libraries. *)
- _LG2_LIB_PREFIX_ = '';
- (* @exclude Sufix/extension for libraries. *)
- _LG2_LIB_EXT_ = '.dll';
- {$ENDIF}
- (* @exclude Builds main library name. AFAIK it's not needed. *)
- LIBGIT2_MAIN_LIB_NAME = _LG2_LIB_PREFIX_+'git2_main'+_DBG_+_LG2_LIB_EXT_;
- (* @exclude Builds library name. *)
- LIBGIT2_LIB_NAME = _LG2_LIB_PREFIX_+'git2'+_DBG_+_LG2_LIB_EXT_;
- type
- (* Generic pointer. *)
- LG2_POINTER = POINTER;
- LG2_DWORD = DWORD;
- (* Signed 8bit integer values. *)
- LG2_INT8 = SHORTINT;
- (* Unsigned 8bit integer values. *)
- LG2_UINT8 = BYTE;
- (* Signed 16bit integer values. *)
- LG2_INT16 = SMALLINT;
- (* Unsigned 16bit integer values. *)
- LG2_UINT16 = WORD;
- (* Signed 32bit integer values. *)
- LG2_INT32 = LONGINT;
- (* Unsigned 32bit integer values. *)
- LG2_UINT32 = LONGWORD;
- (* Signed 64bit integer values. *)
- LG2_INT64 = INT64;
- (* Time frame. *)
- LG2_TIME_T = INT64;
- LG2_OFF_T = INT64;
- {$IFDEF FPC}
- (* Unsigned 64bit integer values. *)
- LG2_UINT64 = QWORD;
- {$ELSE}
- {$IFDEF ISDELPHI2007ANDUP}
- (* Unsigned 64bit integer values. *)
- LG2_UINT64 = UINT64;
- {$ELSE}
- (* Unsigned 64bit integer values. *)
- LG2_UINT64 = INT64;
- {$ENDIF}
- {$ENDIF}
- { TODO: Check wich boolean type does it uses. }
- (* Boolean result. *)
- LG2_BOOL = LONGBOOL;
- (* Signed 8bit integer.
- Note that it isn't Pascal's CHAR type! *)
- LG2_CHAR = LG2_INT8;
- (* Unsigned 8bit integer values. *)
- LG2_UCHAR = LG2_UINT8;
- (* Signed 16bit integer values. *)
- LG2_SHORT = LG2_INT16;
- (* Unsigned 16bit integer values. *)
- LG2_USHORT = LG2_UINT16;
- (* Signed 32bit integer values. *)
- LG2_INT = LG2_INT32;
- (* Unsigned 32bit integer values. *)
- LG2_UINT = LG2_UINT32;
- {$IFDEF CPU64}
- {$IFDEF WINDOWS}
- (* Signed 32/64bit integer values. *)
- LG2_LONG = LG2_INT32;
- (* Unsigned 32/64bit integer values. *)
- LG2_ULONG = LG2_UINT32;
- {$ELSE}
- (* Signed 32/64bit integer values. *)
- LG2_LONG = LG2_INT64;
- (* Unsigned 32/64bit integer values. *)
- LG2_ULONG = LG2_UINT64;
- {$ENDIF}
- (* size_t equivalent. *)
- LG2_SIZE_T = LG2_UINT64;
- (* Fake pointer type. It's needed to pass pointers as integer values in some
- methods. *)
- LG2_INTPTR_T = LG2_INT64;
- (* Fake pointer type. It's needed to pass pointers as integer values in some
- methods. *)
- LG2_UINTPTR_T = LG2_UINT64;
- {$ELSE}
- (* Signed 32/64bit integer values. *)
- LG2_LONG = LG2_INT32;
- (* Unsigned 32/64bit integer values. *)
- LG2_ULONG = LG2_UINT32;
- (* size_t equivalent. *)
- LG2_SIZE_T = LG2_UINT32;
- (* Fake pointer type. It's needed to pass pointers as integer values in some
- methods. *)
- LG2_INTPTR_T = LG2_INT32;
- (* Fake pointer type. It's needed to pass pointers as integer values in some
- methods. *)
- LG2_UINTPTR_T = LG2_UINT32;
- {$ENDIF}
- (* Float value. *)
- LG2_FLOAT = SINGLE;
- (* Double value. *)
- LG2_DOUBLE = DOUBLE;
- (* Strings. Used in parameters to convert Pascal's @code(STRING) to C's
- @code(char * )*)
- LG2_STR = AnsiString;
- LG2_STR_RAW = ^byte;
- PLG2_STR = ^LG2_STR;
- (* Pointer. *)
- LG2_VOIDptr = LG2_POINTER;
- (* Pointer to text strings. Used to convert Pascal's @code(STRING) to C
- @code(char * ) *)
- LG2_STRptr = PAnsiChar;
- PPAnsiChar = ^PAnsiChar;
- (* Pointer to integer. *)
- LG2_INTptr = ^LG2_INT;
- (* Pointer to float. *)
- LG2_FLOATptr = ^LG2_FLOAT;
- const
- GIT_SUCCESS = 0;
- GIT_ERROR = -1;
- GIT_OID_RAWSZ = 20;
- GIT_OID_HEXSZ = GIT_OID_RAWSZ * 2;
- GIT_OID_MINPREFIXLEN = 4;
- type
- {enums}
- git_repository_item_t = (
- GIT_REPOSITORY_ITEM_GITDIR,
- GIT_REPOSITORY_ITEM_WORKDIR,
- GIT_REPOSITORY_ITEM_COMMONDIR,
- GIT_REPOSITORY_ITEM_INDEX,
- GIT_REPOSITORY_ITEM_OBJECTS,
- GIT_REPOSITORY_ITEM_REFS,
- GIT_REPOSITORY_ITEM_PACKED_REFS,
- GIT_REPOSITORY_ITEM_REMOTES,
- GIT_REPOSITORY_ITEM_CONFIG,
- GIT_REPOSITORY_ITEM_INFO,
- GIT_REPOSITORY_ITEM_HOOKS,
- GIT_REPOSITORY_ITEM_LOGS,
- GIT_REPOSITORY_ITEM_MODULES,
- GIT_REPOSITORY_ITEM_WORKTREES
- );
- git_object_t = (
- GIT_OBJECT_ANY = -2,
- GIT_OBJECT_BAD = -1,
- GIT_OBJECT_COMMIT = 1,
- GIT_OBJECT_TREE = 2,
- GIT_OBJECT_BLOB = 3,
- GIT_OBJECT_TAG = 4,
- GIT_OBJECT_OFS_DELTA = 6,
- GIT_OBJECT_REF_DELTA = 7
- );
- git_repository_state_t = (
- GIT_REPOSITORY_STATE_NONE,
- GIT_REPOSITORY_STATE_MERGE,
- GIT_REPOSITORY_STATE_REVERT,
- GIT_REPOSITORY_STATE_REVERT_SEQUENCE,
- GIT_REPOSITORY_STATE_CHERRYPICK,
- GIT_REPOSITORY_STATE_CHERRYPICK_SEQUENCE,
- GIT_REPOSITORY_STATE_BISECT,
- GIT_REPOSITORY_STATE_REBASE,
- GIT_REPOSITORY_STATE_REBASE_INTERACTIVE,
- GIT_REPOSITORY_STATE_REBASE_MERGE,
- GIT_REPOSITORY_STATE_APPLY_MAILBOX,
- GIT_REPOSITORY_STATE_APPLY_MAILBOX_OR_REBASE
- );
- git_blame_flag_t = (
- GIT_BLAME_NORMAL = 0,
- GIT_BLAME_TRACK_COPIES_SAME_FILE = 1 shl 0,
- GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES = 1 shl 1,
- GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES = 1 shl 2,
- GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES = 1 shl 3,
- GIT_BLAME_FIRST_PARENT = 1 shl 4
- );
- git_branch_t = (
- GIT_BRANCH_LOCAL = 1,
- GIT_BRANCH_REMOTE = 2,
- GIT_BRANCH_ALL = 1 or 2
- );
- git_checkout_strategy_t = (
- GIT_CHECKOUT_NONE = 0,
- GIT_CHECKOUT_SAFE = 1 shl 0,
- GIT_CHECKOUT_FORCE = 1 shl 1,
- GIT_CHECKOUT_RECREATE_MISSING = 1 shl 2,
- GIT_CHECKOUT_ALLOW_CONFLICTS = 1 shl 4,
- GIT_CHECKOUT_REMOVE_UNTRACKED = 1 shl 5,
- GIT_CHECKOUT_REMOVE_IGNORED = 1 shl 6,
- GIT_CHECKOUT_UPDATE_ONLY = 1 shl 7,
- GIT_CHECKOUT_DONT_UPDATE_INDEX = 1 shl 8,
- GIT_CHECKOUT_NO_REFRESH = 1 shl 9,
- GIT_CHECKOUT_SKIP_UNMERGED = 1 shl 10,
- GIT_CHECKOUT_USE_OURS = 1 shl 11,
- GIT_CHECKOUT_USE_THEIRS = 1 shl 12,
- GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH = 1 shl 13,
- GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES = 1 shl 18,
- GIT_CHECKOUT_DONT_OVERWRITE_IGNORED = 1 shl 19,
- GIT_CHECKOUT_CONFLICT_STYLE_MERGE = 1 shl 20,
- GIT_CHECKOUT_CONFLICT_STYLE_DIFF3 = 1 shl 21,
- GIT_CHECKOUT_DONT_REMOVE_EXISTING = 1 shl 22,
- GIT_CHECKOUT_DONT_WRITE_INDEX = 1 shl 23,
- GIT_CHECKOUT_UPDATE_SUBMODULES = 1 shl 16,
- GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = 1 shl 17
- );
- git_checkout_notify_t = (
- GIT_CHECKOUT_NOTIFY_NONE = 0,
- GIT_CHECKOUT_NOTIFY_CONFLICT = 1 shl 0,
- GIT_CHECKOUT_NOTIFY_DIRTY = 1 shl 1,
- GIT_CHECKOUT_NOTIFY_UPDATED = 1 shl 2,
- GIT_CHECKOUT_NOTIFY_UNTRACKED = 1 shl 3,
- GIT_CHECKOUT_NOTIFY_IGNORED = 1 shl 4,
- GIT_CHECKOUT_NOTIFY_ALL = $0FFFF
- );
- git_attr_t = (
- GIT_ATTR_UNSPECIFIED_T = 0,
- GIT_ATTR_TRUE_T,
- GIT_ATTR_FALSE_T,
- GIT_ATTR_VALUE_T
- );
- {records}
- git_buf = record
- ptr: ^LG2_CHAR;
- asize: LG2_SIZE_T;
- size: LG2_SIZE_T;
- end;
- git_time = record
- time: LG2_UINT64;
- offset: LG2_UINT64;
- sign: LG2_CHAR;
- end;
- git_signature = record
- name: ^LG2_CHAR;
- email: ^LG2_CHAR;
- when: git_time;
- end;
- Pgit_signature = ^git_signature;
- git_repository_init_options = record
- version: LG2_UINT32;
- flags: LG2_UINT32;
- mode: LG2_UINT32;
- workdir_path: LG2_STR;
- description: LG2_STR;
- template_path: LG2_STR;
- initial_head: LG2_STR;
- origin_url: LG2_STR;
- end;
- git_oid = record
- id: array[0..(GIT_OID_RAWSZ)-1] of byte;
- end;
- git_blame_options = record
- version: LG2_DWORD;
- flags: LG2_UINT32;
- min_match_characters: LG2_UINT16;
- newest_commit: git_oid;
- oldest_commit: git_oid;
- min_line: LG2_SIZE_T;
- max_line: LG2_SIZE_T;
- end;
- git_diff_file = record
- id: git_oid;
- path: LG2_STR;
- size: LG2_OFF_T;
- flags: LG2_UINT32;
- mode: LG2_UINT32;
- id_abbrev: LG2_UINT32;
- end;
- Pgit_diff_file = ^git_diff_file;
- git_checkout_perfdata = record
- mkdir_calls: LG2_SIZE_T;
- stat_calls: LG2_SIZE_T;
- chmod_calls: LG2_SIZE_T;
- end;
- Pgit_checkout_perfdata = ^git_checkout_perfdata;
- git_blame_hunk = record
- lines_in_hunk: LG2_SIZE_T;
- final_commit_id: git_oid;
- final_start_line_number : LG2_SIZE_T;
- final_signature : Pgit_signature;
- orig_commit_id : git_oid;
- orig_path : LG2_STR;
- orig_start_line_number : LG2_SIZE_T;
- orig_signature : Pgit_signature;
- boundary: LG2_CHAR;
- end;
- Pgit_blame_hunk = ^git_blame_hunk;
- Pgit_annotated_commit = LG2_POINTER;
- PPgit_annotated_commit = ^Pgit_annotated_commit;
- Pgit_buf = ^git_buf;
- Pgit_commit = LG2_POINTER;
- PPgit_commit = ^Pgit_commit;
- Pgit_config = LG2_POINTER;
- PPgit_config = ^Pgit_config;
- Pgit_oid = ^git_oid;
- Pgit_object = LG2_POINTER;
- Pgit_blob = LG2_POINTER;
- PPgit_blob = ^Pgit_blob;
- Pgit_reference = LG2_POINTER;
- PPgit_reference = ^Pgit_reference;
- Pgit_repository = LG2_POINTER;
- PPgit_repository = ^Pgit_repository;
- Pgit_repository_init_options = ^git_repository_init_options;
- Pgit_tag = LG2_POINTER;
- Pgit_worktree = LG2_POINTER;
- Pgit_odb = LG2_POINTER;
- PPgit_odb = ^Pgit_odb;
- Pgit_refdb = LG2_POINTER;
- PPgit_refdb = ^Pgit_refdb;
- Pgit_index = LG2_POINTER;
- PPgit_index = ^Pgit_index;
- Pgit_tree = LG2_POINTER;
- PPgit_tree = ^Pgit_tree;
- Pgit_blame = LG2_POINTER;
- PPgit_blame = ^Pgit_blame;
- Pgit_blame_options = ^git_blame_options;
- Pgit_oid_shorten = LG2_POINTER;
- Pgit_branch_iterator = LG2_POINTER;
- PPgit_branch_iterator = ^Pgit_branch_iterator;
- Pgit_branch_t = ^git_branch_t;
- Pgit_writestream = LG2_POINTER;
- PPgit_writestream = ^Pgit_writestream;
- git_repository_fetchhead_foreach_cb = function(const ref_name: LG2_STR; const remote_url: LG2_STR; const oid: Pgit_oid; is_merge: LG2_UINT; payload: LG2_POINTER): LG2_INT; cdecl;
- git_repository_mergehead_foreach_cb = function(const oid: Pgit_oid; payload: LG2_POINTER): LG2_INT; cdecl;
- git_checkout_notify_cb = function (why: git_checkout_notify_t; path: LG2_STR; baseline: Pgit_diff_file; target: Pgit_diff_file; workdir: Pgit_diff_file; payload:LG2_VOIDptr): LG2_INT; cdecl;
- git_checkout_progress_cb = procedure (path: LG2_STR; completed_steps: LG2_SIZE_T; total_steps: LG2_SIZE_T; payload:LG2_VOIDptr); cdecl;
- git_checkout_perfdata_cb = procedure (path: LG2_STR; completed_steps: LG2_SIZE_T; total_steps: LG2_SIZE_T; payload:LG2_VOIDptr); cdecl;
- git_checkout_options = record
- version: LG2_DWORD;
- checkout_strategy: LG2_DWORD;
- disable_filters: LG2_INT32;
- dir_mode: LG2_DWORD;
- file_mode: LG2_DWORD;
- file_open_flags: LG2_INT32;
- notify_flags: LG2_DWORD;
- notify_cb: git_checkout_notify_cb;
- notify_payload: LG2_VOIDptr;
- progress_cb: git_checkout_progress_cb;
- progress_payload: LG2_VOIDptr;
- {paths : git_strarray;}
- baseline: Pgit_tree;
- baseline_index: Pgit_index;
- target_directory: LG2_STR;
- ancestor_label: LG2_STR;
- our_label: LG2_STR;
- their_label: LG2_STR;
- perfdata_cb: git_checkout_perfdata_cb;
- perfdata_payload: LG2_VOIDptr;
- end;
- Pgit_checkout_options = ^git_checkout_options;
- { global.h }
- procedure git_libgit2_init(); cdecl; external LIBGIT2_LIB_NAME;
- procedure git_libgit2_shutdown(); cdecl; external LIBGIT2_LIB_NAME;
- { annotated_commit.h }
- function git_annotated_commit_from_ref(const commit_out: PPgit_annotated_commit; const repo: PPgit_repository; const ref: Pgit_reference): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_annotated_commit_from_fetchhead(const commit_out: PPgit_annotated_commit; const repo: PPgit_repository; const branch_name: LG2_STR; const remote_url: LG2_STR; const id: Pgit_oid): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_annotated_commit_lookup(const commit_out: PPgit_annotated_commit; const repo: PPgit_repository; const id: Pgit_oid): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_annotated_commit_from_revspec(const commit_out: PPgit_annotated_commit; const repo: PPgit_repository; const revspec: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_annotated_commit_id(const commit: Pgit_annotated_commit): Pgit_oid; cdecl; external LIBGIT2_LIB_NAME;
- procedure git_annotated_commit_free(commit: Pgit_annotated_commit); cdecl; external LIBGIT2_LIB_NAME;
- { attr.h }
- function git_attr_value(const attr: LG2_STR): git_attr_t; cdecl; external LIBGIT2_LIB_NAME;
- function git_attr_get(var value_out: PAnsiChar; const repo: Pgit_repository; const flags: LG2_UINT32; const path: LG2_STR; const name: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- { blame.h }
- function git_blame_init_options(const opts: Pgit_blame_options; version: LG2_UINT32): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_blame_get_hunk_count(blame: Pgit_blame): LG2_UINT32; cdecl; external LIBGIT2_LIB_NAME;
- function git_blame_get_hunk_byindex(const blame: Pgit_blame; const index: LG2_UINT32): Pgit_blame_hunk; cdecl; external LIBGIT2_LIB_NAME;
- function git_blame_get_hunk_byline(const blame: Pgit_blame; const lineno: LG2_SIZE_T): Pgit_blame_hunk; cdecl; external LIBGIT2_LIB_NAME;
- function git_blame_file(const blame_out: PPgit_blame; const repo: PPgit_repository; const path: LG2_STR; const opts: Pgit_blame_options): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_blame_buffer(const blame_out: PPgit_blame; const blame_reference: PPgit_blame; const buffer: LG2_STR; const buffer_len: LG2_SIZE_T): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- procedure git_blame_free(blame: PPgit_blame); cdecl; external LIBGIT2_LIB_NAME;
- { blob.h }
- function git_blob_lookup(var blob: PPgit_blob; const repo: Pgit_repository; const id: Pgit_oid): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_lookup_prefix(var blob: PPgit_blob; const repo: Pgit_repository; const id: Pgit_oid; const len: LG2_SIZE_T): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- procedure git_blob_free(const blob: Pgit_blob); cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_id(const blob: Pgit_blob): Pgit_oid; cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_owner(const blob: Pgit_blob): Pgit_repository; cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_rawcontent(const blob: Pgit_blob): LG2_VOIDptr; cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_rawsize(const blob: Pgit_blob): LG2_OFF_T; cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_filtered_content(const buf_out: Pgit_buf; const blob: Pgit_blob; const as_path: LG2_STR; const check_for_binary_data: LG2_INT): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_create_fromworkdir(const oid: Pgit_oid; const repo: Pgit_repository; const relative_path: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_create_fromdisk(const oid: Pgit_oid; const repo: Pgit_repository; const path: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_create_fromstream(const out_stream: PPgit_writestream; const repo: Pgit_repository; const hintpath: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_create_fromstream_commit(const out_oid: Pgit_oid; const stream: Pgit_writestream): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_create_frombuffer(const out_oid: Pgit_oid; const repo: Pgit_repository; const buffer: LG2_VOIDptr; const len: LG2_SIZE_T): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_is_binary(const blob: Pgit_blob): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_blob_dup(const blob_out: PPgit_blob; const source: Pgit_blob): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- { branch.h }
- function git_branch_create(var ref_out: PPgit_reference; const repo: PPgit_repository; const branch_name: LG2_STR; const target: Pgit_commit; const force: LG2_INT): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_create_from_annotated(const ref_out: PPgit_reference; const repo: PPgit_repository; const branch_name: LG2_STR; const target: Pgit_annotated_commit; const force: LG2_INT): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_delete(var branch: PPgit_reference): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_iterator_new(var iterator_out: PPgit_branch_iterator; const repo: PPgit_repository; const list_flags: git_branch_t): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_next(var ref_out: PPgit_reference; const out_type: Pgit_branch_t; const iter: Pgit_branch_iterator): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- procedure git_branch_iterator_free(iter: Pgit_branch_iterator); cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_move(var branch_out: PPgit_reference; const branch_in: PPgit_reference; const new_branch_name: LG2_STR; const force: LG2_INT): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_lookup(var branch_out: PPgit_reference; const branch_in: PPgit_reference; const branch_name: LG2_STR; const branch_type: git_branch_t): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_name(var branch_out: PPgit_reference; const ref: PPgit_reference): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_upstream(var branch_out: PPgit_reference; const branch: PPgit_reference): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_set_upstream(var branch: Pgit_reference; const upstream_name: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_upstream_name(var buf_out: Pgit_buf; const repo: Pgit_repository; const refname: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_is_head(var branch: Pgit_reference): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_is_checked_out(var branch: Pgit_reference): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_remote_name(const buf_out: Pgit_buf; const repo: Pgit_repository; const canonical_branch_name: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_branch_upstream_remote(const buf_out: Pgit_buf; const repo: Pgit_repository; const refname: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- { buffer.h }
- procedure git_buf_free(var buffer: Pgit_buf); cdecl; external LIBGIT2_LIB_NAME;
- function git_buf_grow(var buffer: Pgit_buf; const target_size: LG2_SIZE_T): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_buf_set(var buffer: Pgit_buf; const data: LG2_VOIDptr; const datalen: LG2_SIZE_T): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_buf_is_binary(const buffer: Pgit_buf): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_buf_contains_nul(const buffer: Pgit_buf): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- { checkout.h }
- function git_checkout_init_options(const opts: Pgit_checkout_options; const version: LG2_DWORD): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_checkout_head(const repo: Pgit_repository; const opts: Pgit_checkout_options): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_checkout_index(const repo: Pgit_repository; const index: Pgit_index; const opts: Pgit_checkout_options): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_checkout_tree(const repo: Pgit_repository; const treeish: Pgit_object; const opts: Pgit_checkout_options): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- { commit.h }
- function git_commit_lookup(const commit: PPgit_commit; repo: Pgit_repository; const id: Pgit_oid): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_lookup_prefix(const commit: PPgit_commit; repo: Pgit_repository; const id: Pgit_oid; len: LG2_SIZE_T): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- procedure git_commit_free(commit: Pgit_commit); cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_id(const commit: Pgit_commit): Pgit_oid; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_owner(const commit: Pgit_commit): Pgit_repository; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_message_encoding(const commit: Pgit_commit): LG2_STR; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_message(const commit: Pgit_commit): LG2_STR; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_message_raw(const commit: Pgit_commit): LG2_STR; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_summary(const commit: Pgit_commit): LG2_STR; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_body(const commit: Pgit_commit): LG2_STR; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_time(const commit: Pgit_commit): LG2_TIME_T; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_time_offset(const commit: Pgit_commit): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_committer(const commit: Pgit_commit): Pgit_signature; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_author(const commit: Pgit_commit): Pgit_signature; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_raw_header(const commit: Pgit_commit): LG2_STR; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_tree(var tree_out: PPgit_tree; const commit: Pgit_commit): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_tree_id(const commit: Pgit_commit): Pgit_oid; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_parentcount(const commit: Pgit_commit): LG2_UINT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_parent(var commit_out: PPgit_commit; const commit: Pgit_commit; n: LG2_UINT): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_parent_id(const commit: Pgit_commit; n: LG2_UINT): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_nth_gen_ancestor(var ancestor: PPgit_commit; const commit: Pgit_commit; n: LG2_UINT): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_header_field(var buf_out: Pgit_buf; const commit: Pgit_commit; const field: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_extract_signature(const signature: Pgit_signature; const signed_data: Pgit_buf; const repo: Pgit_repository; const commit_id: Pgit_oid; const field: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_create(const id: Pgit_oid; const repo: Pgit_repository; const update_ref: LG2_STR; const author: Pgit_signature; const commiter: Pgit_signature; const message_encoding: LG2_STR; const message: LG2_STR; const tree: Pgit_tree; const parent_count: LG2_SIZE_T; const parents: PPgit_commit): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_create_v(const id: Pgit_oid; const repo: Pgit_repository; const update_ref: LG2_STR; const author: Pgit_signature; const commiter: Pgit_signature; const message_encoding: LG2_STR; const message: LG2_STR; const tree: Pgit_tree; const parent_count: LG2_SIZE_T; const parents: PPgit_commit; args:array of const): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_amend(const id: Pgit_oid; const commit_to_amend: Pgit_commit; const update_ref: LG2_STR; const author: Pgit_signature; const commiter: Pgit_signature; const message_encoding: LG2_STR; const message: LG2_STR; const tree: Pgit_tree): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_create_buffer(var buf_out: Pgit_buf; const repo: Pgit_repository; const author: Pgit_signature; const commiter: Pgit_signature; const message_encoding: LG2_STR; const message: LG2_STR; const tree: Pgit_tree; const parent_count: LG2_SIZE_T; const parents: PPgit_commit): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_create_with_signature(const id: Pgit_oid; const repo: Pgit_repository; const commit_content: LG2_STR; const signature: LG2_STR; const signature_field: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_commit_dup(var commit_out: PPgit_commit; const source: Pgit_commit): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- { oid.h }
- function git_oid_fromstr(const oid: Pgit_oid; str: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_oid_fromstrp(const oid: Pgit_oid; str: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_oid_fromstrn(const oid: Pgit_oid; str: LG2_STR; length: LG2_SIZE_T): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- procedure git_oid_fromraw(const oid: Pgit_oid; str: LG2_STR; raw: LG2_STR_RAW); cdecl; external LIBGIT2_LIB_NAME;
- procedure git_oid_fmt(var out_str: LG2_STR; const oid: Pgit_oid); cdecl; external LIBGIT2_LIB_NAME;
- procedure git_oid_nfmt(var out_str: LG2_STR; n: LG2_SIZE_T; const oid: Pgit_oid); cdecl; external LIBGIT2_LIB_NAME;
- procedure git_oid_pathfmt(var out_str: LG2_STR; const oid: Pgit_oid); cdecl; external LIBGIT2_LIB_NAME;
- function git_oid_tostr_s(const oid: Pgit_oid): LG2_STR; cdecl; external LIBGIT2_LIB_NAME;
- function git_oid_tostr(var out_str: LG2_STR; n: LG2_SIZE_T; const oid: Pgit_oid): LG2_STR; cdecl; external LIBGIT2_LIB_NAME;
- procedure git_oid_cpy(var out_oid: Pgit_oid; const src_oid: Pgit_oid); cdecl; external LIBGIT2_LIB_NAME;
- function git_oid_cmp(const a_oid: Pgit_oid; const b_oid: Pgit_oid): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_oid_equal(const a_oid: Pgit_oid; const b_oid: Pgit_oid): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_oid_ncmp(const a_oid: Pgit_oid; const b_oid: Pgit_oid; const len: LG2_SIZE_T): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_oid_streq(const oid: Pgit_oid; const str: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_oid_strcmp(const oid: Pgit_oid; const str: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_oid_iszero(const oid: Pgit_oid): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_oid_shorten_new(const min_length: LG2_SIZE_T): Pgit_oid_shorten; cdecl; external LIBGIT2_LIB_NAME;
- function git_oid_shorten_add(const os: Pgit_oid_shorten; text_id: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- procedure git_oid_shorten_free(const os: Pgit_oid_shorten); cdecl; external LIBGIT2_LIB_NAME;
- { repository.h }
- function git_repository_open(var repo_out: PPgit_repository; const path: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_open_from_worktree(var repo_out: PPgit_repository; var wt: Pgit_worktree): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_wrap_odb(var repo_out: PPgit_repository; var repo_odb: Pgit_odb): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_discover(var buf_out: Pgit_buf; const start_path: LG2_STR; across_fs: LG2_INT; const ceiling_dirs: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_open_ext(var repo_out: PPgit_repository; const path: LG2_STR; flags: LG2_UINT32; const ceiling_dirs: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_open_bare(var repo_out: PPgit_repository; const bare_path: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- procedure git_repository_free(var repo: Pgit_repository); cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_init(var repo_out: PPgit_repository; const path: LG2_STR; is_bare: LG2_BOOL): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_init_init_options(var opts: Pgit_repository_init_options; version: LG2_UINT32): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_init_ext(var repo_out: PPgit_repository; const repo_path: LG2_STR; var opts: Pgit_repository_init_options): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_head(var ref_out: PPgit_reference; repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_head_for_worktree(var ref_out: PPgit_reference; repo: Pgit_repository; const name: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_head_detached(const repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_head_detached_for_worktree(repo: Pgit_repository; const name: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_head_unborn(repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_is_empty(repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_item_path(var buf_out: Pgit_buf; const repo: Pgit_repository; const item: git_repository_item_t): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_path(const repo: Pgit_repository): LG2_STR; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_workdir(const repo: Pgit_repository): LG2_STR; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_commondir(const repo: Pgit_repository): LG2_STR; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_set_workdir(const repo: Pgit_repository; const workdir: LG2_STR; update_gitlink: LG2_INT): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_is_bare(const repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_is_worktree(const repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_config(var config_out: PPgit_config; repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_config_snapshot(var config_out: PPgit_config; repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_odb(var odb_out: PPgit_odb; repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_refdb(var refdb_out: PPgit_refdb; repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_index(var index_out: PPgit_index; repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_message(var buf_out: Pgit_buf; repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_message_remove(repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_state_cleanup(repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_fetchhead_foreach(repo: Pgit_repository; callback: git_repository_fetchhead_foreach_cb; payload: LG2_POINTER): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_mergehead_foreach(repo: Pgit_repository; callback: git_repository_mergehead_foreach_cb; payload: LG2_POINTER): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_hashfile(oid: Pgit_oid; repo: Pgit_repository; const path: LG2_STR; obj_type: git_object_t; const as_path: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_set_head(repo: Pgit_repository; refname: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_set_head_detached(repo: Pgit_repository; const commitish: Pgit_oid): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_set_head_detached_from_annotated(repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_detach_head(repo: Pgit_repository; const commitish: Pgit_annotated_commit): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_state(repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_set_namespace(repo: Pgit_repository; const nmspace: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_get_namespace(repo: Pgit_repository): LG2_STR; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_is_shallow(repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_ident(var name: PLG2_STR; var email: PLG2_STR; const repo: Pgit_repository): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- function git_repository_set_ident(repo: Pgit_repository; const name: LG2_STR; const email: LG2_STR): LG2_INT; cdecl; external LIBGIT2_LIB_NAME;
- type
- { SDK }
- TGitRepository = Class(TObject)
- private
- repo: PPgit_repository;
- function GetWorkDir: AnsiString;
- function GetCommonDir: AnsiString;
- function GetPath: AnsiString;
- function GetNamespace: AnsiString;
- function GetName: string;
- function GetEmail: string;
- procedure SetNamespace(const namespace: AnsiString);
- public
- constructor Create(const repository_path: string);
- destructor Destroy; override;
- { API }
- function IsEmpty: Boolean;
- function IsBare: Boolean;
- function IsWorkTree: Boolean;
- function IsShallow: Boolean;
- property WorkDir: AnsiString read GetWorkDir;
- property CommonDir: AnsiString read GetCommonDir;
- property Path: AnsiString read GetPath;
- property Namespace: AnsiString read GetNamespace write SetNamespace;
- property Name: string read GetName;
- property Email: string read GetEmail;
- end;
- implementation
- { declarations }
- constructor TGitRepository.Create(const repository_path: String);
- var name: string;
- email: string;
- begin
- if git_repository_open(repo, PAnsiChar(repository_path)) = GIT_SUCCESS then
- begin
- // Path := git_repository_path(repo^);
- // Workdir := git_repository_workdir(repo^);
- // Commondir := git_repository_commondir(repo^);
- // git_repository_ident(LG2_STRptr(name), LG2_STRptr(email), repo^);
- Logger.Send('TGitRepository.Create(open+ident:success): ' + Path);
- end
- else
- begin
- Logger.SendError('TGitRepository.Create(open:error): ' + repository_path);
- end;
- end;
- destructor TGitRepository.Destroy;
- begin
- if repo <> nil then
- begin
- git_repository_free(repo^);
- Logger.Send('TGitRepository.Destroy(free:success)');
- end;
- end;
- function TGitRepository.GetWorkDir(): AnsiString;
- begin
- Result := git_repository_workdir(self.repo^);
- end;
- function TGitRepository.GetCommonDir(): AnsiString;
- begin
- Result := git_repository_commondir(self.repo^);
- end;
- function TGitRepository.GetPath(): AnsiString;
- begin
- Result := git_repository_path(self.repo^);
- end;
- function TGitRepository.IsEmpty: boolean;
- begin
- Result := git_repository_is_empty(repo^) = 1;
- end;
- function TGitRepository.IsBare: boolean;
- begin
- Result := git_repository_is_bare(repo^) = 1;
- end;
- function TGitRepository.IsWorkTree: boolean;
- begin
- Result := git_repository_is_worktree(repo^) = 1;
- end;
- function TGitRepository.IsShallow: boolean;
- begin
- Result := git_repository_is_shallow(repo^) = 1;
- end;
- function TGitRepository.GetNamespace: AnsiString;
- begin
- Result := git_repository_get_namespace(repo^);
- end;
- procedure TGitRepository.SetNamespace(const namespace: AnsiString);
- begin
- git_repository_set_namespace(repo^, namespace);
- end;
- function TGitRepository.GetName: string;
- var name: string;
- email: string;
- begin
- Result := name;
- end;
- function TGitRepository.GetEmail: string;
- var name: string;
- email: string;
- begin
- Result := email;
- end;
- initialization
- { Delphi forces an INITIALIZATION section if FINALIZATION is used. }
- ;
- { Next code suggested by FPC mailing list user. This should fix some issues
- with memory. Removed as it seems to be fixed by Allegro itself. }
- { $if defined(cpui386) or defined(cpux86_64)}
- { SetExceptionMask(GetExceptionMask + [exZeroDivide, exInvalidOp]); }
- { $ENDIF}
- git_libgit2_init;
- finalization
- git_libgit2_shutdown;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement