Wednesday, 15 August 2012

git archive with LibGit2Sharp -



git archive with LibGit2Sharp -

recently saw both this question , this question answers can utilize git archive retrieve single file remote git repository. great, , able emulate functionality using libgit2sharp.

i have looked @ the source code, can't find archiving. there's archiverbase class, seems it's meant derived from, , can't see derives it. objectdatabase has archive() method uses archiverbase parameter, none of archiverbase methods implemented. need derive archiverbase , overwrite methods myself? how go that? has been done in other class?

in short, how can emulate git archive using libgit2sharp retrieve single file described in linked questions?

there happen concrete archiver implementation in libgit2sharp, tararchiver, create tar archive of local git repository. however, work against repository, not work against remote endpoint, not suitable retrieve single file git archive can.

libgit2sharp not include way asking. options to:

clone repository, checking out single file use api offered git hosting provider (octokit github or rest api team foundation server) retrieve single file. execute git-archive yourself.

git libgit2sharp

1 comment:

  1. //git archive
    Commit cm=repo.Head.Tip;
    string tarfile = _repoSource + "\\fx.tar";
    repo.ObjectDatabase.Archive(cm,tarfile);
    unTAR(tarfile);

    ReplyDelete