From 12144e8f02094eaca371b5363db438b3c4691e18 Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Sun, 24 Oct 2021 18:28:59 +0200 Subject: http-backend: remove a duplicated code branch Try to make reading the computation of the gzipped flag a bit more natural. Signed-off-by: Robin Dupret Signed-off-by: Junio C Hamano --- http-backend.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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) -- cgit v1.3-6-g1900 From 47bfdfb3fd3b4752d2292a6744fae9abe37b8f1e Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Thu, 28 Oct 2021 17:46:19 +0200 Subject: pull: honor --no-verify and do not call the commit-msg hook The option was incorrectly auto-translated to "--no-verify-signatures", which causes the unexpected effect of the hook being called. And an even more unexpected effect of disabling verification of signatures. The manual page describes the option to behave same as the similarly named option of "git merge", which seems to be the original intention of this option in the "pull" command. Signed-off-by: Alexander Riesen Signed-off-by: Junio C Hamano --- builtin/pull.c | 6 ++++++ t/t5521-pull-options.sh | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/builtin/pull.c b/builtin/pull.c index b311ea6b9d..ab2af17f2a 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/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 -- cgit v1.3-6-g1900 From fa21296b58e5b2c865a3974e5f03b65f4026c510 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Fri, 29 Oct 2021 15:45:45 +0200 Subject: Document positive variant of commit and merge option "--no-verify" This documents "--verify" option of the commands. It can be used to re-enable the hooks disabled by an earlier "--no-verify" in command-line. Signed-off-by: Alexander Riesen Signed-off-by: Junio C Hamano --- Documentation/git-commit.txt | 5 +++-- Documentation/merge-options.txt | 5 +++-- t/t7504-commit-msg-hook.sh | 8 ++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) 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/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 && -- cgit v1.3-6-g1900 From 4b540cf913b8f528fadb9357530a34ea0dc09737 Mon Sep 17 00:00:00 2001 From: Victoria Dye Date: Thu, 4 Nov 2021 04:01:03 +0000 Subject: async_die_is_recursing: work around GCC v11.x issue on Fedora This fix corrects an issue found in the `dockerized(pedantic, fedora)` CI build, first appearing after the introduction of a new version of the Fedora docker image version. This image includes a version of `glibc` with the attribute `__attr_access_none` added to `pthread_setspecific` [1], the implementation of which only exists for GCC 11.X - the version included in the Fedora image. The attribute requires that the pointer provided in the second argument of `pthread_getspecific` must, if not NULL, be a pointer to a valid object. In the usage in `async_die_is_recursing`, `(void *)1` is not valid, causing the error. This fix imitates a workaround added in SELinux [2] by using the pointer to the static `async_die_counter` itself as the second argument to `pthread_setspecific`. This guaranteed non-NULL, valid pointer matches the intent of the current usage while not triggering the build error. [1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=a1561c3bbe8 [2] https://lore.kernel.org/all/20211021140519.6593-1-cgzones@googlemail.com/ Co-authored-by: Johannes Schindelin Signed-off-by: Victoria Dye Acked-by: Jeff King Signed-off-by: Junio C Hamano --- run-command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-command.c b/run-command.c index 87ddce02ef..a06c43b533 100644 --- a/run-command.c +++ b/run-command.c @@ -614,7 +614,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; } -- cgit v1.3-6-g1900 From 88d915a634b449147855041d44875322de2b286d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 4 Nov 2021 12:24:46 -0700 Subject: A few fixes before -rc2 Signed-off-by: Junio C Hamano --- Documentation/RelNotes/2.34.0.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/RelNotes/2.34.0.txt b/Documentation/RelNotes/2.34.0.txt index f6d5834c8d..7aa14f8632 100644 --- a/Documentation/RelNotes/2.34.0.txt +++ b/Documentation/RelNotes/2.34.0.txt @@ -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). -- cgit v1.3-6-g1900 From 7140c4988fba56367f07674f658bc56bbc8e593c Mon Sep 17 00:00:00 2001 From: Adam Dinwoodie Date: Fri, 5 Nov 2021 19:31:06 +0000 Subject: t/lib-git.sh: fix ACL-related permissions failure As well as checking that the relevant functionality is available, the GPGSSH prerequisite check creates the SSH keys that are used by the test functions it gates. If these keys are created in a directory that has a default Access Control List, the key files can inherit those permissions. This can result in a scenario where the private keys are created successfully, so the prerequisite check passes and the tests are run, but the key files have permissions that are too permissive, meaning OpenSSH will refuse to load them and the tests will fail. To avoid this happening, before creating the keys, clear any default ACL set on the directory that will contain them. This step allowed to fail; if setfacl isn't present, that's a very likely indicator that the filesystem in question simply doesn't support default ACLs. Helped-by: Fabian Stelzer Signed-off-by: Adam Dinwoodie Signed-off-by: Junio C Hamano --- t/lib-gpg.sh | 1 + 1 file changed, 1 insertion(+) 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 && -- cgit v1.3-6-g1900 From 06a199f38b50ccea198c29216c69bb389ca23391 Mon Sep 17 00:00:00 2001 From: Ævar Arnfjörð Bjarmason Date: Tue, 9 Nov 2021 12:04:43 +0100 Subject: parse-options.[ch]: revert use of "enum" for parse_options() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert the parse_options() prototype change in my recent 352e761388b (parse-options.[ch]: consistently use "enum parse_opt_result", 2021-10-08) was incorrect. The parse_options() function returns the number of argc elements that haven't been processed, not "enum parse_opt_result". Reported-by: SZEDER Gábor Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- parse-options.c | 10 +++++----- parse-options.h | 9 ++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/parse-options.c b/parse-options.c index 2a2c0ee24f..e7885844be 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 dd79c9c566..ce2c0df37b 100644 --- a/parse-options.h +++ b/parse-options.h @@ -211,11 +211,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); -- cgit v1.3-6-g1900 From 6c220937e2b26d85920bf2d38ff2464a0d57fd6b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 9 Nov 2021 13:19:51 -0800 Subject: Git 2.34-rc2 Signed-off-by: Junio C Hamano --- Documentation/RelNotes/2.34.0.txt | 2 +- GIT-VERSION-GEN | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/RelNotes/2.34.0.txt b/Documentation/RelNotes/2.34.0.txt index 7aa14f8632..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 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=' ' -- cgit v1.3-6-g1900