anchor.diff:      FreeLibrary(libgit2);
       libgit2 := 0;
   
  -    git_repository_open             := nil;
  -    git_repository_free             := nil;
  -
  -    git_oid_mkstr                   := nil;
  -    git_oid_fmt                     := nil;
  -    git_oid_pathfmt                 := nil;
  -
  -    git_commit_lookup               := nil;
  -    git_commit_message_short        := nil;
  -    git_commit_message              := nil;
  -    git_commit_author               := nil;
  -    git_commit_committer            := nil;
  -    git_commit_time                 := nil;
  -    git_commit_parentcount          := nil;
  -    git_commit_parent               := nil;
  -
  -    git_revwalk_new                 := nil;
  -    git_revwalk_free                := nil;
  -    git_revwalk_sorting             := nil;
  -    git_revwalk_push                := nil;
  -    git_revwalk_next                := nil;
  -
  -    git_index_open_bare             := nil;
  -    git_index_read                  := nil;
  -    git_index_free                  := nil;
  -    git_index_find                  := nil;
  -    git_index_entrycount            := nil;
  -
  -    git_tag_lookup                  := nil;
  -    git_tag_name                    := nil;
  -    git_tag_type                    := nil;
  -    git_tag_target                  := nil;
  -    git_tag_id                      := nil;
  -    git_tag_set_name                := nil;
  -
  -    git_commit_id                   := nil;
  -
  -    git_object_id                   := nil;
  -    git_object_write                := nil;
  -    git_object_free                 := nil;
  -
  -    git_tree_lookup                 := nil;
  -    git_tree_entry_byname           := nil;
  -    git_tree_entry_byindex          := nil;
  -    git_tree_entrycount             := nil;
  -    git_tree_entry_name             := nil;
  -    git_tree_entry_2object          := nil;
  -    git_tree_new                    := nil;
  -    git_tree_add_entry              := nil;
  -    git_tree_remove_entry_byindex   := nil;
  -    git_tree_remove_entry_byname    := nil;
  -    git_tree_id                     := nil;
  +    git_blob_lookup                           := nil;
  +    git_blob_new                              := nil;
  +    git_blob_set_rawcontent_fromfile          := nil;
  +    git_blob_set_rawcontent                   := nil;
  +    git_blob_rawcontent                       := nil;
  +    git_blob_rawsize                          := nil;
  +    git_blob_writefile                        := nil;
  +
  +    git_commit_lookup                         := nil;
  +    git_commit_message_short                  := nil;
  +    git_commit_message                        := nil;
  +    git_commit_author                         := nil;
  +    git_commit_committer                      := nil;
  +    git_commit_time                           := nil;
  +    git_commit_parentcount                    := nil;
  +    git_commit_parent                         := nil;
  +    git_commit_id                             := nil;
  +    git_commit_new                            := nil;
  +    git_commit_timezone_offset                := nil;
  +    git_commit_tree                           := nil;
  +    git_commit_add_parent                     := nil;
  +    git_commit_set_message                    := nil;
  +    git_commit_set_committer                  := nil;
  +    git_commit_set_author                     := nil;
  +    git_commit_set_tree                       := nil;
  +
  +    git_index_open_bare                       := nil;
  +    git_index_read                            := nil;
  +    git_index_free                            := nil;
  +    git_index_find                            := nil;
  +    git_index_entrycount                      := nil;
  +
  +    git_index_open_inrepo                     := nil;
  +    git_index_clear                           := nil;
  +    git_index_write                           := nil;
  +    git_index_add                             := nil;
  +    git_index_remove                          := nil;
  +    git_index_insert                          := nil;
  +    git_index_get                             := nil;
  +
  +    git_object_id                             := nil;
  +    git_object_write                          := nil;
  +    git_object_free                           := nil;
  +    git_object_type                           := nil;
  +    git_object_owner                          := nil;
  +    git_object_type2string                    := nil;
  +    git_object_string2type                    := nil;
  +    git_object_typeisloose                    := nil;
  +
  +    git_odb_new                               := nil;
  +    git_odb_open                              := nil;
  +    git_odb_add_backend                       := nil;
  +    git_odb_close                             := nil;
  +    git_odb_read                              := nil;
  +    git_odb_read_header                       := nil;
  +    git_odb_write                             := nil;
  +    git_odb_exists                            := nil;
  +
  +    git_rawobj_hash                           := nil;
  +    git_rawobj_close                          := nil;
  +
  +    git_oid_mkstr                             := nil;
  +    git_oid_fmt                               := nil;
  +    git_oid_pathfmt                           := nil;
  +    git_oid_mkraw                             := nil;
  +    git_oid_allocfmt                          := nil;
  +    git_oid_to_string                         := nil;
  +    git_oid_cpy                               := nil;
  +
  +    git_repository_open                       := nil;
  +    git_repository_free                       := nil;
  +    git_repository_open2                      := nil;
  +    git_repository_lookup                     := nil;
  +    git_repository_database                   := nil;
  +    git_repository_index                      := nil;
  +    git_repository_newobject                  := nil;
  +    git_repository_init                       := nil;
  +
  +    git_revwalk_new                           := nil;
  +    git_revwalk_free                          := nil;
  +    git_revwalk_sorting                       := nil;
  +    git_revwalk_push                          := nil;
  +    git_revwalk_next                          := nil;
  +    git_revwalk_reset                         := nil;
  +    git_revwalk_hide                          := nil;
  +    git_revwalk_repository                    := nil;
  +
  +    git_signature_new                         := nil;
  +    git_signature_dup                         := nil;
  +    git_signature_free                        := nil;
  +
  +    git_tag_lookup                            := nil;
  +    git_tag_name                              := nil;
  +    git_tag_type                              := nil;
  +    git_tag_target                            := nil;
  +    git_tag_id                                := nil;
  +    git_tag_set_name                          := nil;
  +    git_tag_new                               := nil;
  +    git_tag_tagger                            := nil;
  +    git_tag_message                           := nil;
  +    git_tag_set_target                        := nil;
  +    git_tag_set_tagger                        := nil;
  +    git_tag_set_message                       := nil;
  +
  +    git_tree_lookup                           := nil;
  +    git_tree_entry_byname                     := nil;
  +    git_tree_entry_byindex                    := nil;
  +    git_tree_entrycount                       := nil;
  +    git_tree_entry_name                       := nil;
  +    git_tree_entry_2object                    := nil;
  +    git_tree_new                              := nil;
  +    git_tree_add_entry                        := nil;
  +    git_tree_remove_entry_byindex             := nil;
  +    git_tree_remove_entry_byname              := nil;
  +    git_tree_id                               := nil;
  +
  +    git_tree_entry_attributes                 := nil;
  +    git_tree_entry_id                         := nil;
  +    git_tree_entry_set_id                     := nil;
  +    git_tree_entry_set_name                   := nil;
  +    git_tree_entry_set_attributes             := nil;
     end;
   end;
   
  
