Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
Merge branch 'git:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
violethaze74 authored Feb 16, 2022
2 parents d7d5b77 + b801210 commit d1d1d69
Show file tree
Hide file tree
Showing 28 changed files with 309 additions and 109 deletions.
7 changes: 7 additions & 0 deletions Documentation/CodingGuidelines
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ code. For Git in general, a few rough rules are:
go and fix it up."
Cf. http://lkml.iu.edu/hypermail/linux/kernel/1001.3/01069.html

- Log messages to explain your changes are as important as the
changes themselves. Clearly written code and in-code comments
explain how the code works and what is assumed from the surrounding
context. The log messages explain what the changes wanted to
achieve and why the changes were necessary (more on this in the
accompanying SubmittingPatches document).

Make your code readable and sensible, and don't try to be clever.

As for more concrete guidelines, just imitate the existing code
Expand Down
19 changes: 19 additions & 0 deletions Documentation/RelNotes/2.36.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,29 @@ Fixes since v2.35
* Update the logic to compute alignment requirement for our mem-pool.
(merge e38bcc66d8 jc/mem-pool-alignment later to maint).

* Pick a better random number generator and use it when we prepare
temporary filenames.
(merge 47efda967c bc/csprng-mktemps later to maint).

* Update the contributor-facing documents on proposed log messages.
(merge cdba0295b0 jc/doc-log-messages later to maint).

* When "git fetch --prune" failed to prune the refs it wanted to
prune, the command issued error messages but exited with exit
status 0, which has been corrected.
(merge c9e04d905e tg/fetch-prune-exit-code-fix later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge cfc5cf428b jc/find-header later to maint).
(merge 40e7cfdd46 jh/p4-fix-use-of-process-error-exception later to maint).
(merge 727e6ea350 jh/p4-spawning-external-commands-cleanup later to maint).
(merge 0a6adc26e2 rs/grep-expr-cleanup later to maint).
(merge 4ed7dfa713 po/readme-mention-contributor-hints later to maint).
(merge 6046f7a91c en/plug-leaks-in-merge later to maint).
(merge 8c591dbfce bc/clarify-eol-attr later to maint).
(merge 518e15db74 rs/parse-options-lithelp-help later to maint).
(merge cbac0076ef gh/doc-typos later to maint).
(merge ce14de03db ab/no-errno-from-resolve-ref-unsafe later to maint).
(merge 2826ffad8c rc/negotiate-only-typofix later to maint).
(merge 0f03f04c5c en/sparse-checkout-leakfix later to maint).
(merge 74f3390dde sy/diff-usage-typofix later to maint).
36 changes: 36 additions & 0 deletions Documentation/SubmittingPatches
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,35 @@ run `git diff --check` on your changes before you commit.
[[describe-changes]]
=== Describe your changes well.

The log message that explains your changes is just as important as the
changes themselves. Your code may be clearly written with in-code
comment to sufficiently explain how it works with the surrounding
code, but those who need to fix or enhance your code in the future
will need to know _why_ your code does what it does, for a few
reasons:

. Your code may be doing something differently from what you wanted it
to do. Writing down what you actually wanted to achieve will help
them fix your code and make it do what it should have been doing
(also, you often discover your own bugs yourself, while writing the
log message to summarize the thought behind it).

. Your code may be doing things that were only necessary for your
immediate needs (e.g. "do X to directories" without implementing or
even designing what is to be done on files). Writing down why you
excluded what the code does not do will help guide future developers.
Writing down "we do X to directories, because directories have
characteristic Y" would help them infer "oh, files also have the same
characteristic Y, so perhaps doing X to them would also make sense?".
Saying "we don't do the same X to files, because ..." will help them
decide if the reasoning is sound (in which case they do not waste
time extending your code to cover files), or reason differently (in
which case, they can explain why they extend your code to cover
files, too).

The goal of your log message is to convey the _why_ behind your
change to help future developers.

The first line of the commit message should be a short description (50
characters is the soft limit, see DISCUSSION in linkgit:git-commit[1]),
and should skip the full stop. It is also conventional in most cases to
Expand Down Expand Up @@ -142,6 +171,13 @@ The body should provide a meaningful commit message, which:

. alternate solutions considered but discarded, if any.

[[present-tense]]
The problem statement that describes the status quo is written in the
present tense. Write "The code does X when it is given input Y",
instead of "The code used to do Y when given input X". You do not
have to say "Currently"---the status quo in the problem statement is
about the code _without_ your change, by project convention.

[[imperative-mood]]
Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
Expand Down
4 changes: 2 additions & 2 deletions Documentation/config/gpg.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ gpg.minTrustLevel::
gpg.ssh.defaultKeyCommand::
This command that will be run when user.signingkey is not set and a ssh
signature is requested. On successful exit a valid ssh public key is
expected in the first line of its output. To automatically use the first
expected in the first line of its output. To automatically use the first
available key from your ssh-agent set this to "ssh-add -L".

gpg.ssh.allowedSignersFile::
Expand Down Expand Up @@ -66,7 +66,7 @@ This way only committers with an already valid key can add or change keys in the
+
Since OpensSSH 8.8 this file allows specifying a key lifetime using valid-after &
valid-before options. Git will mark signatures as valid if the signing key was
valid at the time of the signatures creation. This allows users to change a
valid at the time of the signature's creation. This allows users to change a
signing key without invalidating all previously made signatures.
+
Using a SSH CA key with the cert-authority option
Expand Down
11 changes: 6 additions & 5 deletions Documentation/gitattributes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,12 @@ unspecified.
^^^^^

This attribute sets a specific line-ending style to be used in the
working directory. It enables end-of-line conversion without any
content checks, effectively setting the `text` attribute. Note that
setting this attribute on paths which are in the index with CRLF line
endings may make the paths to be considered dirty. Adding the path to
the index again will normalize the line endings in the index.
working directory. This attribute has effect only if the `text`
attribute is set or unspecified, or if it is set to `auto` and the file
is detected as text. Note that setting this attribute on paths which
are in the index with CRLF line endings may make the paths to be
considered dirty. Adding the path to the index again will normalize the
line endings in the index.

Set to string value "crlf"::

Expand Down
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@ all::
# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
# the executable mode bit, but doesn't really do so.
#
# Define CSPRNG_METHOD to "arc4random" if your system has arc4random and
# arc4random_buf, "libbsd" if your system has those functions from libbsd,
# "getrandom" if your system has getrandom, "getentropy" if your system has
# getentropy, "rtlgenrandom" for RtlGenRandom (Windows only), or "openssl" if
# you'd want to use the OpenSSL CSPRNG. You may set multiple options with
# spaces, in which case a suitable option will be chosen. If unset or set to
# anything else, defaults to using "/dev/urandom".
#
# Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
# bits in mode values (e.g. z/OS defines I_SFMT to 0xFF000000 as opposed to the
# usual 0xF000).
Expand Down Expand Up @@ -693,6 +701,7 @@ TEST_BUILTINS_OBJS += test-bloom.o
TEST_BUILTINS_OBJS += test-chmtime.o
TEST_BUILTINS_OBJS += test-config.o
TEST_BUILTINS_OBJS += test-crontab.o
TEST_BUILTINS_OBJS += test-csprng.o
TEST_BUILTINS_OBJS += test-ctype.o
TEST_BUILTINS_OBJS += test-date.o
TEST_BUILTINS_OBJS += test-delta.o
Expand Down Expand Up @@ -1909,6 +1918,31 @@ ifdef HAVE_GETDELIM
BASIC_CFLAGS += -DHAVE_GETDELIM
endif

ifneq ($(findstring arc4random,$(CSPRNG_METHOD)),)
BASIC_CFLAGS += -DHAVE_ARC4RANDOM
endif

ifneq ($(findstring libbsd,$(CSPRNG_METHOD)),)
BASIC_CFLAGS += -DHAVE_ARC4RANDOM_LIBBSD
EXTLIBS += -lbsd
endif

ifneq ($(findstring getrandom,$(CSPRNG_METHOD)),)
BASIC_CFLAGS += -DHAVE_GETRANDOM
endif

ifneq ($(findstring getentropy,$(CSPRNG_METHOD)),)
BASIC_CFLAGS += -DHAVE_GETENTROPY
endif

ifneq ($(findstring rtlgenrandom,$(CSPRNG_METHOD)),)
BASIC_CFLAGS += -DHAVE_RTLGENRANDOM
endif

ifneq ($(findstring openssl,$(CSPRNG_METHOD)),)
BASIC_CFLAGS += -DHAVE_OPENSSL_CSPRNG
endif

ifneq ($(PROCFS_EXECUTABLE_PATH),)
procfs_executable_path_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH))
BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"'
Expand Down
6 changes: 3 additions & 3 deletions builtin/diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ static const char builtin_diff_usage[] =
"git diff [<options>] [<commit>] [--] [<path>...]\n"
" or: git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]\n"
" or: git diff [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]\n"
" or: git diff [<options>] <commit>...<commit>] [--] [<path>...]\n"
" or: git diff [<options>] <blob> <blob>]\n"
" or: git diff [<options>] --no-index [--] <path> <path>]\n"
" or: git diff [<options>] <commit>...<commit> [--] [<path>...]\n"
" or: git diff [<options>] <blob> <blob>\n"
" or: git diff [<options>] --no-index [--] <path> <path>\n"
COMMON_DIFF_OPTIONS_HELP;

static const char *blob_path(struct object_array_entry *entry)
Expand Down
12 changes: 7 additions & 5 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1610,12 +1610,14 @@ static int do_fetch(struct transport *transport,
* don't care whether --tags was specified.
*/
if (rs->nr) {
prune_refs(rs, ref_map, transport->url);
retcode = prune_refs(rs, ref_map, transport->url);
} else {
prune_refs(&transport->remote->fetch,
ref_map,
transport->url);
retcode = prune_refs(&transport->remote->fetch,
ref_map,
transport->url);
}
if (retcode != 0)
retcode = 1;
}
if (fetch_and_consume_refs(transport, ref_map, worktrees)) {
free_refs(ref_map);
Expand Down Expand Up @@ -2052,7 +2054,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
}

if (negotiate_only && !negotiation_tip.nr)
die(_("--negotiate-only needs one or more --negotiate-tip=*"));
die(_("--negotiate-only needs one or more --negotiation-tip=*"));

if (deepen_relative) {
if (deepen_relative < 0)
Expand Down
2 changes: 2 additions & 0 deletions builtin/sparse-checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ static void clean_tracked_sparse_directories(struct repository *r)
item->string);
}

strvec_clear(&s);
clear_pathspec(&p);
dir_clear(&dir);
}

Expand Down
6 changes: 6 additions & 0 deletions compat/winansi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
*/

#undef NOGDI

/*
* Including the appropriate header file for RtlGenRandom causes MSVC to see a
* redefinition of types in an incompatible way when including headers below.
*/
#undef HAVE_RTLGENRANDOM
#include "../git-compat-util.h"
#include <wingdi.h>
#include <winreg.h>
Expand Down
8 changes: 8 additions & 0 deletions config.mak.uname
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ ifeq ($(uname_S),Darwin)
HAVE_BSD_SYSCTL = YesPlease
FREAD_READS_DIRECTORIES = UnfortunatelyYes
HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
CSPRNG_METHOD = arc4random

