summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiang Xin <worldhello.net@gmail.com>2022-06-18 14:02:07 +0800
committerJiang Xin <worldhello.net@gmail.com>2022-06-18 14:02:07 +0800
commit74e34a0ee2920c7f8f57e36c7346495b6dd6b9f2 (patch)
tree4f144ffbcc8eb151431f5ff155a8d24acd8b46fc
parent2b288c472487ff82734244ec6db632e41d1e73fb (diff)
parent5b71c59bc3b9365075e2a175aa7b6f2b0c84ce44 (diff)
downloadgit-74e34a0ee2920c7f8f57e36c7346495b6dd6b9f2.tar.xz
Merge branch 'master' of github.com:git/git
* 'master' of github.com:git/git: (22 commits) Git 2.37-rc1 git-compat-util: allow root to access both SUDO_UID and root owned i18n: fix mismatched camelCase config variables Another batch of fixes before -rc1 bug_fl(): correctly initialize trace2 va_list relative_url(): fix incorrect condition pack-mtimes: avoid closing a bogus file descriptor read_index_from(): avoid memory leak submodule--helper: avoid memory leak when fetching submodules submodule-config: avoid memory leak fsmonitor: avoid memory leak in `fsm_settings__get_incompatible_msg()` cache-tree: remove cache_tree_find_path() pack-write: drop always-NULL parameter t5329: test 'git gc --cruft' without '--prune=now' t2107: test 'git update-index --verbose' perf-lib: fix missing test titles in output transfer doc: move fetch.credentialsInUrl to "transfer" config namespace fetch doc: note "pushurl" caveat about "credentialsInUrl", elaborate ci(github): also mark up compile errors ci(github): use grouping also in the `win-build` job ...
-rw-r--r--.github/workflows/main.yml16
-rw-r--r--Documentation/RelNotes/2.37.0.txt14
-rw-r--r--Documentation/config/fetch.txt14
-rw-r--r--Documentation/config/http.txt2
-rw-r--r--Documentation/config/safe.txt7
-rw-r--r--Documentation/config/transfer.txt38
-rwxr-xr-xGIT-VERSION-GEN2
-rw-r--r--builtin/fast-import.c2
-rw-r--r--builtin/gc.c2
-rw-r--r--builtin/index-pack.c2
-rw-r--r--builtin/pack-objects.c2
-rw-r--r--builtin/repack.c2
-rw-r--r--builtin/submodule--helper.c1
-rw-r--r--cache-tree.c27
-rw-r--r--cache-tree.h2
-rwxr-xr-xci/lib.sh13
-rwxr-xr-xci/make-test-artifacts.sh2
-rw-r--r--commit.c2
-rw-r--r--contrib/coccinelle/object_id.cocci12
-rw-r--r--fsmonitor-settings.c8
-rw-r--r--git-compat-util.h7
-rw-r--r--gpg-interface.c2
-rw-r--r--http.c2
-rw-r--r--pack-mtimes.c3
-rw-r--r--pack-write.c17
-rw-r--r--read-cache.c6
-rw-r--r--remote.c6
-rw-r--r--submodule-config.c10
-rw-r--r--t/helper/test-trace2.c4
-rw-r--r--t/perf/perf-lib.sh2
-rwxr-xr-xt/t0034-root-safe-directory.sh15
-rwxr-xr-xt/t2107-update-index-basic.sh31
-rwxr-xr-xt/t5329-pack-objects-cruft.sh4
-rwxr-xr-xt/t5516-fetch-push.sh14
-rwxr-xr-xt/t5601-clone.sh10
-rw-r--r--usage.c8
36 files changed, 169 insertions, 142 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 3fa88b78b6..cd1f52692a 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -119,6 +119,10 @@ jobs:
- name: test
shell: bash
run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
+ - name: print test failures
+ if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+ shell: bash
+ run: ci/print-test-failures.sh
- name: Upload failed tests' directories
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
uses: actions/upload-artifact@v2
@@ -200,6 +204,10 @@ jobs:
env:
NO_SVN_TESTS: 1
run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
+ - name: print test failures
+ if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+ shell: bash
+ run: ci/print-test-failures.sh
- name: Upload failed tests' directories
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
uses: actions/upload-artifact@v2
@@ -253,6 +261,10 @@ jobs:
- uses: actions/checkout@v2
- run: ci/install-dependencies.sh
- run: ci/run-build-and-tests.sh
+ - name: print test failures
+ if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+ shell: bash
+ run: ci/print-test-failures.sh
- name: Upload failed tests' directories
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
uses: actions/upload-artifact@v2
@@ -282,6 +294,10 @@ jobs:
- uses: actions/checkout@v1
- run: ci/install-docker-dependencies.sh
- run: ci/run-build-and-tests.sh
+ - name: print test failures
+ if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+ shell: bash
+ run: ci/print-test-failures.sh
- name: Upload failed tests' directories
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
uses: actions/upload-artifact@v1
diff --git a/Documentation/RelNotes/2.37.0.txt b/Documentation/RelNotes/2.37.0.txt
index e491a4b7ba..99dc7e32f8 100644
--- a/Documentation/RelNotes/2.37.0.txt
+++ b/Documentation/RelNotes/2.37.0.txt
@@ -54,8 +54,10 @@ UI, Workflows & Features
* Update the doctype written in gitweb output to xhtml5.
- * The "fetch.credentialsInUrl" configuration variable controls what
- happens when a URL with embedded login credential is used.
+ * The "transfer.credentialsInURL" configuration variable controls what
+ happens when a URL with embedded login credential is used on either
+ "fetch" or "push". Credentials are currently only detected in
+ `remote.<name>.url` config, not `remote.<name>.pushurl`.
* "git revert" learns "--reference" option to use more human-readable
reference to the commit it reverts in the message template it
@@ -232,9 +234,8 @@ Fixes since v2.36
* With a recent update to refuse access to repositories of other
people by default, "sudo make install" and "sudo git describe"
- stopped working. This series intends to loosen it while keeping
- the safety.
- (merge b9063afda1 cb/path-owner-check-with-sudo later to maint).
+ stopped working, which has been corrected.
+ (merge 6b11e3d52e cb/path-owner-check-with-sudo-plus later to maint).
* The tests that ensured merges stop when interfering local changes
are present did not make sure that local changes are preserved; now
@@ -307,6 +308,9 @@ Fixes since v2.36
* Use-after-free (with another forget-to-free) fix.
(merge 323822c72b ab/remote-free-fix later to maint).
+ * Remove a coccinelle rule that is no longer relevant.
+ (merge b1299de4a1 jc/cocci-cleanup later to maint).
+
* Other code cleanup, docfix, build fix, etc.
(merge e6b2582da3 cm/reftable-0-length-memset later to maint).
(merge 0b75e5bf22 ab/misc-cleanup later to maint).
diff --git a/Documentation/config/fetch.txt b/Documentation/config/fetch.txt
index 0db7fe85bb..cd65d236b4 100644
--- a/Documentation/config/fetch.txt
+++ b/Documentation/config/fetch.txt
@@ -96,17 +96,3 @@ fetch.writeCommitGraph::
merge and the write may take longer. Having an updated commit-graph
file helps performance of many Git commands, including `git merge-base`,
`git push -f`, and `git log --graph`. Defaults to false.
-
-fetch.credentialsInUrl::
- A URL can contain plaintext credentials in the form
- `<protocol>://<user>:<password>@<domain>/<path>`. Using such URLs
- is not recommended as it exposes the password in multiple ways,
- including Git storing the URL as plaintext in the repository config.
- The `fetch.credentialsInUrl` option provides instruction for how Git
- should react to seeing such a URL, with these values:
-+
-* `allow` (default): Git will proceed with its activity without warning.
-* `warn`: Git will write a warning message to `stderr` when parsing a URL
- with a plaintext credential.
-* `die`: Git will write a failure message to `stderr` when parsing a URL
- with a plaintext credential.
diff --git a/Documentation/config/http.txt b/Documentation/config/http.txt
index 179d03e57b..afeeccfbfa 100644
--- a/Documentation/config/http.txt
+++ b/Documentation/config/http.txt
@@ -203,7 +203,7 @@ http.schannelUseSSLCAInfo::
when the `schannel` backend was configured via `http.sslBackend`,
unless `http.schannelUseSSLCAInfo` overrides this behavior.
-http.pinnedpubkey::
+http.pinnedPubkey::
Public key of the https service. It may either be the filename of
a PEM or DER encoded public key file or a string starting with
'sha256//' followed by the base64 encoded sha256 hash of the
diff --git a/Documentation/config/safe.txt b/Documentation/config/safe.txt
index 1ee10fae14..fa02f3ccc5 100644
--- a/Documentation/config/safe.txt
+++ b/Documentation/config/safe.txt
@@ -30,12 +30,13 @@ that you deem safe.
As explained, Git only allows you to access repositories owned by
yourself, i.e. the user who is running Git, by default. When Git
is running as 'root' in a non Windows platform that provides sudo,
- however, git checks the SUDO_UID environment variable that sudo creates
-and will allow access to the uid recorded as its value instead.
+however, git checks the SUDO_UID environment variable that sudo creates
+and will allow access to the uid recorded as its value in addition to
+the id from 'root'.
This is to make it easy to perform a common sequence during installation
"make && sudo make install". A git process running under 'sudo' runs as
'root' but the 'sudo' command exports the environment variable to record
which id the original user has.
If that is not what you would prefer and want git to only trust
-repositories that are owned by root instead, then you must remove
+repositories that are owned by root instead, then you can remove
the `SUDO_UID` variable from root's environment before invoking git.
diff --git a/Documentation/config/transfer.txt b/Documentation/config/transfer.txt
index b49429eb4d..b4475c0690 100644
--- a/Documentation/config/transfer.txt
+++ b/Documentation/config/transfer.txt
@@ -1,3 +1,41 @@
+transfer.credentialsInUrl::
+ A configured URL can contain plaintext credentials in the form
+ `<protocol>://<user>:<password>@<domain>/<path>`. You may want
+ to warn or forbid the use of such configuration (in favor of
+ using linkgit:git-credential[1]). This will be used on
+ linkgit:git-clone[1], linkgit:git-fetch[1], linkgit:git-push[1],
+ and any other direct use of the configured URL.
++
+Note that this is currently limited to detecting credentials in
+`remote.<name>.url` configuration, it won't detect credentials in
+`remote.<name>.pushurl` configuration.
++
+You might want to enable this to prevent inadvertent credentials
+exposure, e.g. because:
++
+* The OS or system where you're running git may not provide way way or
+ otherwise allow you to configure the permissions of the
+ configuration file where the username and/or password are stored.
+* Even if it does, having such data stored "at rest" might expose you
+ in other ways, e.g. a backup process might copy the data to another
+ system.
+* The git programs will pass the full URL to one another as arguments
+ on the command-line, meaning the credentials will be exposed to oher
+ users on OS's or systems that allow other users to see the full
+ process list of other users. On linux the "hidepid" setting
+ documented in procfs(5) allows for configuring this behavior.
++
+If such concerns don't apply to you then you probably don't need to be
+concerned about credentials exposure due to storing that sensitive
+data in git's configuration files. If you do want to use this, set
+`transfer.credentialsInUrl` to one of these values:
++
+* `allow` (default): Git will proceed with its activity without warning.
+* `warn`: Git will write a warning message to `stderr` when parsing a URL
+ with a plaintext credential.
+* `die`: Git will write a failure message to `stderr` when parsing a URL
+ with a plaintext credential.
+
transfer.fsckObjects::
When `fetch.fsckObjects` or `receive.fsckObjects` are
not set, the value of this variable is used instead.
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 1d667699e1..22e76c2a59 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
-DEF_VER=v2.36.GIT
+DEF_VER=v2.37.0-rc1
LF='
'
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 28d3193c38..14113cfd82 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -3465,7 +3465,7 @@ static void git_pack_config(void)
pack_idx_opts.version = indexversion_value;
if (pack_idx_opts.version > 2)
git_die_config("pack.indexversion",
- "bad pack.indexversion=%"PRIu32, pack_idx_opts.version);
+ "bad pack.indexVersion=%"PRIu32, pack_idx_opts.version);
}
if (!git_config_get_ulong("pack.packsizelimit", &packsizelimit_value))
max_packsize = packsizelimit_value;
diff --git a/builtin/gc.c b/builtin/gc.c
index 4ea70089c9..021e9256ae 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -581,7 +581,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
/* default expiry time, overwritten in gc_config */
gc_config();
if (parse_expiry_date(gc_log_expire, &gc_log_expire_time))
- die(_("failed to parse gc.logexpiry value %s"), gc_log_expire);
+ die(_("failed to parse gc.logExpiry value %s"), gc_log_expire);
if (pack_refs < 0)
pack_refs = !is_bare_repository();
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 3e385b4800..6648f2daef 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1575,7 +1575,7 @@ static int git_index_pack_config(const char *k, const char *v, void *cb)
if (!strcmp(k, "pack.indexversion")) {
opts->version = git_config_int(k, v);
if (opts->version > 2)
- die(_("bad pack.indexversion=%"PRIu32), opts->version);
+ die(_("bad pack.indexVersion=%"PRIu32), opts->version);
return 0;
}
if (!strcmp(k, "pack.threads")) {
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index cc5f41086d..39e28cfcaf 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -3170,7 +3170,7 @@ static int git_pack_config(const char *k, const char *v, void *cb)
if (!strcmp(k, "pack.indexversion")) {
pack_idx_opts.version = git_config_int(k, v);
if (pack_idx_opts.version > 2)
- die(_("bad pack.indexversion=%"PRIu32),
+ die(_("bad pack.indexVersion=%"PRIu32),
pack_idx_opts.version);
return 0;
}
diff --git a/builtin/repack.c b/builtin/repack.c
index c957b2959f..4a7ae4cf48 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -41,7 +41,7 @@ static const char *const git_repack_usage[] = {
static const char incremental_bitmap_conflict_error[] = N_(
"Incremental repacks are incompatible with bitmap indexes. Use\n"
-"--no-write-bitmap-index or disable the pack.writebitmaps configuration."
+"--no-write-bitmap-index or disable the pack.writeBitmaps configuration."
);
struct pack_objects_args {
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 5c77dfcffe..c597df7528 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2208,6 +2208,7 @@ static int fetch_in_submodule(const char *module_path, int depth, int quiet, str
char *hex = oid_to_hex(oid);
char *remote = get_default_remote();
strvec_pushl(&cp.args, remote, hex, NULL);
+ free(remote);
}
return run_command(&cp);
diff --git a/cache-tree.c b/cache-tree.c
index ff794d940f..56db0b5026 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -101,33 +101,6 @@ struct cache_tree_sub *cache_tree_sub(struct cache_tree *it, const char *path)
return find_subtree(it, path, pathlen, 1);
}
-struct cache_tree *cache_tree_find_path(struct cache_tree *it, const char *path)
-{
- const char *slash;
- int namelen;
- struct cache_tree_sub it_sub = {
- .cache_tree = it,
- };
- struct cache_tree_sub *down = &it_sub;
-
- while (down) {
- slash = strchrnul(path, '/');
- namelen = slash - path;
- down->cache_tree->entry_count = -1;
- if (!*slash) {
- int pos;
- pos = cache_tree_subtree_pos(down->cache_tree, path, namelen);
- if (0 <= pos)
- return down->cache_tree->down[pos]->cache_tree;
- return NULL;
- }
- down = find_subtree(it, path, namelen, 0);
- path = slash + 1;
- }
-
- return NULL;
-}
-
static int do_invalidate_path(struct cache_tree *it, const char *path)
{
/* a/b/c
diff --git a/cache-tree.h b/cache-tree.h
index f75f8e74dc..8efeccebfc 100644
--- a/cache-tree.h
+++ b/cache-tree.h
@@ -29,8 +29,6 @@ struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *);
int cache_tree_subtree_pos(struct cache_tree *it, const char *path, int pathlen);
-struct cache_tree *cache_tree_find_path(struct cache_tree *it, const char *path);
-
void cache_tree_write(struct strbuf *, struct cache_tree *root);
struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
diff --git a/ci/lib.sh b/ci/lib.sh
index 2f6d9d26e4..f095519f8d 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -29,8 +29,14 @@ else
set +x
begin_group "$1"
shift
- "$@"
- res=$?
+ # work around `dash` not supporting `set -o pipefail`
+ (
+ "$@" 2>&1
+ echo $? >exit.status
+ ) |
+ sed 's/^\(\([^ ]*\):\([0-9]*\):\([0-9]*:\) \)\(error\|warning\): /::\5 file=\2,line=\3::\1/'
+ res=$(cat exit.status)
+ rm exit.status
end_group
return $res
}
@@ -177,7 +183,8 @@ then
test_name="${test_exit%.exit}"
test_name="${test_name##*/}"
printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
- echo "The full logs are in the artifacts attached to this run."
+ echo "The full logs are in the 'print test failures' step below."
+ echo "See also the 'failed-tests-*' artifacts attached to this run."
cat "t/test-results/$test_name.markup"
trash_dir="t/trash directory.$test_name"
diff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh
index 646967481f..74141af0cc 100755
--- a/ci/make-test-artifacts.sh
+++ b/ci/make-test-artifacts.sh
@@ -7,6 +7,6 @@ mkdir -p "$1" # in case ci/lib.sh decides to quit early
. ${0%/*}/lib.sh
-make artifacts-tar ARTIFACTS_DIRECTORY="$1"
+group Build make artifacts-tar ARTIFACTS_DIRECTORY="$1"
check_unignored_build_artifacts
diff --git a/commit.c b/commit.c
index 73865fee15..1fb1b2ea90 100644
--- a/commit.c
+++ b/commit.c
@@ -1526,7 +1526,7 @@ static int verify_utf8(struct strbuf *buf)
static const char commit_utf8_warn[] =
N_("Warning: commit message did not conform to UTF-8.\n"
"You may want to amend it after fixing the message, or set the config\n"
- "variable i18n.commitencoding to the encoding your project uses.\n");
+ "variable i18n.commitEncoding to the encoding your project uses.\n");
int commit_tree_extended(const char *msg, size_t msg_len,
const struct object_id *tree,
diff --git a/contrib/coccinelle/object_id.cocci b/contrib/coccinelle/object_id.cocci
index ddf4f22bd7..01f8d6935b 100644
--- a/contrib/coccinelle/object_id.cocci
+++ b/contrib/coccinelle/object_id.cocci
@@ -1,18 +1,6 @@
@@
struct object_id OID;
@@
-- is_null_sha1(OID.hash)
-+ is_null_oid(&OID)
-
-@@
-struct object_id *OIDPTR;
-@@
-- is_null_sha1(OIDPTR->hash)
-+ is_null_oid(OIDPTR)
-
-@@
-struct object_id OID;
-@@
- hashclr(OID.hash)
+ oidclr(&OID)
diff --git a/fsmonitor-settings.c b/fsmonitor-settings.c
index 658cb79da0..464424a1e9 100644
--- a/fsmonitor-settings.c
+++ b/fsmonitor-settings.c
@@ -202,11 +202,15 @@ char *fsm_settings__get_incompatible_msg(const struct repository *r,
case FSMONITOR_REASON_OK:
goto done;
- case FSMONITOR_REASON_BARE:
+ case FSMONITOR_REASON_BARE: {
+ char *cwd = xgetcwd();
+
strbuf_addf(&msg,
_("bare repository '%s' is incompatible with fsmonitor"),
- xgetcwd());
+ cwd);
+ free(cwd);
goto done;
+ }
case FSMONITOR_REASON_ERROR:
strbuf_addf(&msg,
diff --git a/git-compat-util.h b/git-compat-util.h
index fd36d3bfdc..58d7708296 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -497,7 +497,12 @@ static inline int is_path_owned_by_current_uid(const char *path)
euid = geteuid();
if (euid == ROOT_UID)
- extract_id_from_env("SUDO_UID", &euid);
+ {
+ if (st.st_uid == ROOT_UID)
+ return 1;
+ else
+ extract_id_from_env("SUDO_UID", &euid);
+ }
return st.st_uid == euid;
}
diff --git a/gpg-interface.c b/gpg-interface.c
index 280f1fa1a5..947b58ad4d 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -985,7 +985,7 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature,
if (!signing_key || signing_key[0] == '\0')
return error(
- _("user.signingkey needs to be set for ssh signing"));
+ _("user.signingKey needs to be set for ssh signing"));
if (is_literal_ssh_key(signing_key, &literal_key)) {
/* A literal ssh key */
diff --git a/http.c b/http.c
index 11c6f69fac..168ca30c55 100644
--- a/http.c
+++ b/http.c
@@ -349,7 +349,7 @@ static int http_options(const char *var, const char *value, void *cb)
if (!strcmp("http.postbuffer", var)) {
http_post_buffer = git_config_ssize_t(var, value);
if (http_post_buffer < 0)
- warning(_("negative value for http.postbuffer; defaulting to %d"), LARGE_PACKET_MAX);
+ warning(_("negative value for http.postBuffer; defaulting to %d"), LARGE_PACKET_MAX);
if (http_post_buffer < LARGE_PACKET_MAX)
http_post_buffer = LARGE_PACKET_MAX;
return 0;
diff --git a/pack-mtimes.c b/pack-mtimes.c
index 0e0aafdcb0..0f9785fc5e 100644
--- a/pack-mtimes.c
+++ b/pack-mtimes.c
@@ -89,7 +89,8 @@ cleanup:
*data_p = data;
}
- close(fd);
+ if (fd >= 0)
+ close(fd);
return ret;
}
diff --git a/pack-write.c b/pack-write.c
index 23c0342018..00787e306d 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -310,26 +310,21 @@ static void write_mtimes_trailer(struct hashfile *f, const unsigned char *hash)
hashwrite(f, hash, the_hash_algo->rawsz);
}
-static const char *write_mtimes_file(const char *mtimes_name,
- struct packing_data *to_pack,
+static const char *write_mtimes_file(struct packing_data *to_pack,
struct pack_idx_entry **objects,
uint32_t nr_objects,
const unsigned char *hash)
{
+ struct strbuf tmp_file = STRBUF_INIT;
+ const char *mtimes_name;
struct hashfile *f;
int fd;
if (!to_pack)
BUG("cannot call write_mtimes_file with NULL packing_data");
- if (!mtimes_name) {
- struct strbuf tmp_file = STRBUF_INIT;
- fd = odb_mkstemp(&tmp_file, "pack/tmp_mtimes_XXXXXX");
- mtimes_name = strbuf_detach(&tmp_file, NULL);
- } else {
- unlink(mtimes_name);
- fd = xopen(mtimes_name, O_CREAT|O_EXCL|O_WRONLY, 0600);
- }
+ fd = odb_mkstemp(&tmp_file, "pack/tmp_mtimes_XXXXXX");
+ mtimes_name = strbuf_detach(&tmp_file, NULL);
f = hashfd(fd, mtimes_name);
write_mtimes_header(f);
@@ -561,7 +556,7 @@ void stage_tmp_packfiles(struct strbuf *name_buffer,
pack_idx_opts->flags);
if (pack_idx_opts->flags & WRITE_MTIMES) {
- mtimes_tmp_name = write_mtimes_file(NULL, to_pack, written_list,
+ mtimes_tmp_name = write_mtimes_file(to_pack, written_list,
nr_written,
hash);
}
diff --git a/read-cache.c b/read-cache.c
index e61af3a3d4..76f372ff91 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2473,15 +2473,15 @@ int read_index_from(struct index_state *istate, const char *path,
the_repository, "%s", base_path);
if (!ret) {
char *path_copy = xstrdup(path);
- const char *base_path2 = xstrfmt("%s/sharedindex.%s",
- dirname(path_copy),
- base_oid_hex);
+ char *base_path2 = xstrfmt("%s/sharedindex.%s",
+ dirname(path_copy), base_oid_hex);
free(path_copy);
trace2_region_enter_printf("index", "shared/do_read_index",
the_repository, "%s", base_path2);
ret = do_read_index(split_index->base, base_path2, 1);
trace2_region_leave_printf("index", "shared/do_read_index",
the_repository, "%s", base_path2);
+ free(base_path2);
}
if (!oideq(&split_index->base_oid, &split_index->base->oid))
die(_("broken index, expect %s in %s, got %s"),
diff --git a/remote.c b/remote.c
index 9b9bbfe80e..b19e3a2f01 100644
--- a/remote.c
+++ b/remote.c
@@ -623,7 +623,7 @@ static void validate_remote_url(struct remote *remote)
struct strbuf redacted = STRBUF_INIT;
int warn_not_die;
- if (git_config_get_string_tmp("fetch.credentialsinurl", &value))
+ if (git_config_get_string_tmp("transfer.credentialsinurl", &value))
return;
if (!strcmp("warn", value))
@@ -633,7 +633,7 @@ static void validate_remote_url(struct remote *remote)
else if (!strcmp("allow", value))
return;
else
- die(_("unrecognized value fetch.credentialsInURL: '%s'"), value);
+ die(_("unrecognized value transfer.credentialsInUrl: '%s'"), value);
for (i = 0; i < remote->url_nr; i++) {
struct url_info url_info = { 0 };
@@ -2846,7 +2846,7 @@ char *relative_url(const char *remote_url, const char *url,
* When the url starts with '../', remove that and the
* last directory in remoteurl.
*/
- while (url) {
+ while (*url) {
if (starts_with_dot_dot_slash_native(url)) {
url += 3;
colonsep |= chop_last_dir(&remoteurl, is_relative);
diff --git a/submodule-config.c b/submodule-config.c
index ce3beaf5d4..c2ac7e7bf3 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -302,7 +302,7 @@ int parse_submodule_fetchjobs(const char *var, const char *value)
{
int fetchjobs = git_config_int(var, value);
if (fetchjobs < 0)
- die(_("negative values not allowed for submodule.fetchjobs"));
+ die(_("negative values not allowed for submodule.fetchJobs"));
return fetchjobs;
}
@@ -756,7 +756,10 @@ static void traverse_tree_submodules(struct repository *r,
if (S_ISGITLINK(name_entry->mode) &&
is_tree_submodule_active(r, root_tree, tree_path)) {
- st_entry = xmalloc(sizeof(*st_entry));
+ ALLOC_GROW(out->entries, out->entry_nr + 1,
+ out->entry_alloc);
+ st_entry = &out->entries[out->entry_nr++];
+
st_entry->name_entry = xmalloc(sizeof(*st_entry->name_entry));
*st_entry->name_entry = *name_entry;
st_entry->submodule =
@@ -766,9 +769,6 @@ static void traverse_tree_submodules(struct repository *r,
root_tree))
FREE_AND_NULL(st_entry->repo);
- ALLOC_GROW(out->entries, out->entry_nr + 1,
- out->entry_alloc);
- out->entries[out->entry_nr++] = *st_entry;
} else if (S_ISDIR(name_entry->mode))
traverse_tree_submodules(r, root_tree, tree_path,
&name_entry->oid, out);
diff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c
index 180c7f53f3..a714130ece 100644
--- a/t/helper/test-trace2.c
+++ b/t/helper/test-trace2.c
@@ -224,8 +224,8 @@ static int ut_009bug_BUG(int argc, const char **argv)
static int ut_010bug_BUG(int argc, const char **argv)
{
- bug("a bug message");
- BUG("a BUG message");
+ bug("a %s message", "bug");
+ BUG("a %s message", "BUG");
}
/*
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index ab3687c28d..27c2801792 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -219,7 +219,7 @@ test_wrapper_ () {
then
base=$(basename "$0" .sh)
echo "$test_count" >>"$perf_results_dir"/$base.subtests
- echo "$1" >"$perf_results_dir"/$base.$test_count.descr
+ echo "$test_title_" >"$perf_results_dir"/$base.$test_count.descr
base="$perf_results_dir"/"$PERF_RESULTS_PREFIX$(basename "$0" .sh)"."$test_count"
"$test_wrapper_func_" "$test_title_" "$@"
fi
diff --git a/t/t0034-root-safe-directory.sh b/t/t0034-root-safe-directory.sh
index a621f1ea5e..ff31176128 100755
--- a/t/t0034-root-safe-directory.sh
+++ b/t/t0034-root-safe-directory.sh
@@ -68,7 +68,7 @@ test_expect_success 'can access if addressed explicitly' '
)
'
-test_expect_failure SUDO 'can access with sudo if root' '
+test_expect_success SUDO 'can access with sudo if root' '
(
cd root/p &&
sudo git status
@@ -85,19 +85,6 @@ test_expect_success SUDO 'can access with sudo if root by removing SUDO_UID' '
)
'
-test_lazy_prereq SUDO_SUDO '
- sudo sudo id -u >u &&
- id -u root >r &&
- test_cmp u r
-'
-
-test_expect_success SUDO_SUDO 'can access with sudo abusing SUDO_UID' '
- (
- cd root/p &&
- sudo sudo git status
- )
-'
-
# this MUST be always the last test
test_expect_success SUDO 'cleanup' '
sudo rm -rf root
diff --git a/t/t2107-update-index-basic.sh b/t/t2107-update-index-basic.sh
index a30b7ca6bc..07e6de84e6 100755
--- a/t/t2107-update-index-basic.sh
+++ b/t/t2107-update-index-basic.sh
@@ -36,9 +36,14 @@ test_expect_success '--cacheinfo does not accept blob null sha1' '
echo content >file &&
git add file &&
git rev-parse :file >expect &&
- test_must_fail git update-index --cacheinfo 100644 $ZERO_OID file &&
+ test_must_fail git update-index --verbose --cacheinfo 100644 $ZERO_OID file >out &&
git rev-parse :file >actual &&
- test_cmp expect actual
+ test_cmp expect actual &&
+
+ cat >expect <<-\EOF &&
+ add '\''file'\''
+ EOF
+ test_cmp expect out
'
test_expect_success '--cacheinfo does not accept gitlink null sha1' '
@@ -59,9 +64,14 @@ test_expect_success '--cacheinfo mode,sha1,path (new syntax)' '
git rev-parse :file >actual &&
test_cmp expect actual &&
- git update-index --add --cacheinfo "100644,$(cat expect),elif" &&
+ git update-index --add --verbose --cacheinfo "100644,$(cat expect),elif" >out &&
git rev-parse :elif >actual &&
- test_cmp expect actual
+ test_cmp expect actual &&
+
+ cat >expect <<-\EOF &&
+ add '\''elif'\''
+ EOF
+ test_cmp expect out
'
test_expect_success '.lock files cleaned up' '
@@ -74,7 +84,8 @@ test_expect_success '.lock files cleaned up' '
git config core.worktree ../../worktree &&
# --refresh triggers late setup_work_tree,
# active_cache_changed is zero, rollback_lock_file fails
- git update-index --refresh &&
+ git update-index --refresh --verbose >out &&
+ test_must_be_empty out &&
! test -f .git/index.lock
)
'
@@ -83,7 +94,15 @@ test_expect_success '--chmod=+x and chmod=-x in the same argument list' '
>A &&
>B &&
git add A B &&
- git update-index --chmod=+x A --chmod=-x B &&
+ git update-index --verbose --chmod=+x A --chmod=-x B >out &&
+ cat >expect <<-\EOF &&
+ add '\''A'\''
+ chmod +x '\''A'\''
+ add '\''B'\''
+ chmod -x '\''B'\''
+ EOF
+ test_cmp expect out &&
+
cat >expect <<-EOF &&
100755 $EMPTY_BLOB 0 A
100644 $EMPTY_BLOB 0 B
diff --git a/t/t5329-pack-objects-cruft.sh b/t/t5329-pack-objects-cruft.sh
index b481224b93..8968f7a08d 100755
--- a/t/t5329-pack-objects-cruft.sh
+++ b/t/t5329-pack-objects-cruft.sh
@@ -451,11 +451,13 @@ test_expect_success 'expiring cruft objects with git gc' '
sort <reachable.raw >reachable &&
comm -13 reachable objects >unreachable &&
- git repack --cruft -d &&
+ # Write a cruft pack containing all unreachable objects.
+ git gc --cruft --prune="01-01-1980" &&
mtimes=$(ls .git/objects/pack/pack-*.mtimes) &&
test_path_is_file $mtimes &&
+ # Prune all unreachable objects from the cruft pack.
git gc --cruft --prune=now &&
git cat-file --batch-all-objects --batch-check="%(objectname)" >objects &&
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index c1220b2ed3..541adbb310 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1836,18 +1836,18 @@ test_expect_success 'refuse to push a hidden ref, and make sure do not pollute t
test_expect_success LIBCURL 'fetch warns or fails when using username:password' '
message="URL '\''https://username:<redacted>@localhost/'\'' uses plaintext credentials" &&
- test_must_fail git -c fetch.credentialsInUrl=allow fetch https://username:password@localhost 2>err &&
+ test_must_fail git -c transfer.credentialsInUrl=allow fetch https://username:password@localhost 2>err &&
! grep "$message" err &&
- test_must_fail git -c fetch.credentialsInUrl=warn fetch https://username:password@localhost 2>err &&
+ test_must_fail git -c transfer.credentialsInUrl=warn fetch https://username:password@localhost 2>err &&
grep "warning: $message" err >warnings &&
test_line_count = 3 warnings &&
- test_must_fail git -c fetch.credentialsInUrl=die fetch https://username:password@localhost 2>err &&
+ test_must_fail git -c transfer.credentialsInUrl=die fetch https://username:password@localhost 2>err &&
grep "fatal: $message" err >warnings &&
test_line_count = 1 warnings &&
- test_must_fail git -c fetch.credentialsInUrl=die fetch https://username:@localhost 2>err &&
+ test_must_fail git -c transfer.credentialsInUrl=die fetch https://username:@localhost 2>err &&
grep "fatal: $message" err >warnings &&
test_line_count = 1 warnings
'
@@ -1855,12 +1855,12 @@ test_expect_success LIBCURL 'fetch warns or fails when using username:password'
test_expect_success LIBCURL 'push warns or fails when using username:password' '
message="URL '\''https://username:<redacted>@localhost/'\'' uses plaintext credentials" &&
- test_must_fail git -c fetch.credentialsInUrl=allow push https://username:password@localhost 2>err &&
+ test_must_fail git -c transfer.credentialsInUrl=allow push https://username:password@localhost 2>err &&
! grep "$message" err &&
- test_must_fail git -c fetch.credentialsInUrl=warn push https://username:password@localhost 2>err &&
+ test_must_fail git -c transfer.credentialsInUrl=warn push https://username:password@localhost 2>err &&
grep "warning: $message" err >warnings &&
- test_must_fail git -c fetch.credentialsInUrl=die push https://username:password@localhost 2>err &&
+ test_must_fail git -c transfer.credentialsInUrl=die push https://username:password@localhost 2>err &&
grep "fatal: $message" err >warnings &&
test_line_count = 1 warnings
'
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index eeed233362..cf3be0584f 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -73,24 +73,24 @@ test_expect_success 'clone respects GIT_WORK_TREE' '
test_expect_success LIBCURL 'clone warns or fails when using username:password' '
message="URL '\''https://username:<redacted>@localhost/'\'' uses plaintext credentials" &&
- test_must_fail git -c fetch.credentialsInUrl=allow clone https://username:password@localhost attempt1 2>err &&
+ test_must_fail git -c transfer.credentialsInUrl=allow clone https://username:password@localhost attempt1 2>err &&
! grep "$message" err &&
- test_must_fail git -c fetch.credentialsInUrl=warn clone https://username:password@localhost attempt2 2>err &&
+ test_must_fail git -c transfer.credentialsInUrl=warn clone https://username:password@localhost attempt2 2>err &&
grep "warning: $message" err >warnings &&
test_line_count = 2 warnings &&
- test_must_fail git -c fetch.credentialsInUrl=die clone https://username:password@localhost attempt3 2>err &&
+ test_must_fail git -c transfer.credentialsInUrl=die clone https://username:password@localhost attempt3 2>err &&
grep "fatal: $message" err >warnings &&
test_line_count = 1 warnings &&
- test_must_fail git -c fetch.credentialsInUrl=die clone https://username:@localhost attempt3 2>err &&
+ test_must_fail git -c transfer.credentialsInUrl=die clone https://username:@localhost attempt3 2>err &&
grep "fatal: $message" err >warnings &&
test_line_count = 1 warnings
'
test_expect_success LIBCURL 'clone does not detect username:password when it is https://username@domain:port/' '
- test_must_fail git -c fetch.credentialsInUrl=warn clone https://username@localhost:8080 attempt3 2>err &&
+ test_must_fail git -c transfer.credentialsInUrl=warn clone https://username@localhost:8080 attempt3 2>err &&
! grep "uses plaintext credentials" err
'
diff --git a/usage.c b/usage.c
index 79900d0287..56e29d6cd6 100644
--- a/usage.c
+++ b/usage.c
@@ -334,15 +334,17 @@ NORETURN void BUG_fl(const char *file, int line, const char *fmt, ...)
int bug_called_must_BUG;
void bug_fl(const char *file, int line, const char *fmt, ...)
{
- va_list ap, cp;
+ va_list ap;
bug_called_must_BUG = 1;
- va_copy(cp, ap);
va_start(ap, fmt);
BUG_vfl_common(file, line, fmt, ap);
va_end(ap);
- trace2_cmd_error_va(fmt, cp);
+
+ va_start(ap, fmt);
+ trace2_cmd_error_va(fmt, ap);
+ va_end(ap);
}
#ifdef SUPPRESS_ANNOTATED_LEAKS