We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 217add9 commit 30e919cCopy full SHA for 30e919c
examples/ls-files.c
@@ -0,0 +1,37 @@
1
+#include <common.h>
2
+
3
+typedef struct ls_files_state {
4
+ git_repository *repo;
5
+ git_index *index;
6
+ char **files;
7
+ size_t num_entries;
8
+} ls_files;
9
10
+void create_ls_files(ls_files **ls);
11
12
+int main(int argc, char[] *argv) {
13
+ ls_files *ls;
14
+ git_index_entry *entry;
15
+ size_t i;
16
17
+ git_libgit2_init();
18
19
+ ls = git__malloc(sizeof(ls_files));
20
21
+ // TODO err
22
+ git_repository_open_ext(&ls->repo, ".", 0, NULL);
23
24
25
+ git_repository_index__weakptr(&ls->index, ls->repo);
26
27
28
+ git_vector_foreach(&ls->index->entries, i, entry) {
29
+ printf("%s\n", entry->path);
30
+ }
31
32
+ git_repository_free(ls->repo);
33
+ git__free(ls);
34
+ git_libgit2_shutdown();
35
36
+ return 0;
37
+}
0 commit comments