Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
30e919c4
Commit
30e919c4
authored
Oct 16, 2017
by
Carson Howard
Committed by
Carson Howard
Mar 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples: ls-files: list files
parent
217add94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
examples/ls-files.c
+37
-0
No files found.
examples/ls-files.c
0 → 100644
View file @
30e919c4
#include <common.h>
typedef
struct
ls_files_state
{
git_repository
*
repo
;
git_index
*
index
;
char
**
files
;
size_t
num_entries
;
}
ls_files
;
void
create_ls_files
(
ls_files
**
ls
);
int
main
(
int
argc
,
char
[]
*
argv
)
{
ls_files
*
ls
;
git_index_entry
*
entry
;
size_t
i
;
git_libgit2_init
();
ls
=
git__malloc
(
sizeof
(
ls_files
));
// TODO err
git_repository_open_ext
(
&
ls
->
repo
,
"."
,
0
,
NULL
);
// TODO err
git_repository_index__weakptr
(
&
ls
->
index
,
ls
->
repo
);
git_vector_foreach
(
&
ls
->
index
->
entries
,
i
,
entry
)
{
printf
(
"%s
\n
"
,
entry
->
path
);
}
git_repository_free
(
ls
->
repo
);
git__free
(
ls
);
git_libgit2_shutdown
();
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment