Commit Graph

459 Commits

Author SHA1 Message Date
Edward Thomson
94ba816f66 Revert "commit: fix const declaration"
This reverts commit cf19ddc522, which
was breaking for several projects.
2024-10-30 17:31:33 -04:00
qaqland
322ea80231 examples: fix memory leak in for-each-ref.c 2024-05-08 11:08:26 +08:00
Edward Thomson
c95e8e344a Merge pull request #6359 from albfan/fix-log-example
fix log example
2024-03-09 21:39:50 +00:00
Sven Strickroth
6c7df67071 Consistently use libgit2.org
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2024-03-01 14:45:08 +01:00
Sven Strickroth
bd242a05e2 Fix broken links
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2024-02-24 14:35:10 +01: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
198a1b209a Merge pull request #5904 from pluehne/support-authentication-in-push-example
Support authentication in push example
2023-12-21 23:58:46 +00:00
Edward Thomson
156e08998c Merge pull request #6699 from libgit2/ethomson/bitfield
examples: use unsigned int for bitfields
2023-12-20 12:23:09 +00:00
Edward Thomson
f004096fff examples: use unsigned int for bitfields 2023-12-20 12:08:21 +00:00
Antonin Delpeuch
687da95ec8 blame example: Fix support for line range in CLI
The -L option announced by the CLI was ignored so far.
2023-09-23 12:00:19 +02:00
Edward Thomson
db2a794dda diff: parse patches with sha256 2023-04-10 14:21:16 +01:00
Edward Thomson
523f893f6f index: add sha256 support 2023-04-10 11:02:12 +01:00
Edward Thomson
fe2ee3a018 object: lookup sha256 objects
This is much of the plumbing for the object database to support SHA256,
and for objects to be able to parse SHA256 versions of themselves.
2023-02-12 22:02:00 +00:00
Alberto Fanjul
c97989e48d Add oneline option 2022-07-18 08:02:41 +02:00
Alberto Fanjul
6b86332465 parse arguments correctly 2022-07-18 07:57:21 +02:00
Alberto Fanjul
d9de12f88b fix log example 2022-07-17 23:52:22 +02:00
Edward Thomson
b43567d655 sha256: indirection for experimental functions
The experimental function signature is only available when
`GIT_EXPERIMENTAL_SHA256` is enabled.
2022-07-13 22:50:33 -04:00
Edward Thomson
3fbf580c91 oid: give oids a type
`git_oid`s now have a type, and we require the oid type when creating
the object id from creation functions.
2022-06-20 17:05:29 -04:00
Edward Thomson
0acaf3a8eb oid: define GIT_OID_SHA1_ZERO
Callers should not assume the layout of the oid structure; provide them
a macro that defines the null / zero sha1 object id.
2022-06-14 22:29:57 -04:00
Edward Thomson
dbc4ac1c76 oid: GIT_OID_*SZ is now GIT_OID_SHA1_*SIZE
In preparation for SHA256 support, `GIT_OID_RAWSZ` and `GIT_OID_HEXSZ`
need to indicate that they're the size of _SHA1_ OIDs.
2022-06-14 22:29:57 -04:00
Edward Thomson
91ba089663 cmake: rename git2internal target to libgit2
The `git2internal` target is actually the git library; call it such so
that IDE users have visibility into it.
2022-02-22 22:07:44 -05:00
Edward Thomson
5fcfada500 cmake: document CMakeLists.txt hierarchy 2022-02-22 22:07:44 -05:00
Ashok P. Nadkarni
aab7c0babc Free parent and ref in lg2_commit before returning. 2022-02-14 13:57:07 +05:30
apnadkarni
77ef1a6e14 Update common.h 2022-02-13 14:11:46 +05:30
Edward Thomson
d2458af7b7 indexer: use a byte array for checksum
The index's checksum is not an object ID, so we should not use the
`git_oid` type.  Use a byte array for checksum calculation and storage.

Deprecate the `git_indexer_hash` function.  Callers should use the new
`git_indexer_name` function which provides a unique packfile name.
2022-01-27 20:15:09 -05:00
Dimitris Apostolou
90df43022a Fix typos 2022-01-05 16:35:52 +02:00
Peter Pettersson
7dcc29fc46 Make enum in src,tests and examples C90 compliant by removing trailing comma. 2021-11-15 16:45:40 +01:00
Edward Thomson
395b3dc403 cmake: refactor global variables
Update the global variables `LIBGIT2_OBJECTS` to
`LIBGIT2_DEPENDENCY_OBJECTS` for clarity and consistency.
2021-11-14 07:25:41 -05:00
Edward Thomson
eabbee0454 example: declare print_usage function 2021-11-11 17:21:32 -05:00
Edward Thomson
8be226148f examples: remove unused function 2021-11-11 17:21:32 -05:00
Edward Thomson
52693ab44e cmake: stylistic refactoring
Ensure that we always use lowercase function names, and that we do not
have spaces preceding open parentheses, for consistency.
2021-10-18 08:30:14 -04:00
Edward Thomson
f0e693b18a str: introduce git_str for internal, git_buf is external
libgit2 has two distinct requirements that were previously solved by
`git_buf`.  We require:

