summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Jiang Xin <worldhello.net@gmail.com>2021-11-10 08:55:14 +0800
committerLibravatar Jiang Xin <worldhello.net@gmail.com>2021-11-10 08:55:14 +0800
commit3a6160031b54c2e1174b1f990c7393ef8cb39d3d (patch)
tree9410f60fd52d173303d6faf718f0fa3f579617e8
parentl10n: pl: 2.34.0 round 2 (diff)
parentGit 2.34-rc2 (diff)
downloadtgif-3a6160031b54c2e1174b1f990c7393ef8cb39d3d.tar.xz
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
-rw-r--r--Documentation/RelNotes/2.34.0.txt9
-rw-r--r--Documentation/git-commit.txt5
-rw-r--r--Documentation/merge-options.txt5
-rwxr-xr-xGIT-VERSION-GEN2
-rw-r--r--builtin/pull.c6
-rw-r--r--http-backend.c4
-rw-r--r--parse-options.c10
-rw-r--r--parse-options.h9
-rw-r--r--run-command.c2
-rw-r--r--t/lib-gpg.sh1
-rwxr-xr-xt/t5521-pull-options.sh24
-rwxr-xr-xt/t7504-commit-msg-hook.sh8
12 files changed, 65 insertions, 20 deletions
diff --git a/Documentation/RelNotes/2.34.0.txt b/Documentation/RelNotes/2.34.0.txt
index f6d5834c8d..effab2ea4b 100644
--- a/Documentation/RelNotes/2.34.0.txt
+++ b/Documentation/RelNotes/2.34.0.txt
@@ -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).
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 95fec5f069..6c60bf98f9 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -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::
diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt
index 61ec157c2f..d8f7cd7ca0 100644
--- a/Documentation/merge-options.txt
+++ b/Documentation/merge-options.txt
@@ -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.
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index b2e79e0890..3e1915546c 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
-DEF_VER=v2.34.0-rc1
+DEF_VER=v2.34.0-rc2
LF='
'
diff --git a/builtin/pull.c b/builtin/pull.c
index ae9f5bd7cc..efe4f4a81f 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -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);
diff --git a/http-backend.c b/http-backend.c
index e7c0eeab23..3d6e2ff17f 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -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)
diff --git a/parse-options.c b/parse-options.c
index 9a0484c883..fc5b43ff0b 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -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;
diff --git a/parse-options.h b/parse-options.h
index bdea052c39..275fb44081 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -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);
diff --git a/run-command.c b/run-command.c
index 7ef5cc712a..f40df01c77 100644
--- a/run-command.c
+++ b/run-command.c
@@ -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;
}
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index f99ef3e859..1d8e5b5b7e 100644
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -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 &&
diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh
index 7601c919fd..66cfcb09c5 100755
--- a/t/t5521-pull-options.sh
+++ b/t/t5521-pull-options.sh
@@ -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
diff --git a/t/t7504-commit-msg-hook.sh b/t/t7504-commit-msg-hook.sh
index 4e7592522a..bba58f0480 100755
--- a/t/t7504-commit-msg-hook.sh
+++ b/t/t7504-commit-msg-hook.sh
@@ -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 &&