mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Collect and convert git repo data to 'struct git_info'
We have this nasty habit of randomly passing down all the different things that we use to look up the local and remote git repository, and the information associated with it. Start collecting the data into a 'struct git_info' instead, so that it is easier to manage, and easier and more logical to just look up different parts of the puzzle. This is a fairly mechanical conversion, but has moved all the basic information collection to the 'is_git_repository()' function. That function no longer actually opens the repository (so the 'dry_run' argument is gone, and instead a successful 'is_git_repository()' is followed by 'opn_git_repository()' if you actually want the old non-dry_run semantics. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
acc4dc57af
commit
7e632173e0
11 changed files with 365 additions and 349 deletions
|
|
@ -22,30 +22,40 @@ extern "C" {
|
|||
|
||||
#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
|
||||
|
||||
enum remote_transport { RT_OTHER, RT_HTTPS, RT_SSH };
|
||||
enum remote_transport { RT_LOCAL, RT_HTTPS, RT_SSH, RT_OTHER };
|
||||
|
||||
struct git_oid;
|
||||
struct git_repository;
|
||||
struct device_table;
|
||||
#define dummy_git_repository ((git_repository *)3ul) /* Random bogus pointer, not NULL */
|
||||
extern struct git_repository *is_git_repository(const char *filename, const char **branchp, const char **remote, bool dry_run);
|
||||
extern int check_git_sha(const char *filename, git_repository **git_p, const char **branch_p);
|
||||
extern int sync_with_remote(struct git_repository *repo, const char *remote, const char *branch, enum remote_transport rt);
|
||||
extern int git_save_dives(struct git_repository *, const char *, const char *remote, bool select_only);
|
||||
extern int git_load_dives(struct git_repository *repo, const char *branch, struct dive_table *table, struct trip_table *trips,
|
||||
|
||||
struct git_info {
|
||||
const char *url;
|
||||
const char *branch;
|
||||
const char *username;
|
||||
const char *localdir;
|
||||
struct git_repository *repo;
|
||||
unsigned is_subsurface_cloud:1;
|
||||
enum remote_transport transport;
|
||||
};
|
||||
|
||||
extern bool is_git_repository(const char *filename, struct git_info *info);
|
||||
extern bool open_git_repository(struct git_info *info);
|
||||
extern bool check_git_sha(const char *filename, struct git_info *info);
|
||||
extern int sync_with_remote(struct git_info *);
|
||||
extern int git_save_dives(struct git_info *, bool select_only);
|
||||
extern int git_load_dives(struct git_info *, struct dive_table *table, struct trip_table *trips,
|
||||
struct dive_site_table *sites, struct device_table *devices,
|
||||
struct filter_preset_table *filter_presets);
|
||||
extern const char *get_sha(git_repository *repo, const char *branch);
|
||||
extern int do_git_save(git_repository *repo, const char *branch, const char *remote, bool select_only, bool create_empty);
|
||||
extern int do_git_save(struct git_info *, bool select_only, bool create_empty);
|
||||
extern const char *saved_git_id;
|
||||
extern bool git_local_only;
|
||||
extern bool git_remote_sync_successful;
|
||||
extern void clear_git_id(void);
|
||||
extern void set_git_id(const struct git_oid *);
|
||||
extern enum remote_transport url_to_remote_transport(const char *remote);
|
||||
void set_git_update_cb(int(*)(const char *));
|
||||
int git_storage_update_progress(const char *text);
|
||||
char *get_local_dir(const char *remote, const char *branch);
|
||||
char *get_local_dir(const char *, const char *);
|
||||
int git_create_local_repo(const char *filename);
|
||||
int get_authorship(git_repository *repo, git_signature **authorp);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue