mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-26 13:53:09 +02:00
eeshow/git-file.c (vcs_git_init): common initialization
This commit is contained in:
parent
1c6116a8d6
commit
17360f7ddd
@ -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,
|
void vcs_git_init(void)
|
||||||
const struct vcs_git *related)
|
|
||||||
{
|
{
|
||||||
static bool initialized = 0;
|
static bool initialized = 0;
|
||||||
struct vcs_git *vcs_git = alloc_type(struct vcs_git);
|
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
git_libgit2_init();
|
git_libgit2_init();
|
||||||
initialized = 1;
|
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->name = stralloc(name);
|
||||||
vcs_git->revision = revision ? stralloc(revision) : NULL;
|
vcs_git->revision = revision ? stralloc(revision) : NULL;
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
struct vcs_git;
|
struct vcs_git;
|
||||||
struct file;
|
struct file;
|
||||||
|
|
||||||
|
void vcs_git_init(void);
|
||||||
|
|
||||||
struct vcs_git *vcs_git_open(const char *revision, const char *name,
|
struct vcs_git *vcs_git_open(const char *revision, const char *name,
|
||||||
const struct vcs_git *related);
|
const struct vcs_git *related);
|
||||||
void vcs_git_read(void *ctx, struct file *file,
|
void vcs_git_read(void *ctx, struct file *file,
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "git-file.h"
|
||||||
#include "git-hist.h"
|
#include "git-hist.h"
|
||||||
|
|
||||||
|
|
||||||
@ -134,7 +135,8 @@ struct hist *vcs_git_hist(const char *path)
|
|||||||
|
|
||||||
head = new_commit(0);
|
head = new_commit(0);
|
||||||
|
|
||||||
git_libgit2_init(); /* @@@ */
|
vcs_git_init();
|
||||||
|
|
||||||
if (git_repository_open_ext(&repo, path,
|
if (git_repository_open_ext(&repo, path,
|
||||||
GIT_REPOSITORY_OPEN_CROSS_FS, NULL)) {
|
GIT_REPOSITORY_OPEN_CROSS_FS, NULL)) {
|
||||||
e = giterr_last();
|
e = giterr_last();
|
||||||
|
Loading…
Reference in New Issue
Block a user