1. A general purpose string class that provides a number of utility APIs
   for manipulating data (eg, concatenating, truncating, etc).
2. A structure that we can use to return strings to callers that they
   can take ownership of.

By using a single class (`git_buf`) for both of these purposes, we have
confused the API to the point that refactorings are difficult and
reasoning about correctness is also difficult.

Move the utility class `git_buf` to be called `git_str`: this represents
its general purpose, as an internal string buffer class.  The name also
is an homage to Junio Hamano ("gitstr").

The public API remains `git_buf`, and has a much smaller footprint.  It
is generally only used as an "out" param with strict requirements that
follow the documentation.  (Exceptions exist for some legacy APIs to
avoid breaking callers unnecessarily.)

Utility functions exist to convert a user-specified `git_buf` to a
`git_str` so that we can call internal functions, then converting it
back again.
2021-10-17 09:49:01 -04:00
Paymon MARANDI
581cfbda85 examples: Free the git_config and git_config_entry after use 2021-09-24 14:14:59 -04:00
Crayon
59af78a48f Fix typo in general.c 2021-07-28 01:58:32 -04:00
Patrick Lühne
7ed00c5c92 Support authentication in push example
This adds basic support for user/password and SSH authentication to the
push example. Authentication is implemented by using the cred_acquire_cb
credential callback defined in examples/common.c.

Co-authored-by: Marius Knaust <marius.knaust@gmail.com>
2021-06-02 16:36:17 +02:00
punkymaniac
8f52b0c553 Remove duplicate line, in example code 2021-03-17 10:48:17 +01:00
Aaron Franke
7efddeb737 Fix some typos 2021-02-15 16:01:25 -05:00
Edward Thomson
4732e03056 revspec: rename git_revparse_mode_t to git_revspec_t
The information about the type of a revision spec is not information
about the parser.  Name it accordingly, so that `git_revparse_mode_t`
is now `git_revspec_t`.  Deprecate the old name.
2021-01-31 16:36:31 +00:00
Patrick Steinhardt
939cb73fdf examples: log: fix documentation generation
Docurium seems to be confused by our use of `/** comment */;` use in the
log example. Let's just switch it around to help Docurium get this
right.
2020-06-08 15:43:34 +02:00
Edward Thomson
51eff5a58b strarray: we should dispose instead of free
We _dispose_ the contents of objects; we _free_ objects (and their
contents).  Update `git_strarray_free` to be `git_strarray_dispose`.
`git_strarray_free` remains as a deprecated proxy function.
2020-06-01 22:50:28 +01:00
Peter Salomonsen
dc2beb7e2d examples: additions and fixes
add example for git commit
fix example for git add
add example for git push
2020-04-02 18:39:37 +02:00
Edward Thomson
3f54ba8b61 credential: change git_cred to git_credential
We avoid abbreviations where possible; rename git_cred to
git_credential.

In addition, we have standardized on a trailing `_t` for enum types,
instead of using "type" in the name.  So `git_credtype_t` has become
`git_credential_t` and its members have become `GIT_CREDENTIAL` instead
of `GIT_CREDTYPE`.

Finally, the source and header files have been renamed to `credential`
instead of `cred`.

Keep previous name and values as deprecated, and include the new header
files from the previous ones.
2020-01-26 18:39:41 +00:00
Patrick Steinhardt
d2d01f7152 Merge pull request #5283 from pks-t/pks/example-checkout-remote-branch
examples: checkout: implement guess heuristic for remote branches
2019-12-13 11:49:37 +01:00
Patrick Steinhardt
dfea0713e0 Merge pull request #5272 from tiennou/examples/cli-ification
Various examples shape-ups
2019-11-28 13:51:40 +01:00
Edward Thomson
f94c9276bc example: use git_object_size_t for object size 2019-11-22 15:23:46 +11:00
Etienne Samson
fe42557a6f examples: buff up rev-list by adding OID support
This allows the example to be used as a quick revwalk test harness.
2019-11-06 11:17:56 +01:00
Etienne Samson
313908f9f5 examples: normalize decls and usage of options structs 2019-11-06 11:17:56 +01:00
Etienne Samson
4a4ad2bc83 examples: add comments to add.c 2019-11-06 11:17:55 +01:00
Etienne Samson
d4a593ef78 examples: modernize add code 2019-11-06 11:17:52 +01:00
Etienne Samson
c9a09b91c4 examples: extract argument conversion helper 2019-11-06 11:16:47 +01:00