versioned_graph/commit
replace homebrewn git init for a real git init --bare
author | Jacco van Ossenbruggen |
---|---|
Thu Jun 5 16:51:09 2014 +0200 | |
committer | Jacco van Ossenbruggen |
Thu Jun 5 16:53:43 2014 +0200 | |
commit | eb8027453b3234283cffca0830fcad51478d6529 |
tree | dfe3a6aa3a50515c112f03c79906ec252c609fee |
parent | 1868b2db00868e77793b414f1adfd14a967b6ef3 |
Diff style: patch stat
diff --git a/lib/gv_git_io.pl b/lib/gv_git_io.pl index c8eb229..a55b218 100644 --- a/lib/gv_git_io.pl +++ b/lib/gv_git_io.pl @@ -15,6 +15,16 @@ gv_init_git :- + setting(graph_version:gv_git_dir, Dir), + ( exists_directory(Dir) + -> true + ; make_directory(Dir), + catch(git(['init', '--bare'],[directory(Dir)]), _, fail) + ). + + +gv_init_git :- + fail, setting(graph_version:gv_git_dir, Dir), directory_file_path(Dir, '.git', DotDir), directory_file_path(DotDir, objects, ObjectsDir), @@ -74,23 +84,6 @@ gv_store_git_object(Hash, Object, Options) :- sub_atom(HashN, 0, _, 1, GitHash), % remove trailing new line ... assertion(Hash == GitHash), !. -gv_store_git_object(Hash, Object, Options) :- - fail, % this does not work because of encoding issues... - sub_atom(Hash, 0, 2, 38, Subdir), - sub_atom(Hash, 2, 38, 0, Local), - option(directory(GitDir), Options), - directory_file_path(GitDir, '.git/objects', GitObjects), - directory_file_path(GitObjects, Subdir, Dir), - directory_file_path(Dir,Local, File), - ( exists_directory(Dir) -> true; make_directory(Dir)), - ( exists_file(File) - -> true - ; open(File, write, Output, [type(binary)]), - zopen(Output, Zout, []), - write(Zout, Object), - close(Zout) - ). - gv_git_cat_file(Hash, Codes) :- setting(graph_version:gv_git_dir, Dir),