summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/file.c b/file.c
index 826f3eb51..8facdf8d5 100644
--- a/file.c
+++ b/file.c
@@ -356,19 +356,21 @@ static void parse_file_buffer(const char *filename, struct memblock *mem, char *
if (!mem->size || !mem->buffer)
return;
- if (mem->size > 3 && !memcmp(mem->buffer, "git", 3)) {
- git_load_dives(mem->buffer);
- return;
- }
parse_xml_buffer(filename, mem->buffer, mem->size, &dive_table, NULL, error);
}
void parse_file(const char *filename, char **error)
{
+ struct git_repository *git;
+ const char *branch;
struct memblock mem;
char *fmt;
+ git = is_git_repository(filename, &branch);
+ if (git && !git_load_dives(git, branch))
+ return;
+
if (readfile(filename, &mem) < 0) {
/* we don't want to display an error if this was the default file */
if (prefs.default_filename && !strcmp(filename, prefs.default_filename))