Skip to content

pr-git-2388/anpl1623/master-v6

tagged this 09 Sep 01:24
From: Andrew Pleeter <andrewpleeter@gmail.com>

While 'git var' exposes GIT_AUTHOR_IDENT and GIT_COMMITTER_IDENT,
extracting individual components (name, email, or date) currently
requires callers to manually parse the composite string. Furthermore,
there is no way to query the resolved commit signing key through
'git var', and the command only accepts a single variable at a time.

Teach 'git var' to expose individual identity components and commit
signing configuration, and allow querying multiple variables with
optional NUL-termination:

- Add GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and GIT_AUTHOR_DATE.
- Add GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL, and GIT_COMMITTER_DATE.
- Add GIT_SIGNING_KEY to resolve the key that would be used to sign
  the resulting commit if you were to run 'git commit' right now.
- Allow passing multiple variable arguments (e.g., 'git var
  GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL') to output each variable
  sequentially.
- Support '-z' to terminate variable outputs with NUL bytes.
- Format 'git var -l -z' using the same convention as 'git config
  list -z' (newline separating key and value, NUL separating entries).
- Delimit values of multi-valued variables with NUL when '-z' is given,
  and output an extra delimiter after multi-valued variables when
  querying multiple variables to disambiguate the stream.
- When querying multiple variables, print an empty record for any
  variable that has no value and continue processing remaining variables.
- Use parse_options() to strictly require options before arguments.
- Update Documentation/git-var.adoc and t/t0007-git-var.sh.

Signed-off-by: Andrew Pleeter <andrewpleeter@gmail.com>

Submitted-As: https://lore.kernel.org/git/pull.2388.v6.git.git.1788917076554.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2388.git.git.1787690802942.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2388.v2.git.git.1788220746663.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2388.v3.git.git.1788403792962.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2388.v4.git.git.1788840593177.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2388.v5.git.git.1788900182711.gitgitgadget@gmail.com
Assets 2
Loading