Skip to content

Commit

Permalink
Merge tag 'v2.36.2' into HEAD
Browse files Browse the repository at this point in the history
Git 2.36.2

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Jun 28, 2022
2 parents 66626c1 + fd59c5b commit ea4bc1e
Show file tree
Hide file tree
Showing 42 changed files with 608 additions and 93 deletions.
12 changes: 12 additions & 0 deletions Documentation/RelNotes/2.30.5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Git v2.30.5 Release Notes
=========================

This release contains minor fix-ups for the changes that went into
Git 2.30.3 and 2.30.4, addressing CVE-2022-29187.

* The safety check that verifies a safe ownership of the Git
worktree is now extended to also cover the ownership of the Git
directory (and the `.git` file, if there is any).

Carlo Marcelo Arenas Belón (1):
setup: tighten ownership checks post CVE-2022-24765
6 changes: 6 additions & 0 deletions Documentation/RelNotes/2.31.4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Git v2.31.4 Release Notes
=========================

This release merges up the fixes that appear in v2.30.5 to address
the security issue CVE-2022-29187; see the release notes for that
version for details.
6 changes: 6 additions & 0 deletions Documentation/RelNotes/2.32.3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Git v2.32.3 Release Notes
=========================

This release merges up the fixes that appear in v2.30.5 and
v2.31.4 to address the security issue CVE-2022-29187; see the
release notes for these versions for details.
6 changes: 6 additions & 0 deletions Documentation/RelNotes/2.33.4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Git v2.33.4 Release Notes
=========================

This release merges up the fixes that appear in v2.30.5, v2.31.4
and v2.32.3 to address the security issue CVE-2022-29187; see
the release notes for these versions for details.
6 changes: 6 additions & 0 deletions Documentation/RelNotes/2.34.4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Git v2.34.4 Release Notes
=========================

This release merges up the fixes that appear in v2.30.5, v2.31.4,
v2.32.3 and v2.33.4 to address the security issue CVE-2022-29187;
see the release notes for these versions for details.
7 changes: 7 additions & 0 deletions Documentation/RelNotes/2.35.4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Git v2.35.4 Release Notes
=========================

This release merges up the fixes that appear in v2.30.5,
v2.31.4, v2.32.3, v2.33.4 and v2.34.4 to address the security
issue CVE-2022-29187; see the release notes for these versions
for details.
56 changes: 56 additions & 0 deletions Documentation/RelNotes/2.36.2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Git v2.36.2 Release Notes
=========================

This release merges up the fixes that appear in v2.30.5, v2.31.4,
v2.32.3, v2.33.4, v2.34.4 and v2.35.4 to address the security
issue CVE-2022-29187; see the release notes for these versions
for details.

Apart from that, this maintenance release is primarily to merge down
updates to the build and CI procedures from the 'master' front, in
order to ensure that we can cut healthy maintenance releases in the
future. It also contains a handful of small and trivially-correct
bugfixes.

Fixes since v2.36.1
-------------------

* Fixes real problems noticed by gcc 12 and works around false
positives.

* Update URL to the gitk repository.

* The "--current" option of "git show-branch" should have been made
incompatible with the "--reflog" mode, but this was not enforced,
which has been corrected.

* "git archive --add-file=<path>" picked up the raw permission bits
from the path and propagated to zip output in some cases, without
normalization, which has been corrected (tar output did not have
this issue).

* A bit of test framework fixes with a few fixes to issues found by
valgrind.

* macOS CI jobs have been occasionally flaky due to tentative version
skew between perforce and the homebrew packager. Instead of
failing the whole CI job, just let it skip the p4 tests when this
happens.

* The commit summary shown after making a commit is matched to what
is given in "git status" not to use the break-rewrite heuristics.

* Avoid problems from interaction between malloc_check and address
sanitizer.

* "git rebase --keep-base <upstream> <branch-to-rebase>" computed the
commit to rebase onto incorrectly, which has been corrected.

* The path taken by "git multi-pack-index" command from the end user
was compared with path internally prepared by the tool withut first
normalizing, which lead to duplicated paths not being noticed,
which has been corrected.

* "git clone --origin X" leaked piece of memory that held value read
from the clone.defaultRemoteName configuration variable, which has
been plugged.
5 changes: 4 additions & 1 deletion Documentation/SubmittingPatches
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,10 @@ repositories.

- `gitk-git/` comes from Paul Mackerras's gitk project:

git://ozlabs.org/~paulus/gitk
git://git.ozlabs.org/~paulus/gitk

