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
  ...
This commit is contained in:
Jiang Xin 2022-06-18 14:02:07 +08:00
commit 74e34a0ee2
36 changed files with 169 additions and 142 deletions

View file

@ -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

View file

@ -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).

View file

@ -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.

View file

@ -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

View file

@ -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.

View file

@ -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.

View file

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

View file

@ -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;

View file

@ -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();

View file

@ -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")) {

View file

@ -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;
}

View file

@ -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 {

View file

@ -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);

View file

@ -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

View file

@ -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);

View file

@ -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"

View file

@ -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

View file

@ -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,

View file

@ -1,15 +1,3 @@
@@
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;
@@

View file

@ -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,

View file

@ -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;
}

View file

@ -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 */

2
http.c
View file

@ -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;

View file

@ -89,7 +89,8 @@ static int load_pack_mtimes_file(char *mtimes_file,
*data_p = data;
}
close(fd);
if (fd >= 0)
close(fd);
return ret;
}

View file

@ -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);
}

View file

@ -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"),

View file

@ -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);

View file

@ -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);

View file

@ -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");
}
/*

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 &&

View file

@ -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
'

View file

@ -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
'

View file

@ -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