From 35a3d5be72654d744563c8d4ca5d1014563fc1d9 Mon Sep 17 00:00:00 2001 From: Galin Simeonov Date: Mon, 27 Sep 2021 00:51:19 +0300 Subject: added a skeleton for a man page --- git_part.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'git_part.c') 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(¤t_tree,current_commit); - if(parent_commit==NULL) - parent_tree=NULL; - else - git_commit_tree(&parent_tree,parent_commit); + git_commit_tree(¤t_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
\n"); } + close_file(index_file); } void print_files_top(int dir_fd,git_commit *top_commit,git_repository *repo) { -- cgit v1.2.3