Those who are interested in improve gitk can volunteer to help Paul
in maintaining it cf. <YntxL/fTplFm8lr6@cleo>.

- `po/` comes from the localization coordinator, Jiang Xin:

Expand Down
16 changes: 16 additions & 0 deletions Documentation/config/safe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,19 @@ Unix' simpler permission model, it can be a bit tricky to figure out why
a directory is considered unsafe. To help with this, Git will provide
more detailed information when the environment variable
`GIT_TEST_DEBUG_UNSAFE_DIRECTORIES` is set to `true`.
+
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 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 can remove
the `SUDO_UID` variable from root's environment before invoking git.
5 changes: 3 additions & 2 deletions Documentation/git-rebase.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,10 @@ leave out at most one of A and B, in which case it defaults to HEAD.

--keep-base::
Set the starting point at which to create the new commits to the
merge base of <upstream> <branch>. Running
merge base of <upstream> and <branch>. Running
'git rebase --keep-base <upstream> <branch>' is equivalent to
running 'git rebase --onto <upstream>... <upstream>'.
running
'git rebase --onto <upstream>...<branch> <upstream> <branch>'.
+
This option is useful in the case where one is developing a feature on
top of an upstream branch. While the feature is being worked on, the
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.1
DEF_VER=v2.36.2

LF='
'
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1275,8 +1275,9 @@ PTHREAD_CFLAGS =
SPARSE_FLAGS ?= -std=gnu99
SP_EXTRA_FLAGS = -Wno-universal-initializer

# For informing GIT-BUILD-OPTIONS of the SANITIZE=leak target
# For informing GIT-BUILD-OPTIONS of the SANITIZE=leak,address targets
SANITIZE_LEAK =
SANITIZE_ADDRESS =

# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
# usually result in less CPU usage at the cost of higher peak memory.
Expand Down Expand Up @@ -1322,6 +1323,7 @@ SANITIZE_LEAK = YesCompiledWithIt
endif
ifneq ($(filter address,$(SANITIZERS)),)
NO_REGEX = NeededForASAN
SANITIZE_ADDRESS = YesCompiledWithIt
endif
endif

