summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGalin Simeonov <gts@volconst.com>2021-09-27 00:51:19 +0300
committerGalin Simeonov <gts@volconst.com>2021-09-27 00:51:19 +0300
commit35a3d5be72654d744563c8d4ca5d1014563fc1d9 (patch)
treebfb221bb07239b90bd8e1f845707fd9639f174db
parent8c9ec9a22944e4d47b707d01f084e31ce4512f8a (diff)
downloadvolgit-35a3d5be72654d744563c8d4ca5d1014563fc1d9.tar.gz
added a skeleton for a man page
-rw-r--r--git_part.c27
-rw-r--r--system_part.c2
-rw-r--r--volgit.711
3 files changed, 28 insertions, 12 deletions
diff --git a/git_part.c b/git_part.c
index beaf5d0..5d4ab8f 100644
--- a/git_part.c
+++ b/git_part.c
@@ -99,22 +99,24 @@ void print_commits(int dir_fd,const git_reference *branch, git_repository *repo)
}
void print_commit(git_commit *current_commit,git_commit *parent_commit,FILE *log_file,int diff_directory_fd,git_repository *repo)
{
- git_tree *current_tree;
- git_tree *parent_tree;
- FILE *diff_file;
+ git_tree *current_tree;
+ git_tree *parent_tree;
+ FILE *diff_file;
- git_commit_tree(&current_tree,current_commit);
- if(parent_commit==NULL)
- parent_tree=NULL;
- else
- git_commit_tree(&parent_tree,parent_commit);
+ git_commit_tree(&current_tree,current_commit);
+ if(parent_commit==NULL)
+ parent_tree=NULL;
+ else
+ git_commit_tree(&parent_tree,parent_commit);
+
+ diff_file=create_file(diff_directory_fd,git_oid_tostr_s(git_commit_id(current_commit)));
- diff_file=create_file(diff_directory_fd,git_oid_tostr_s(git_commit_id(current_commit)));
+ print_diff(diff_file,parent_tree,current_tree,repo);
- print_diff(diff_file,parent_tree,current_tree,repo);
+ git_tree_free(parent_tree);
+ print_headers_and_commit_message(log_file,current_commit,git_commit_id(current_commit),1);
- git_tree_free(parent_tree);
- print_headers_and_commit_message(log_file,current_commit,git_commit_id(current_commit),1);
+ close_file(diff_file);
}
void print_branches(git_repository *repo)
@@ -160,6 +162,7 @@ void print_files(int dir_fd,git_tree *tree,git_repository *repo)
print_entry(index_file,current_entry,dir_fd,repo);
fprintf(index_file,"\n<br>\n");
}
+ close_file(index_file);
}
void print_files_top(int dir_fd,git_commit *top_commit,git_repository *repo)
{
diff --git a/system_part.c b/system_part.c
index f3ef526..1865184 100644
--- a/system_part.c
+++ b/system_part.c
@@ -53,6 +53,8 @@ char* read_file(const char *filename)
if(ret==NULL)
die("Ran out of memory!\n");
+ read(file,ret,file_stats.st_size);
+
close(file);
return ret;
}
diff --git a/volgit.7 b/volgit.7
new file mode 100644
index 0000000..558befb
--- /dev/null
+++ b/volgit.7
@@ -0,0 +1,11 @@
+.TH "VOLGIT" 1 "Setember 27 2021" gts@volconst.com
+.SH NAME
+\f[B]volgit\f[] \- git repository to static html
+.SH SYNOPSIS
+\f[B]volgit\f[] \f[I]source-dir-for-repo destination-dir [ file-containing-header file-containing-footer ]\f[]
+.SH DESCRIPTION
+Very slow static site generator for git repositories.
+.br
+To be safe run it under a separate user account.
+.SH SEE ALSO
+\f[B]git(1)\f[]