positive.code:    Pgit_revwalk_listnode = ^git_revwalk_listnode;
     Pgit_tag = ^git_tag;
     Ppack_backend = ^pack_backend;
  
  //   typedef int (*git_vector_cmp)(const void *, const void *);
     git_vector_cmp = Pointer;
  
negative.code:   libgit2: THandle;
  
  function InitLibgit2: Boolean;
     function Bind(const aName: String): Pointer;
     begin
        Result := GetProcAddress(libgit2, PAnsiChar(aName));
        {$IFDEF DEBUG}
        if Result = nil then
           raise Exception.CreateFmt('Export [%s] not found', [aName]);
        {$ENDIF}
     end;
  begin
    if libgit2 = 0 then
    begin
      libgit2 := LoadLibrary('git2.dll');
      if libgit2 > 0 then
      begin
        git_blob_lookup                           := Bind('git_blob_lookup');
        git_blob_new                              := Bind('git_blob_new');
        git_blob_set_rawcontent_fromfile          := Bind('git_blob_set_rawcontent_fromfile');
        git_blob_set_rawcontent                   := Bind('git_blob_set_rawcontent');
        git_blob_rawcontent                       := Bind('git_blob_rawcontent');
        git_blob_rawsize                          := Bind('git_blob_rawsize');
        git_blob_writefile                        := Bind('git_blob_writefile');
  
        git_commit_lookup                         := Bind('git_commit_lookup');
        git_commit_message_short                  := Bind('git_commit_message_short');
        git_commit_message                        := Bind('git_commit_message');
        git_commit_author                         := Bind('git_commit_author');
        git_commit_committer                      := Bind('git_commit_committer');
        git_commit_time                           := Bind('git_commit_time');
        git_commit_parentcount                    := Bind('git_commit_parentcount');
        git_commit_parent                         := Bind('git_commit_parent');
        git_commit_id                             := Bind('git_commit_id');
        git_commit_new                            := Bind('git_commit_new');
  //      git_commit_timezone_offset                := Bind('git_commit_timezone_offset'); {TODO : libgit2 has a typo, named git_commit_time_offset in commit.c}
        git_commit_tree                           := Bind('git_commit_tree');
        git_commit_add_parent                     := Bind('git_commit_add_parent');
        git_commit_set_message                    := Bind('git_commit_set_message');
        git_commit_set_committer                  := Bind('git_commit_set_committer');
        git_commit_set_author                     := Bind('git_commit_set_author');
        git_commit_set_tree                       := Bind('git_commit_set_tree');
  
        git_index_open_bare                       := Bind('git_index_open_bare');
        git_index_read                            := Bind('git_index_read');
        git_index_free                            := Bind('git_index_free');
        git_index_find                            := Bind('git_index_find');
        git_index_entrycount                      := Bind('git_index_entrycount');
  
        git_index_open_inrepo                     := Bind('git_index_open_inrepo');
        git_index_clear                           := Bind('git_index_clear');
        git_index_write                           := Bind('git_index_write');
        git_index_add                             := Bind('git_index_add');
        git_index_remove                          := Bind('git_index_remove');
        git_index_insert                          := Bind('git_index_insert');
        git_index_get                             := Bind('git_index_get');
  
        git_object_id                             := Bind('git_object_id');
        git_object_write                          := Bind('git_object_write');
        git_object_free                           := Bind('git_object_free');
        git_object_type                           := Bind('git_object_type');
        git_object_owner                          := Bind('git_object_owner');
        git_object_type2string                    := Bind('git_object_type2string');
        git_object_string2type                    := Bind('git_object_string2type');
        git_object_typeisloose                    := Bind('git_object_typeisloose');
  
        git_odb_new                               := Bind('git_odb_new');
        git_odb_open                              := Bind('git_odb_open');
        git_odb_add_backend                       := Bind('git_odb_add_backend');
        git_odb_close                             := Bind('git_odb_close');
        git_odb_read                              := Bind('git_odb_read');
        git_odb_read_header                       := Bind('git_odb_read_header');
        git_odb_write                             := Bind('git_odb_write');
        git_odb_exists                            := Bind('git_odb_exists');
  
        git_rawobj_hash                           := Bind('git_rawobj_hash');
        git_rawobj_close                          := Bind('git_rawobj_close');
  
        git_oid_mkstr                             := Bind('git_oid_mkstr');
        git_oid_fmt                               := Bind('git_oid_fmt');
        git_oid_pathfmt                           := Bind('git_oid_pathfmt');
        git_oid_mkraw                             := Bind('git_oid_mkraw');
        git_oid_allocfmt                          := Bind('git_oid_allocfmt');
        git_oid_to_string                         := Bind('git_oid_to_string');
        git_oid_cpy                               := Bind('git_oid_cpy');
  
        git_repository_open                       := Bind('git_repository_open');
        git_repository_free                       := Bind('git_repository_free');
        git_repository_open2                      := Bind('git_repository_open2');
        git_repository_lookup                     := Bind('git_repository_lookup');
        git_repository_database                   := Bind('git_repository_database');
        git_repository_index                      := Bind('git_repository_index');
        git_repository_newobject                  := Bind('git_repository_newobject');
        git_repository_init                       := Bind('git_repository_init');
  
        git_revwalk_new                           := Bind('git_revwalk_new');
        git_revwalk_free                          := Bind('git_revwalk_free');
        git_revwalk_sorting                       := Bind('git_revwalk_sorting');
        git_revwalk_push                          := Bind('git_revwalk_push');
        git_revwalk_next                          := Bind('git_revwalk_next');
        git_revwalk_reset                         := Bind('git_revwalk_reset');
        git_revwalk_hide                          := Bind('git_revwalk_hide');
        git_revwalk_repository                    := Bind('git_revwalk_repository');
  
        git_signature_new                         := Bind('git_signature_new');
        git_signature_dup                         := Bind('git_signature_dup');
        git_signature_free                        := Bind('git_signature_free');
  
        git_tag_lookup                            := Bind('git_tag_lookup');
        git_tag_name                              := Bind('git_tag_name');
        git_tag_type                              := Bind('git_tag_type');
        git_tag_target                            := Bind('git_tag_target');
        git_tag_id                                := Bind('git_tag_id');
        git_tag_set_name                          := Bind('git_tag_set_name');
        git_tag_new                               := Bind('git_tag_new');
        git_tag_tagger                            := Bind('git_tag_tagger');
        git_tag_message                           := Bind('git_tag_message');
        git_tag_set_target                        := Bind('git_tag_set_target');
        git_tag_set_tagger                        := Bind('git_tag_set_tagger');
        git_tag_set_message                       := Bind('git_tag_set_message');
  
        git_tree_lookup                           := Bind('git_tree_lookup');
        git_tree_entry_byname                     := Bind('git_tree_entry_byname');
        git_tree_entry_byindex                    := Bind('git_tree_entry_byindex');
        git_tree_entrycount                       := Bind('git_tree_entrycount');
        git_tree_entry_name                       := Bind('git_tree_entry_name');
        git_tree_entry_2object                    := Bind('git_tree_entry_2object');
        git_tree_new                              := Bind('git_tree_new');
        git_tree_add_entry                        := Bind('git_tree_add_entry');
        git_tree_remove_entry_byindex             := Bind('git_tree_remove_entry_byindex');
        git_tree_remove_entry_byname              := Bind('git_tree_remove_entry_byname');
        git_tree_id                               := Bind('git_tree_id');
  
        git_tree_entry_attributes                 := Bind('git_tree_entry_attributes');
        git_tree_entry_id                         := Bind('git_tree_entry_id');
        git_tree_entry_set_id                     := Bind('git_tree_entry_set_id');
        git_tree_entry_set_name                   := Bind('git_tree_entry_set_name');
        git_tree_entry_set_attributes             := Bind('git_tree_entry_set_attributes');
      end;
    end;
  
  