21 Commits

Author SHA1 Message Date
Edward Thomson
49d3fadfca Revert "commit: fix const declaration"
This reverts commit cf19ddc522, which
was breaking for several projects.
2024-06-13 15:20:40 +02:00
Edward Thomson
cf19ddc522 commit: fix const declaration
commit functions should take an array of const pointers, not a const
array.
2024-01-15 00:15:10 +00:00
Edward Thomson
f004096fff examples: use unsigned int for bitfields 2023-12-20 12:08:21 +00:00
Etienne Samson
313908f9f5 examples: normalize decls and usage of options structs 2019-11-06 11:17:56 +01:00
Etienne Samson
cd5e33fbc2 global: DRY includes of assert.h 2019-11-06 11:08:23 +01:00
Patrick Steinhardt
398412ccd3 Merge pull request #5143 from libgit2/ethomson/warnings
ci: build with ENABLE_WERROR on Windows
2019-07-05 11:56:16 +02:00
Patrick Steinhardt
976eed8078 examples: cast away constness for reallocating head arrays
When reallocating commit arrays in `opts_add_commit` and
`opts_add_refish`, respectively, we simply pass the const pointer to
`xrealloc`. As `xrealloc` expects a non-const pointer, though, this will
generate a warning with some compilers.

Cast away the constness to silence compilers.
2019-07-05 11:28:57 +02:00
Scott Furry
2ba7dbbe35 Resolve static check warnings in example code
Using cppcheck on libgit2 sources indicated two warnings in
example code.

merge.c was reported as having a memory leak. Fix applied
was to `free()` memory pointed to by `parents`.

init.c was reported as having a null pointer dereference
on variable arg. Function 'usage' was being called with
a null variable. Changed supplied parameter to empty string.
2019-06-27 04:59:28 -06:00
Edward Thomson
cd67a9039c examples: cast away const-ness 2019-06-25 15:22:46 +01:00
Patrick Steinhardt
b106620d03 examples: move MSVC compatibility macros into common header
We currently have two locations in our examples where we define
the same compatibility wrappers for MSVC. Move them into
"common.h" to avoid duplication and make them available to other
examples.
2019-04-16 11:52:30 +02:00
Patrick Steinhardt
ead10785dc examples: create common lg2 executable
Inside of our networking example code, we have a git2 executable
that acts as an entry point to all the different network
examples. As such, it is kind of the same like the normal git(1)
executable in that it simply arbitrates to the respective
subcommands.

Let's extend this approach and merge all examples into a single
standalone lg2 executable. Instead of building an executable
for all the existing examples we have, we now bundle them all
inside of the lg2 one and let them be callable via subcommands.

In the process, we can get rid of duplicated library
initialization, deinitialization and repository discovery code.
Instead of having each subcommand handle these on its own, we
simply do it inside of the single main function now.
2019-02-15 12:06:54 +01:00
Edward Thomson
fcc7dcb176 errors: remove giterr usage in examples 2019-01-22 22:30:37 +00:00
Edward Thomson
83151018ef object_type: convert final internal users to new names
Update some missed types that were continuing to use the old `GIT_OBJ`
names.
2019-01-17 11:03:19 +00:00
Etienne Samson
8a629afedc examples: move refish resolution function in common 2018-07-07 13:10:50 +02:00
Etienne Samson
33f44db9d0 examples: zero out our options memory before use 2018-01-25 22:17:39 +01:00
Etienne Samson
fb79d7d12e examples: our/their can be NULL 2018-01-25 22:14:39 +01:00
Etienne Samson
cc845595f0 examples: fix remaining review comments 2018-01-25 22:14:39 +01:00
Etienne Samson
5ce4f19bce examples: move support code into static functions 2018-01-25 22:14:37 +01:00
Etienne Samson
503b30d526 examples: hoist the merge analysis back into main 2018-01-25 22:13:25 +01:00
Etienne Samson
60c6547ce6 examples: minor review fixups 2018-01-25 22:12:41 +01:00
Etienne Samson
59ea2c58da examples: add merge 2018-01-25 22:12:38 +01:00