# Workaround for `gettext` being keg-only and not even being linked via
# `brew link --force gettext`, should be obsolete as of
Expand Down Expand Up @@ -261,6 +262,7 @@ ifeq ($(uname_S),FreeBSD)
HAVE_PATHS_H = YesPlease
HAVE_BSD_SYSCTL = YesPlease
HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
CSPRNG_METHOD = arc4random
PAGER_ENV = LESS=FRX LV=-c MORE=FRX
FREAD_READS_DIRECTORIES = UnfortunatelyYes
FILENO_IS_A_MACRO = UnfortunatelyYes
Expand All @@ -279,6 +281,7 @@ ifeq ($(uname_S),OpenBSD)
HAVE_PATHS_H = YesPlease
HAVE_BSD_SYSCTL = YesPlease
HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
CSPRNG_METHOD = arc4random
PROCFS_EXECUTABLE_PATH = /proc/curproc/file
FREAD_READS_DIRECTORIES = UnfortunatelyYes
FILENO_IS_A_MACRO = UnfortunatelyYes
Expand All @@ -290,6 +293,7 @@ ifeq ($(uname_S),MirBSD)
NEEDS_LIBICONV = YesPlease
HAVE_PATHS_H = YesPlease
HAVE_BSD_SYSCTL = YesPlease
CSPRNG_METHOD = arc4random
endif
ifeq ($(uname_S),NetBSD)
ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
Expand All @@ -301,6 +305,7 @@ ifeq ($(uname_S),NetBSD)
HAVE_PATHS_H = YesPlease
HAVE_BSD_SYSCTL = YesPlease
HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
CSPRNG_METHOD = arc4random
PROCFS_EXECUTABLE_PATH = /proc/curproc/exe
endif
ifeq ($(uname_S),AIX)
Expand Down Expand Up @@ -430,6 +435,7 @@ ifeq ($(uname_S),Windows)
NO_STRTOUMAX = YesPlease
NO_MKDTEMP = YesPlease
NO_INTTYPES_H = YesPlease
CSPRNG_METHOD = rtlgenrandom
# VS2015 with UCRT claims that snprintf and friends are C99 compliant,
# so we don't need this:
#
Expand Down Expand Up @@ -599,6 +605,7 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
NO_MMAP = YesPlease
NO_POLL = YesPlease
NO_INTPTR_T = UnfortunatelyYes
CSPRNG_METHOD = openssl
SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
SHELL_PATH = /usr/coreutils/bin/bash
endif
Expand Down Expand Up @@ -634,6 +641,7 @@ ifeq ($(uname_S),MINGW)
NO_POSIX_GOODIES = UnfortunatelyYes
DEFAULT_HELP_FORMAT = html
HAVE_PLATFORM_PROCINFO = YesPlease
CSPRNG_METHOD = rtlgenrandom
BASIC_LDFLAGS += -municode
COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
Expand Down
2 changes: 1 addition & 1 deletion contrib/buildsystems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe" NO_SYMLINK_HEAD UNRELIABLE_FSTAT
NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0
USE_NED_ALLOCATOR OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP
UNICODE _UNICODE HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET)
UNICODE _UNICODE HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM)
list(APPEND compat_SOURCES compat/mingw.c compat/winansi.c compat/win32/path-utils.c
compat/win32/pthread.c compat/win32mmap.c compat/win32/syslog.c
compat/win32/trace2_win32_process_info.c compat/win32/dirent.c
Expand Down
19 changes: 19 additions & 0 deletions git-compat-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@
#endif
#include <windows.h>
#define GIT_WINDOWS_NATIVE
#ifdef HAVE_RTLGENRANDOM
/* This is required to get access to RtlGenRandom. */
#define SystemFunction036 NTAPI SystemFunction036
#include <NTSecAPI.h>
#undef SystemFunction036
#endif
#endif

#include <unistd.h>
Expand Down Expand Up @@ -267,6 +273,12 @@
#else
#include <stdint.h>
#endif
#ifdef HAVE_ARC4RANDOM_LIBBSD
#include <bsd/stdlib.h>
#endif
#ifdef HAVE_GETRANDOM
#include <sys/random.h>
#endif
#ifdef NO_INTPTR_T
/*
* On I16LP32, ILP32 and LP64 "long" is the safe bet, however
Expand Down Expand Up @@ -1432,4 +1444,11 @@ static inline void *container_of_or_null_offset(void *ptr, size_t offset)

void sleep_millisec(int millisec);

/*
* Generate len bytes from the system cryptographically secure PRNG.
* Returns 0 on success and -1 on error, setting errno. The inability to
* satisfy the full request is an error.
*/
int csprng_bytes(void *buf, size_t len);

#endif
5 changes: 5 additions & 0 deletions parse-options.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ typedef enum parse_opt_result parse_opt_ll_cb(struct parse_opt_ctx_t *ctx,
* token to explain the kind of argument this option wants. Does not
* begin in capital letter, and does not end with a full stop.
* Should be wrapped by N_() for translation.
* Is automatically enclosed in brackets when printed, unless it
* contains any of the following characters: ()<>[]|
* E.g. "name" is shown as "<name>" to indicate that a name value
* needs to be supplied, not the literal string "name", but
* "<start>,<end>" and "(this|that)" are printed verbatim.
*
* `help`::
* the short help associated to what the option does.
Expand Down
Loading

0 comments on commit d1d1d69

Please sign in to comment.