diff --git a/eeshow/git-file.c b/eeshow/git-file.c index 1aaea6a..7dc75a5 100644 --- a/eeshow/git-file.c +++ b/eeshow/git-file.c @@ -421,16 +421,23 @@ static bool try_related(struct vcs_git *vcs_git) } -struct vcs_git *vcs_git_open(const char *revision, const char *name, - const struct vcs_git *related) +void vcs_git_init(void) { static bool initialized = 0; - struct vcs_git *vcs_git = alloc_type(struct vcs_git); if (!initialized) { git_libgit2_init(); initialized = 1; } +} + + +struct vcs_git *vcs_git_open(const char *revision, const char *name, + const struct vcs_git *related) +{ + struct vcs_git *vcs_git = alloc_type(struct vcs_git); + + vcs_git_init(); vcs_git->name = stralloc(name); vcs_git->revision = revision ? stralloc(revision) : NULL; diff --git a/eeshow/git-file.h b/eeshow/git-file.h index 1b4c0ff..7d1b637 100644 --- a/eeshow/git-file.h +++ b/eeshow/git-file.h @@ -29,6 +29,8 @@ struct vcs_git; struct file; +void vcs_git_init(void); + struct vcs_git *vcs_git_open(const char *revision, const char *name, const struct vcs_git *related); void vcs_git_read(void *ctx, struct file *file, diff --git a/eeshow/git-hist.c b/eeshow/git-hist.c index b4b48a6..bf0129d 100644 --- a/eeshow/git-hist.c +++ b/eeshow/git-hist.c @@ -17,6 +17,7 @@ #include "util.h" #include "main.h" +#include "git-file.h" #include "git-hist.h" @@ -134,7 +135,8 @@ struct hist *vcs_git_hist(const char *path) head = new_commit(0); - git_libgit2_init(); /* @@@ */ + vcs_git_init(); + if (git_repository_open_ext(&repo, path, GIT_REPOSITORY_OPEN_CROSS_FS, NULL)) { e = giterr_last();