Skip to content

Commit

Permalink
Merge branch 'master' of github.com:git/git
Browse files Browse the repository at this point in the history
* '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
  ...
  • Loading branch information
jiangxin committed Jun 18, 2022
2 parents 2b288c4 + 5b71c59 commit 74e34a0
Show file tree
Hide file tree
Showing 36 changed files with 169 additions and 142 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions Documentation/RelNotes/2.37.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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).
Expand Down
14 changes: 0 additions & 14 deletions Documentation/config/fetch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion Documentation/config/http.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions Documentation/config/safe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
38 changes: 38 additions & 0 deletions Documentation/config/transfer.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion GIT-VERSION-GEN
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

GVF=GIT-VERSION-FILE
DEF_VER=v2.36.GIT
DEF_VER=v2.37.0-rc1

LF='
'
Expand Down
2 changes: 1 addition & 1 deletion builtin/fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion builtin/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion builtin/index-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down
2 changes: 1 addition & 1 deletion builtin/pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion builtin/repack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions builtin/submodule--helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
27 changes: 0 additions & 27 deletions cache-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions cache-tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
13 changes: 10 additions & 3 deletions ci/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion ci/make-test-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 0 additions & 12 deletions contrib/coccinelle/object_id.cocci
Original file line number Diff line number Diff line change
@@ -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;
@@
Expand Down
8 changes: 6 additions & 2 deletions fsmonitor-settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion git-compat-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion gpg-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion pack-mtimes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Loading

0 comments on commit 74e34a0

Please sign in to comment.