tests/describe/describe_helpers.c


Log

Author Commit Date CI Message
Edward Thomson f0e693b1 2021-09-07T17:53:49 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.
Patrick Steinhardt de70bb46 2019-06-13T15:27:22 global: convert trivial `fnmatch` users to use `wildcard` Upstream git.git has converted its codebase to use wildcard in favor of fnmatch in commit 70a8fc999d (stop using fnmatch (either native or compat), 2014-02-15). To keep our own regex-matching in line with what git does, convert all trivial instances of `fnmatch` usage to use `wildcard`, instead. Trivial usage is defined to be use of `fnmatch` with either no flags or flags that have a 1:1 equivalent in wildmatch (PATHNAME, IGNORECASE).
Patrick Steinhardt 451df793 2019-06-13T15:20:23 posix: remove implicit include of "fnmatch.h" We're about to phase out our bundled fnmatch implementation as git.git has moved to wildmatch long ago in 2014. To make it easier to spot which files are stilll using fnmatch, remove the implicit "fnmatch.h" include in "posix.h" and instead include it explicitly.
Patrick Steinhardt ecf4f33a 2018-02-08T11:14:48 Convert usage of `git_buf_free` to new `git_buf_dispose`
Russell Belfer 85fe63bc 2014-10-10T15:17:27 Don't use cl_git_pass for POSIX functions If there is a failure then cl_git_pass tries to get the libgit2 error, but p_... functions don't set that. Also - trailing whitespace cleanup.
Carlos Martín Nieto 25345c0c 2014-09-30T09:18:22 describe: rename git_describe_opts to git_describe_options And implement the option init functions for this and the format options.
Carlos Martín Nieto 5431c46a 2014-09-30T09:04:04 describe: use globs in the tests This makes us be closer to git's tests, and lets us better describe what we expect from the output.
Carlos Martín Nieto fd8126e4 2014-09-30T08:54:52 describe: implement describing the workdir When we describe the workdir, we perform a describe on HEAD and then check to see if the worktree is dirty. If it is and we have a suffix string, we append that to the buffer.
Carlos Martín Nieto 3b6534b8 2014-09-30T07:19:14 describe: split into gather and format steps Instead of printing out to the buffer inside the information-gathering phase, write the data to a intermediate result structure. This allows us to split the options into gathering options and formatting options, simplifying the gathering code.
Carlos Martín Nieto 1f501a08 2014-09-30T04:58:02 describe: rename _object() to _commit() We don't describe arbitrary object, so let's give it the name of the one object type we accept.
nulltoken 3a728fb5 2012-11-13T16:35:24 object: introduce git_describe_object()