Expand Down Expand Up @@ -2883,6 +2885,7 @@ GIT-BUILD-OPTIONS: FORCE
@echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
@echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
@echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
@echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
@echo X=\'$(X)\' >>$@+
ifdef FSMONITOR_DAEMON_BACKEND
@echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
Expand Down
2 changes: 1 addition & 1 deletion RelNotes
2 changes: 1 addition & 1 deletion archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ int write_archive_entries(struct archiver_args *args,
else
err = write_entry(args, &fake_oid, path_in_archive.buf,
path_in_archive.len,
info->stat.st_mode,
canon_mode(info->stat.st_mode),
content.buf, content.len);
if (err)
break;
Expand Down
4 changes: 3 additions & 1 deletion builtin/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,8 +1108,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
* apply the remote name provided by --origin only after this second
* call to git_config, to ensure it overrides all config-based values.
*/
if (option_origin != NULL)
if (option_origin != NULL) {
free(remote_name);
remote_name = xstrdup(option_origin);
}

if (remote_name == NULL)
remote_name = xstrdup("origin");
Expand Down
45 changes: 34 additions & 11 deletions builtin/multi-pack-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,31 @@ static char const * const builtin_multi_pack_index_usage[] = {
};

static struct opts_multi_pack_index {
const char *object_dir;
char *object_dir;
const char *preferred_pack;
const char *refs_snapshot;
unsigned long batch_size;
unsigned flags;
int stdin_packs;
} opts;


static int parse_object_dir(const struct option *opt, const char *arg,
int unset)
{
free(opts.object_dir);
if (unset)
opts.object_dir = xstrdup(get_object_directory());
else
opts.object_dir = real_pathdup(arg, 1);
return 0;
}

static struct option common_opts[] = {
OPT_FILENAME(0, "object-dir", &opts.object_dir,
N_("object directory containing set of packfile and pack-index pairs")),
OPT_CALLBACK(0, "object-dir", &opts.object_dir,
N_("directory"),
N_("object directory containing set of packfile and pack-index pairs"),
parse_object_dir),
OPT_END(),
};

Expand Down Expand Up @@ -232,31 +246,40 @@ static int cmd_multi_pack_index_repack(int argc, const char **argv)
int cmd_multi_pack_index(int argc, const char **argv,
const char *prefix)
{
int res;
struct option *builtin_multi_pack_index_options = common_opts;

git_config(git_default_config, NULL);

if (the_repository &&
the_repository->objects &&
the_repository->objects->odb)
opts.object_dir = xstrdup(the_repository->objects->odb->path);

argc = parse_options(argc, argv, prefix,
builtin_multi_pack_index_options,
builtin_multi_pack_index_usage,
PARSE_OPT_STOP_AT_NON_OPTION);

if (!opts.object_dir)
opts.object_dir = get_object_directory();

if (!argc)
goto usage;

if (!strcmp(argv[0], "repack"))
return cmd_multi_pack_index_repack(argc, argv);
res = cmd_multi_pack_index_repack(argc, argv);
else if (!strcmp(argv[0], "write"))
return cmd_multi_pack_index_write(argc, argv);
res = cmd_multi_pack_index_write(argc, argv);
else if (!strcmp(argv[0], "verify"))
return cmd_multi_pack_index_verify(argc, argv);
res = cmd_multi_pack_index_verify(argc, argv);
else if (!strcmp(argv[0], "expire"))
return cmd_multi_pack_index_expire(argc, argv);
res = cmd_multi_pack_index_expire(argc, argv);
else {
error(_("unrecognized subcommand: %s"), argv[0]);
goto usage;
}

free(opts.object_dir);
return res;

error(_("unrecognized subcommand: %s"), argv[0]);
usage:
usage_with_options(builtin_multi_pack_index_usage,
builtin_multi_pack_index_options);
Expand Down
55 changes: 28 additions & 27 deletions builtin/rebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -1588,33 +1588,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
options.upstream_arg = "--root";
}

/* Make sure the branch to rebase onto is valid. */
if (keep_base) {
strbuf_reset(&buf);
strbuf_addstr(&buf, options.upstream_name);
strbuf_addstr(&buf, "...");
options.onto_name = xstrdup(buf.buf);
} else if (!options.onto_name)
options.onto_name = options.upstream_name;
if (strstr(options.onto_name, "...")) {
if (get_oid_mb(options.onto_name, &merge_base) < 0) {
if (keep_base)
die(_("'%s': need exactly one merge base with branch"),
options.upstream_name);
else
die(_("'%s': need exactly one merge base"),
options.onto_name);
}
options.onto = lookup_commit_or_die(&merge_base,
options.onto_name);
} else {
options.onto =
lookup_commit_reference_by_name(options.onto_name);
if (!options.onto)
die(_("Does not point to a valid commit '%s'"),
options.onto_name);
}

/*
* If the branch to rebase is given, that is the branch we will rebase
* branch_name -- branch/commit being rebased, or
Expand Down Expand Up @@ -1664,6 +1637,34 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
} else
BUG("unexpected number of arguments left to parse");

/* Make sure the branch to rebase onto is valid. */
if (keep_base) {
strbuf_reset(&buf);
strbuf_addstr(&buf, options.upstream_name);
strbuf_addstr(&buf, "...");
strbuf_addstr(&buf, branch_name);
options.onto_name = xstrdup(buf.buf);
} else if (!options.onto_name)
options.onto_name = options.upstream_name;
if (strstr(options.onto_name, "...")) {
if (get_oid_mb(options.onto_name, &merge_base) < 0) {
if (keep_base)
die(_("'%s': need exactly one merge base with branch"),
options.upstream_name);
else
die(_("'%s': need exactly one merge base"),
options.onto_name);
}
options.onto = lookup_commit_or_die(&merge_base,
options.onto_name);
} else {
options.onto =
lookup_commit_reference_by_name(options.onto_name);
if (!options.onto)
die(_("Does not point to a valid commit '%s'"),
options.onto_name);
}

if (options.fork_point > 0) {
struct commit *head =
lookup_commit_reference(the_repository,
Expand Down
4 changes: 4 additions & 0 deletions builtin/show-branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,10 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
"--all/--remotes/--independent/--merge-base");
}

if (with_current_branch && reflog)
die(_("options '%s' and '%s' cannot be used together"),
"--reflog", "--current");

/* If nothing is specified, show all branches by default */
if (ac <= topics && all_heads + all_remotes == 0)
all_heads = 1;
Expand Down
2 changes: 1 addition & 1 deletion cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ extern char *git_work_tree_cfg;
int is_inside_work_tree(void);
const char *get_git_dir(void);
const char *get_git_common_dir(void);
char *get_object_directory(void);
const char *get_object_directory(void);
char *get_index_file(void);
char *get_graft_file(struct repository *r);
void set_git_dir(const char *path, int make_realpath);
Expand Down
Loading

0 comments on commit ea4bc1e

Please sign in to comment.