Skip to content

Commit b4e50d4

Browse files
committed
indent libgit2/gitlog.c to make it more readable
1 parent fbfea41 commit b4e50d4

File tree

1 file changed

+33
-34
lines changed

1 file changed

+33
-34
lines changed

libgit2/gitlog.c

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,37 @@
22
#include "git2.h"
33

44
int main() {
5-
git_libgit2_init();
6-
7-
git_repository *repo = NULL;
8-
git_repository_init(&repo, "/tmp/v", 0);
9-
10-
git_oid oid;
11-
git_reference_name_to_id(&oid, repo, "HEAD");
12-
13-
git_commit *commit = NULL;
14-
git_commit_lookup(&commit, repo, &oid);
15-
16-
git_revwalk *walker = NULL;
17-
git_revwalk_new(&walker, repo);
18-
git_revwalk_push(walker, &oid);
19-
20-
git_oid current_oid;
21-
int i = 0;
22-
while (git_revwalk_next(&current_oid, walker) == 0) {
23-
i++;
24-
if (i > 10) {break;}
25-
git_commit_lookup(&commit, repo, &current_oid);
26-
const git_signature *author = git_commit_author(commit);
27-
28-
printf("Commit ID: %s\n", git_oid_tostr_s(&current_oid));
29-
printf("Author: %s <%s>\n", author->name, author->email);
30-
printf("Message: %s\n\n", git_commit_message(commit));
31-
}
32-
33-
git_revwalk_free(walker);
34-
git_commit_free(commit);
35-
git_repository_free(repo);
36-
git_libgit2_shutdown();
37-
38-
return 0;
5+
git_libgit2_init();
6+
7+
git_repository *repo = NULL;
8+
git_repository_init(&repo, "/tmp/v", 0);
9+
10+
git_oid oid;
11+
git_reference_name_to_id(&oid, repo, "HEAD");
12+
13+
git_commit *commit = NULL;
14+
git_commit_lookup(&commit, repo, &oid);
15+
16+
git_revwalk *walker = NULL;
17+
git_revwalk_new(&walker, repo);
18+
git_revwalk_push(walker, &oid);
19+
20+
git_oid current_oid;
21+
int i = 0;
22+
while (git_revwalk_next(&current_oid, walker) == 0) {
23+
i++;
24+
if (i > 10) {break;}
25+
git_commit_lookup(&commit, repo, &current_oid);
26+
const git_signature *author = git_commit_author(commit);
27+
printf("Commit ID: %s\n", git_oid_tostr_s(&current_oid));
28+
printf("Author: %s <%s>\n", author->name, author->email);
29+
printf("Message: %s\n\n", git_commit_message(commit));
30+
}
31+
32+
git_revwalk_free(walker);
33+
git_commit_free(commit);
34+
git_repository_free(repo);
35+
git_libgit2_shutdown();
36+
37+
return 0;
3938
}

0 commit comments

Comments
 (0)