2016-08-04 22:12:40 +03:00
|
|
|
/*
|
|
|
|
* git-hist.h - Retrieve revision history from GIT repo
|
|
|
|
*
|
|
|
|
* Written 2016 by Werner Almesberger
|
|
|
|
* Copyright 2016 by Werner Almesberger
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GIT_HIST_H
|
|
|
|
#define GIT_HIST_H
|
|
|
|
|
2016-08-05 02:35:41 +03:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2016-08-04 22:12:40 +03:00
|
|
|
#include <git2.h>
|
|
|
|
|
|
|
|
|
|
|
|
struct hist {
|
2016-08-05 15:22:37 +03:00
|
|
|
struct git_commit *commit; /* NULL if uncommitted changes */
|
2016-08-04 22:12:40 +03:00
|
|
|
|
|
|
|
unsigned branch; /* branch index */
|
|
|
|
|
|
|
|
struct hist **newer;
|
|
|
|
unsigned n_newer;
|
|
|
|
|
|
|
|
struct hist **older;
|
|
|
|
unsigned n_older;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-08-05 02:35:41 +03:00
|
|
|
bool vcs_git_try(const char *path);
|
2016-08-04 22:12:40 +03:00
|
|
|
struct hist *vcs_git_hist(const char *path);
|
2016-08-06 07:18:43 +03:00
|
|
|
char *vcs_git_get_rev(struct hist *h);
|
2016-08-04 22:12:40 +03:00
|
|
|
const char *vcs_git_summary(struct hist *hist);
|
2016-08-05 02:35:41 +03:00
|
|
|
void hist_iterate(struct hist *h,
|
|
|
|
void (*fn)(void *user, struct hist *h), void *user);
|
2016-08-04 22:12:40 +03:00
|
|
|
void dump_hist(struct hist *h);
|
|
|
|
|
|
|
|
#endif /* !GIT_HIST_H */
|