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
|
@ -822,14 +822,12 @@ static void try_to_backup(const char *filename)
|
|||
int save_dives_logic(const char *filename, const bool select_only, bool anonymize)
|
||||
{
|
||||
struct membuffer buf = { 0 };
|
||||
struct git_info info;
|
||||
FILE *f;
|
||||
void *git;
|
||||
const char *branch, *remote;
|
||||
int error = 0;
|
||||
|
||||
git = is_git_repository(filename, &branch, &remote, false);
|
||||
if (git)
|
||||
return git_save_dives(git, branch, remote, select_only);
|
||||
if (is_git_repository(filename, &info))
|
||||
return git_save_dives(&info, select_only);
|
||||
|
||||
save_dives_buffer(&buf, select_only, anonymize);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue