RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm                              Date:   08-Mar-2012 23:18:27
  Branch: rpm-5_4                          Handle: 2012030822182600

  Modified files:           (Branch: rpm-5_4)
    rpm/rpmio               rpmgit.c rpmgit.h

  Log:
    - rpmgit: use void * to keep libgit2 API opaque.

  Summary:
    Revision    Changes     Path
    2.1.2.6     +35 -28     rpm/rpmio/rpmgit.c
    2.1.2.5     +14 -61     rpm/rpmio/rpmgit.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmgit.c
  ============================================================================
  $ cvs diff -u -r2.1.2.5 -r2.1.2.6 rpmgit.c
  --- rpm/rpmio/rpmgit.c        6 Mar 2012 14:43:35 -0000       2.1.2.5
  +++ rpm/rpmio/rpmgit.c        8 Mar 2012 22:18:26 -0000       2.1.2.6
  @@ -160,7 +160,7 @@
   #if defined(WITH_LIBGIT2)
   
       rc = chkgit(git, "git_repository_config",
  -             git_repository_config(&git->cfg, git->repo));
  +             git_repository_config((git_config **)&git->cfg, git->R));
   
       rc = chkgit(git, "git_config_foreach",
                git_config_foreach(git->cfg, rpmgitConfigPrint, git));
  @@ -190,7 +190,7 @@
       int xx;
   
       xx = chkgit(git, "git_revwalk_new",
  -             git_revwalk_new(&git->walk, git->repo));
  +             git_revwalk_new((git_revwalk **)&git->walk, git->R));
       git_revwalk_sorting(git->walk, GIT_SORT_TOPOLOGICAL | GIT_SORT_REVERSE);
       xx = chkgit(git, "git_revwalk_push_head",
                git_revwalk_push_head(git->walk));
  @@ -207,7 +207,7 @@
        fprintf(fp, "\t  oid: %s", t);
   
        xx = chkgit(git, "git_commit_lookup",
  -             git_commit_lookup(&wcommit, git->repo, &oid));
  +             git_commit_lookup(&wcommit, git->R, &oid));
        cmsg  = git_commit_message(wcommit);
        cauth = git_commit_author(wcommit);
        fprintf(fp, "\n\t%s (%s)", cmsg, cauth->email);
  @@ -237,14 +237,14 @@
       int xx;
   
       xx = chkgit(git, "git_repository_index",
  -             git_repository_index(&git->index, git->repo));
  +             git_repository_index((git_index **)&git->I, git->R));
       xx = chkgit(git, "git_index_read",
  -             git_index_read(git->index));
  +             git_index_read(git->I));
   
  -    ecount = git_index_entrycount(git->index);
  +    ecount = git_index_entrycount(git->I);
       for (i = 0; i < ecount; i++) {
        static const char _fmt[] = "%c";
  -     git_index_entry * e = git_index_get(git->index, i);
  +     git_index_entry * e = git_index_get(git->I, i);
        git_oid oid = e->oid;
        time_t mtime;
        struct tm tm;
  @@ -277,8 +277,8 @@
        fprintf(fp, "\n");
       }
   
  -    git_index_free(git->index);
  -    git->index = NULL;
  +    git_index_free(git->I);
  +    git->I = NULL;
       rc = 0;
   #endif
   SPEW(0, rc, git);
  @@ -290,7 +290,7 @@
       int rc = -1;
   #if defined(WITH_LIBGIT2) && defined(NOTYET)
       FILE * fp = stdout;
  -    git_odb * odb = git_repository_database(git->repo);
  +    git_odb * odb = git_repository_database(git->R);
       git_odb_object * obj;
       git_oid oid;
       unsigned char * data;
  @@ -317,7 +317,7 @@
       int rc = -1;
   #if defined(WITH_LIBGIT2) && defined(NOTYET)
       FILE * fp = stdout;
  -    git_odb * odb = git_repository_database(git->repo);
  +    git_odb * odb = git_repository_database(git->R);
       git_oid oid;
       size_t nb = GIT_OID_HEXSZ;
       char * b = alloca(nb+1);
  @@ -342,25 +342,32 @@
       rpmgit git = _git;
   
   #if defined(WITH_LIBGIT2)
  -    if (git->cmtter)
  -     git_signature_free(git->cmtter);
  -    if (git->author)
  -     git_signature_free(git->author);
  -    if (git->commit)
  -     git_commit_free(git->commit);
  +    if (git->walk)
  +     git_revwalk_free(git->walk);
  +    if (git->odb)
  +     git_odb_free(git->odb);
       if (git->cfg)
        git_config_free(git->cfg);
  -    if (git->index)
  -     git_index_free(git->index);
  -    if (git->repo)
  -     git_repository_free(git->repo);
  -#endif
  -    git->cmtter = NULL;
  -    git->author = NULL;
  -    git->commit = NULL;
  +    if (git->H)
  +     git_commit_free(git->H);
  +    if (git->C)
  +     git_commit_free(git->C);
  +    if (git->T)
  +     git_tree_free(git->T);
  +    if (git->I)
  +     git_index_free(git->I);
  +    if (git->R)
  +     git_repository_free(git->R);
  +#endif
  +    git->walk = NULL;
  +    git->odb = NULL;
       git->cfg = NULL;
  -    git->index = NULL;
  -    git->repo = NULL;
  +    git->H = NULL;
  +    git->C = NULL;
  +    git->T = NULL;
  +    git->I = NULL;
  +    git->R = NULL;
  +
       git->fn = _free(git->fn);
   }
   
  @@ -398,7 +405,7 @@
   #if defined(WITH_LIBGIT2)
       git_libgit2_version(&git->major, &git->minor, &git->rev);
       xx = chkgit(git, "git_repository_open",
  -             git_repository_open(&git->repo, fn));
  +             git_repository_open((git_repository **)&git->R, fn));
   #endif
   
       return rpmgitLink(git);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmgit.h
  ============================================================================
  $ cvs diff -u -r2.1.2.4 -r2.1.2.5 rpmgit.h
  --- rpm/rpmio/rpmgit.h        4 Mar 2012 22:19:02 -0000       2.1.2.4
  +++ rpm/rpmio/rpmgit.h        8 Mar 2012 22:18:26 -0000       2.1.2.5
  @@ -25,69 +25,22 @@
       int minor;
       int rev;
   
  -#if defined(HAVE_GIT2_H)     /* XXX FIXME: use void * instead */
  -    git_repository * repo;
  -    git_index * index;
  -    git_config * cfg;
  -
  -    git_revwalk * walk;
  -
  -    git_commit * commit;
  -    git_signature * author;
  -    git_signature * cmtter;
  -#else
  -    void * repo;
  -    void * index;
  -    void * cfg;
  -
  -    void * walk;
  -
  -    void * commit;
  -    void * author;
  -    void * cmtter;
  -#endif
  +    void * R;                        /* git_repository * */
  +    void * I;                        /* git_index * */
  +    void * T;                        /* git_tree * */
  +    void * C;                        /* git_commit * */
  +    void * H;                        /* git_reference * */
  +
  +    void * cfg;                      /* git_config * */
  +    void * odb;                      /* git_odb * */
  +    void * walk;             /* git_revwalk * */
   
   #ifdef       NOTYET
  -    const char * message;
  -    time_t ctime;
  -
  -    git_oid oid;
  -    git_odb * odb;
  -    git_odb_object * obj;
  -    git_otype otype;
  -    unsigned int parents;
  -    unsigned int p;
  -
  -    git_oid tree_id;
  -    git_oid parent_id;
  -    git_oid commit_id;
  -    git_tree * tree;
  -    git_commit * parent;
  -
  -    git_tag * tag;
  -    const char * tmessage;
  -    const char * tname;
  -    git_otype ttype;
  -
  -    git_tree_entry * entry;
  -    git_object * objt;
  -
  -    git_blob * blob;
  -    git_commit * wcommit;
  -
  -    git_signature * cauth;
  -    const char * cmsg;
  -
  -    unsigned int i;
  -    unsigned int ecount;
  -    git_index_entry * e;
  -
  -    git_strarray ref_list;
  -    const char * refname;
  -    git_reference * ref;
  -
  -    const char * email;
  -    int32_t j;
  +    const void * Cauthor;
  +    const void * Ccmtter;
  +    const char * msg;
  +    const char * msgenc;
  +    time_t tstamp;
   #endif
   
   #if defined(__LCLINT__)
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to