Merge branch 'master' of github.com:git/git

* 'master' of github.com:git/git:
  Git 2.34-rc2
  parse-options.[ch]: revert use of "enum" for parse_options()
  t/lib-git.sh: fix ACL-related permissions failure
  A few fixes before -rc2
  async_die_is_recursing: work around GCC v11.x issue on Fedora
  Document positive variant of commit and merge option "--no-verify"
  pull: honor --no-verify and do not call the commit-msg hook
  http-backend: remove a duplicated code branch
This commit is contained in:
Jiang Xin 2021-11-10 08:55:14 +08:00
commit 3a6160031b
12 changed files with 65 additions and 20 deletions

View File

@ -383,7 +383,7 @@ Fixes since v2.33
compression level for both zip and tar.gz format.
(merge c4b208c309 bs/archive-doc-compression-level later to maint).
* Drop "git sparse-index" from the list of common commands.
* Drop "git sparse-checkout" from the list of common commands.
(merge 6a9a50a8af sg/sparse-index-not-that-common-a-command later to maint).
* "git branch -c/-m new old" was not described to copy config, which
@ -401,6 +401,13 @@ Fixes since v2.33
object replacement.
(merge 095d112f8c ab/ignore-replace-while-working-on-commit-graph later to maint).
* "git pull --no-verify" did not affect the underlying "git merge".
(merge 47bfdfb3fd ar/fix-git-pull-no-verify later to maint).
* One CI task based on Fedora image noticed a not-quite-kosher
consturct recently, which has been corrected.
(merge 4b540cf913 vd/pthread-setspecific-g11-fix later to maint).
* Other code cleanup, docfix, build fix, etc.
(merge f188160be9 ab/bundle-remove-verbose-option later to maint).
(merge 8c6b4332b4 rs/close-pack-leakfix later to maint).

View File

@ -212,8 +212,9 @@ include::signoff-option.txt[]
each trailer would appear, and other details.
-n::
--no-verify::
This option bypasses the pre-commit and commit-msg hooks.
--[no-]verify::
By default, the pre-commit and commit-msg hooks are run.
When any of `--no-verify` or `-n` is given, these are bypassed.
See also linkgit:githooks[5].
--allow-empty::

View File

@ -132,8 +132,9 @@ ifdef::git-pull[]
Only useful when merging.
endif::git-pull[]
--no-verify::
This option bypasses the pre-merge and commit-msg hooks.
--[no-]verify::
By default, the pre-merge and commit-msg hooks are run.
When `--no-verify` is given, these are bypassed.
See also linkgit:githooks[5].
ifdef::git-pull[]
Only useful when merging.

View File

@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
DEF_VER=v2.34.0-rc1
DEF_VER=v2.34.0-rc2
LF='
'

View File

@ -84,6 +84,7 @@ static char *opt_edit;
static char *cleanup_arg;
static char *opt_ff;
static char *opt_verify_signatures;
static char *opt_verify;
static int opt_autostash = -1;
static int config_autostash;
static int check_trust_level = 1;
@ -160,6 +161,9 @@ static struct option pull_options[] = {
OPT_PASSTHRU(0, "ff-only", &opt_ff, NULL,
N_("abort if fast-forward is not possible"),
PARSE_OPT_NOARG | PARSE_OPT_NONEG),
OPT_PASSTHRU(0, "verify", &opt_verify, NULL,
N_("control use of pre-merge-commit and commit-msg hooks"),
PARSE_OPT_NOARG),
OPT_PASSTHRU(0, "verify-signatures", &opt_verify_signatures, NULL,
N_("verify that the named commit has a valid GPG signature"),
PARSE_OPT_NOARG),
@ -675,6 +679,8 @@ static int run_merge(void)
strvec_pushf(&args, "--cleanup=%s", cleanup_arg);
if (opt_ff)
strvec_push(&args, opt_ff);
if (opt_verify)
strvec_push(&args, opt_verify);
if (opt_verify_signatures)
strvec_push(&args, opt_verify_signatures);
strvec_pushv(&args, opt_strategies.v);

View File

@ -466,9 +466,7 @@ static void run_service(const char **argv, int buffer_input)
struct child_process cld = CHILD_PROCESS_INIT;
ssize_t req_len = get_content_length();
if (encoding && !strcmp(encoding, "gzip"))
gzipped_request = 1;
else if (encoding && !strcmp(encoding, "x-gzip"))
if (encoding && (!strcmp(encoding, "gzip") || !strcmp(encoding, "x-gzip")))
gzipped_request = 1;
if (!user || !*user)

View File

@ -860,11 +860,11 @@ int parse_options_end(struct parse_opt_ctx_t *ctx)
return ctx->cpidx + ctx->argc;
}
enum parse_opt_result parse_options(int argc, const char **argv,
const char *prefix,
const struct option *options,
const char * const usagestr[],
enum parse_opt_flags flags)
int parse_options(int argc, const char **argv,
const char *prefix,
const struct option *options,
const char * const usagestr[],
enum parse_opt_flags flags)
{
struct parse_opt_ctx_t ctx;
struct option *real_options;

View File

@ -213,11 +213,10 @@ struct option {
* untouched and parse_options() returns the number of options
* processed.
*/
enum parse_opt_result parse_options(int argc, const char **argv,
const char *prefix,
const struct option *options,
const char * const usagestr[],
enum parse_opt_flags flags);
int parse_options(int argc, const char **argv, const char *prefix,
const struct option *options,
const char * const usagestr[],
enum parse_opt_flags flags);
NORETURN void usage_with_options(const char * const *usagestr,
const struct option *options);

View File

@ -1099,7 +1099,7 @@ static NORETURN void die_async(const char *err, va_list params)
static int async_die_is_recursing(void)
{
void *ret = pthread_getspecific(async_die_counter);
pthread_setspecific(async_die_counter, (void *)1);
pthread_setspecific(async_die_counter, &async_die_counter); /* set to any non-NULL valid pointer */
return ret != NULL;
}

View File

@ -106,6 +106,7 @@ test_lazy_prereq GPGSSH '
test $? = 0 || exit 1;
mkdir -p "${GNUPGHOME}" &&
chmod 0700 "${GNUPGHOME}" &&
(setfacl -k "${GNUPGHOME}" 2>/dev/null || true) &&
ssh-keygen -t ed25519 -N "" -C "git ed25519 key" -f "${GPGSSH_KEY_PRIMARY}" >/dev/null &&
echo "\"principal with number 1\" $(cat "${GPGSSH_KEY_PRIMARY}.pub")" >> "${GPGSSH_ALLOWED_SIGNERS}" &&
ssh-keygen -t rsa -b 2048 -N "" -C "git rsa2048 key" -f "${GPGSSH_KEY_SECONDARY}" >/dev/null &&

View File

@ -228,4 +228,28 @@ test_expect_success 'git pull --no-signoff flag cancels --signoff flag' '
test_must_be_empty actual
'
test_expect_success 'git pull --no-verify flag passed to merge' '
test_when_finished "rm -fr src dst actual" &&
git init src &&
test_commit -C src one &&
git clone src dst &&
write_script dst/.git/hooks/commit-msg <<-\EOF &&
false
EOF
test_commit -C src two &&
git -C dst pull --no-ff --no-verify
'
test_expect_success 'git pull --no-verify --verify passed to merge' '
test_when_finished "rm -fr src dst actual" &&
git init src &&
test_commit -C src one &&
git clone src dst &&
write_script dst/.git/hooks/commit-msg <<-\EOF &&
false
EOF
test_commit -C src two &&
test_must_fail git -C dst pull --no-ff --no-verify --verify
'
test_done

View File

@ -133,6 +133,14 @@ test_expect_success '--no-verify with failing hook' '
'
test_expect_success '-n followed by --verify with failing hook' '
echo "even more" >> file &&
git add file &&
test_must_fail git commit -n --verify -m "even more"
'
test_expect_success '--no-verify with failing hook (editor)' '
echo "more stuff" >> file &&