aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/Makefile5
-rw-r--r--Documentation/RelNotes/2.49.0.adoc22
-rw-r--r--Documentation/git-commit.adoc8
-rw-r--r--Documentation/git-merge-tree.adoc11
-rw-r--r--Documentation/git-rebase.adoc8
-rw-r--r--Documentation/git-refs.adoc11
-rw-r--r--Documentation/gitprotocol-v2.adoc10
-rwxr-xr-xGIT-VERSION-GEN2
-rw-r--r--Makefile8
-rw-r--r--builtin/bugreport.c13
-rw-r--r--builtin/check-mailmap.c2
-rw-r--r--builtin/merge-tree.c11
-rw-r--r--builtin/refs.c3
-rw-r--r--compat/mingw.c4
-rw-r--r--connect.c2
-rw-r--r--contrib/credential/libsecret/Makefile3
-rw-r--r--contrib/credential/osxkeychain/Makefile1
-rw-r--r--contrib/credential/wincred/Makefile3
-rw-r--r--contrib/diff-highlight/Makefile3
-rw-r--r--contrib/diff-highlight/t/Makefile5
-rw-r--r--contrib/mw-to-git/Makefile5
-rw-r--r--contrib/mw-to-git/t/Makefile3
-rw-r--r--contrib/persistent-https/Makefile5
-rw-r--r--contrib/subtree/t/Makefile5
-rw-r--r--diff.c4
-rw-r--r--git-gui/Makefile1
-rw-r--r--git-gui/po/glossary/Makefile3
-rw-r--r--meson.build17
-rw-r--r--refs.c8
-rw-r--r--refs.h5
-rw-r--r--refspec.c34
-rw-r--r--refspec.h9
-rw-r--r--remote.c6
-rw-r--r--sequencer.c12
-rw-r--r--t/interop/Makefile5
-rw-r--r--t/perf/Makefile5
-rwxr-xr-xt/t1460-refs-migrate.sh28
-rwxr-xr-xt/t3404-rebase-interactive.sh14
-rwxr-xr-xt/t3430-rebase-merges.sh20
-rwxr-xr-xt/t4203-mailmap.sh12
-rwxr-xr-xt/t4209-log-pickaxe.sh16
-rwxr-xr-xt/t5701-git-serve.sh26
-rw-r--r--t/test-lib-functions.sh8
-rw-r--r--templates/Makefile5
-rw-r--r--version.c69
-rw-r--r--version.h10
-rw-r--r--xdiff/xdiffi.c3
-rw-r--r--xdiff/xemit.c2
-rw-r--r--xdiff/xhistogram.c8
-rw-r--r--xdiff/xinclude.h2
-rw-r--r--xdiff/xpatience.c3
-rw-r--r--xdiff/xutils.c4
52 files changed, 383 insertions, 109 deletions
diff --git a/Documentation/Makefile b/Documentation/Makefile
index a734c6d624..c9a7cf662f 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,3 +1,6 @@
+# The default target of this Makefile is...
+all::
+
# Import tree-wide shared Makefile behavior and libraries
include ../shared.mak
@@ -238,7 +241,7 @@ DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR))
ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)'
endif
-all: html man
+all:: html man
html: $(DOC_HTML)
diff --git a/Documentation/RelNotes/2.49.0.adoc b/Documentation/RelNotes/2.49.0.adoc
index 83bab70cb6..2e9aa0d69f 100644
--- a/Documentation/RelNotes/2.49.0.adoc
+++ b/Documentation/RelNotes/2.49.0.adoc
@@ -35,6 +35,9 @@ UI, Workflows & Features
* Comes with an updated "gitk".
+ * The documentation of "git commit" and "git rebase" now refer to
+ commit titles as such, not "subject".
+
Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
@@ -204,6 +207,25 @@ Fixes since v2.48
* A thunderbird helper script lost its bashism.
(merge 59d26bd961 bc/contrib-thunderbird-patch-inline-fix later to maint).
+ * The -G/-S options to the "diff" family of commands caused us to hit
+ a BUG() when they get no values; they have been corrected.
+ (merge a620046b29 bc/diff-reject-empty-arg-to-pickaxe later to maint).
+
+ * "git merge-tree --stdin" has been improved (including a workaround
+ for a deadlock).
+ (merge 6a9ae81015 pw/merge-tree-stdin-deadlock-fix later to maint).
+
+ * Correct the default target in Documentation/Makefile, and
+ future-proof all Makefiles from similar breakages by declaring the
+ default target (which happens to be "all") upfront.
+ (merge 5309c1e9fb ad/set-default-target-in-makefiles later to maint).
+
+ * "git check-mailmap" used to segfault when queried without human
+ readable name.
+ (merge bb60c52131 jk/check-mailmap-wo-name-fix later to maint).
+
+ * Support for renaming of symbolic links on Windows has been improved.
+
* Other code cleanup, docfix, build fix, etc.
(merge ddb5287894 jk/t7407-use-test-grep later to maint).
(merge 21e1b44865 aj/difftool-config-doc-fix later to maint).
diff --git a/Documentation/git-commit.adoc b/Documentation/git-commit.adoc
index dfb78169cb..dc219025f1 100644
--- a/Documentation/git-commit.adoc
+++ b/Documentation/git-commit.adoc
@@ -98,8 +98,8 @@ OPTIONS
replaces the log message of _<commit>_ with its own log message
but makes no changes to the content of _<commit>_.
+
-The commit created by plain `--fixup=<commit>` has a subject
-composed of "fixup!" followed by the subject line from _<commit>_,
+The commit created by plain `--fixup=<commit>` has a title
+composed of "fixup!" followed by the title of _<commit>_,
and is recognized specially by `git rebase --autosquash`. The `-m`
option may be used to supplement the log message of the created
commit, but the additional commentary will be thrown away once the
@@ -107,7 +107,7 @@ commit, but the additional commentary will be thrown away once the
`git rebase --autosquash`.
+
The commit created by `--fixup=amend:<commit>` is similar but its
-subject is instead prefixed with "amend!". The log message of
+title is instead prefixed with "amend!". The log message of
_<commit>_ is copied into the log message of the "amend!" commit and
opened in an editor so it can be refined. When `git rebase
--autosquash` squashes the "amend!" commit into _<commit>_, the
@@ -128,7 +128,7 @@ See linkgit:git-rebase[1] for details.
`--squash=<commit>`::
Construct a commit message for use with `git rebase --autosquash`.
- The commit message subject line is taken from the specified
+ The commit message title is taken from the specified
commit with a prefix of "squash! ". Can be used with additional
commit message options (`-m`/`-c`/`-C`/`-F`). See
linkgit:git-rebase[1] for details.
diff --git a/Documentation/git-merge-tree.adoc b/Documentation/git-merge-tree.adoc
index 0b6a8a19b1..cf0578f9b5 100644
--- a/Documentation/git-merge-tree.adoc
+++ b/Documentation/git-merge-tree.adoc
@@ -40,11 +40,17 @@ After the merge completes, a new toplevel tree object is created. See
OPTIONS
-------
+--stdin::
+ Read the commits to merge from the standard input rather than
+ the command-line. See <<INPUT,INPUT FORMAT>> below for more
+ information. Implies `-z`.
+
-z::
Do not quote filenames in the <Conflicted file info> section,
and end each filename with a NUL character rather than
newline. Also begin the messages section with a NUL character
- instead of a newline. See <<OUTPUT>> below for more information.
+ instead of a newline. See <<OUTPUT,OUTPUT>> below for more
+ information.
--name-only::
In the Conflicted file info section, instead of writing a list
@@ -116,8 +122,6 @@ This is an integer status followed by a NUL character. The integer status is:
0: merge had conflicts
1: merge was clean
- <0: something prevented the merge from running (e.g. access to repository
- objects denied by filesystem)
[[OIDTLT]]
OID of toplevel tree
@@ -235,6 +239,7 @@ with linkgit:git-merge[1]:
* any messages that would have been printed to stdout (the
<<IM,Informational messages>>)
+[[INPUT]]
INPUT FORMAT
------------
'git merge-tree --stdin' input format is fully text based. Each line
diff --git a/Documentation/git-rebase.adoc b/Documentation/git-rebase.adoc
index 133fe8c5e6..153cb69a4f 100644
--- a/Documentation/git-rebase.adoc
+++ b/Documentation/git-rebase.adoc
@@ -599,11 +599,11 @@ See also INCOMPATIBLE OPTIONS below.
--no-autosquash::
Automatically squash commits with specially formatted messages into
previous commits being rebased. If a commit message starts with
- "squash! ", "fixup! " or "amend! ", the remainder of the subject line
+ "squash! ", "fixup! " or "amend! ", the remainder of the title
is taken as a commit specifier, which matches a previous commit if it
- matches the subject line or the hash of that commit. If no commit
+ matches the title or the hash of that commit. If no commit
matches fully, matches of the specifier with the start of commit
- subjects are considered.
+ titles are considered.
+
In the rebase todo list, the actions of squash, fixup and amend commits are
changed from `pick` to `squash`, `fixup` or `fixup -C`, respectively, and they
@@ -613,7 +613,7 @@ be used to review and edit the todo list before proceeding.
The recommended way to create commits with squash markers is by using the
`--squash`, `--fixup`, `--fixup=amend:` or `--fixup=reword:` options of
linkgit:git-commit[1], which take the target commit as an argument and
-automatically fill in the subject line of the new commit from that.
+automatically fill in the title of the new commit from that.
+
Setting configuration variable `rebase.autoSquash` to true enables
auto-squashing by default for interactive rebase. The `--no-autosquash`
diff --git a/Documentation/git-refs.adoc b/Documentation/git-refs.adoc
index 95f25776aa..4d6dc994f9 100644
--- a/Documentation/git-refs.adoc
+++ b/Documentation/git-refs.adoc
@@ -8,9 +8,9 @@ git-refs - Low-level access to refs
SYNOPSIS
--------
-[verse]
-'git refs migrate' --ref-format=<format> [--dry-run]
-'git refs verify' [--strict] [--verbose]
+[synopsis]
+git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]
+git refs verify [--strict] [--verbose]
DESCRIPTION
-----------
@@ -43,6 +43,11 @@ include::ref-storage-format.adoc[]
can be used to double check that the migration works as expected before
performing the actual migration.
+--reflog::
+--no-reflog::
+ Choose between migrating the reflog data to the new backend,
+ and discarding them. The default is "--reflog", to migrate.
+
The following options are specific to 'git refs verify':
--strict::
diff --git a/Documentation/gitprotocol-v2.adoc b/Documentation/gitprotocol-v2.adoc
index 1652fef3ae..9f6350bbf2 100644
--- a/Documentation/gitprotocol-v2.adoc
+++ b/Documentation/gitprotocol-v2.adoc
@@ -184,9 +184,13 @@ form `agent=X`) to notify the client that the server is running version
the `agent` capability with a value `Y` (in the form `agent=Y`) in its
request to the server (but it MUST NOT do so if the server did not
advertise the agent capability). The `X` and `Y` strings may contain any
-printable ASCII characters except space (i.e., the byte range 32 < x <
-127), and are typically of the form "package/version" (e.g.,
-"git/1.8.3.1"). The agent strings are purely informative for statistics
+printable ASCII characters except space (i.e., the byte range 33 <= x <=
+126), and are typically of the form "package/version-os" (e.g.,
+"git/1.8.3.1-Linux") where `os` is the operating system name (e.g.,
+"Linux"). `X` and `Y` can be configured using the GIT_USER_AGENT
+environment variable and it takes priority. The `os` is
+retrieved using the 'sysname' field of the `uname(2)` system call
+or its equivalent. The agent strings are purely informative for statistics
and debugging purposes, and MUST NOT be used to programmatically assume
the presence or absence of particular features.
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 56b45333c1..67fa0401cf 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,6 +1,6 @@
#!/bin/sh
-DEF_VER=v2.48.GIT
+DEF_VER=v2.49.0-rc0
LF='
'
diff --git a/Makefile b/Makefile
index bcf5ed3f85..6d45093089 100644
--- a/Makefile
+++ b/Makefile
@@ -1704,16 +1704,16 @@ IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
ifdef ZLIB_NG
BASIC_CFLAGS += -DHAVE_ZLIB_NG
- ifdef ZLIB_NG_PATH
+ ifdef ZLIB_NG_PATH
BASIC_CFLAGS += -I$(ZLIB_NG_PATH)/include
EXTLIBS += $(call libpath_template,$(ZLIB_NG_PATH)/$(lib))
- endif
+ endif
EXTLIBS += -lz-ng
else
- ifdef ZLIB_PATH
+ ifdef ZLIB_PATH
BASIC_CFLAGS += -I$(ZLIB_PATH)/include
EXTLIBS += $(call libpath_template,$(ZLIB_PATH)/$(lib))
- endif
+ endif
EXTLIBS += -lz
endif
diff --git a/builtin/bugreport.c b/builtin/bugreport.c
index 0ac59cc8dc..66d64bfd5a 100644
--- a/builtin/bugreport.c
+++ b/builtin/bugreport.c
@@ -12,10 +12,10 @@
#include "diagnose.h"
#include "object-file.h"
#include "setup.h"
+#include "version.h"
static void get_system_info(struct strbuf *sys_info)
{
- struct utsname uname_info;
char *shell = NULL;
/* get git version from native cmd */
@@ -24,16 +24,7 @@ static void get_system_info(struct strbuf *sys_info)
/* system call for other version info */
strbuf_addstr(sys_info, "uname: ");
- if (uname(&uname_info))
- strbuf_addf(sys_info, _("uname() failed with error '%s' (%d)\n"),
- strerror(errno),
- errno);
- else
- strbuf_addf(sys_info, "%s %s %s %s\n",
- uname_info.sysname,
- uname_info.release,
- uname_info.version,
- uname_info.machine);
+ get_uname_info(sys_info, 1);
strbuf_addstr(sys_info, _("compiler info: "));
get_compiler_info(sys_info);
diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c
index df00b5ee13..be2cebe121 100644
--- a/builtin/check-mailmap.c
+++ b/builtin/check-mailmap.c
@@ -35,7 +35,7 @@ static void check_mailmap(struct string_list *mailmap, const char *contact)
mail = ident.mail_begin;
maillen = ident.mail_end - ident.mail_begin;
} else {
- name = NULL;
+ name = "";
namelen = 0;
mail = contact;
maillen = strlen(contact);
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index 9a6c8b4e4c..3ec7127b3a 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -18,6 +18,7 @@
#include "tree.h"
#include "config.h"
#include "strvec.h"
+#include "write-or-die.h"
static int line_termination = '\n';
@@ -575,7 +576,7 @@ int cmd_merge_tree(int argc,
};
/* Init merge options */
- init_ui_merge_options(&o.merge_options, the_repository);
+ init_basic_merge_options(&o.merge_options, the_repository);
/* Parse arguments */
original_argc = argc - 1; /* ignoring argv[0] */
@@ -600,7 +601,6 @@ int cmd_merge_tree(int argc,
line_termination = '\0';
while (strbuf_getline_lf(&buf, stdin) != EOF) {
struct strbuf **split;
- int result;
const char *input_merge_base = NULL;
split = strbuf_split(&buf, ' ');
@@ -617,15 +617,14 @@ int cmd_merge_tree(int argc,
if (input_merge_base && split[2] && split[3] && !split[4]) {
strbuf_rtrim(split[2]);
strbuf_rtrim(split[3]);
- result = real_merge(&o, input_merge_base, split[2]->buf, split[3]->buf, prefix);
+ real_merge(&o, input_merge_base, split[2]->buf, split[3]->buf, prefix);
} else if (!input_merge_base && !split[2]) {
- result = real_merge(&o, NULL, split[0]->buf, split[1]->buf, prefix);
+ real_merge(&o, NULL, split[0]->buf, split[1]->buf, prefix);
} else {
die(_("malformed input line: '%s'."), buf.buf);
}
+ maybe_flush_or_die(stdout, "stdout");
- if (result < 0)
- die(_("merging cannot continue; got unclean result of %d"), result);
strbuf_list_free(split);
}
strbuf_release(&buf);
diff --git a/builtin/refs.c b/builtin/refs.c
index a29f195834..c459507d51 100644
--- a/builtin/refs.c
+++ b/builtin/refs.c
@@ -30,6 +30,9 @@ static int cmd_refs_migrate(int argc, const char **argv, const char *prefix,
OPT_BIT(0, "dry-run", &flags,
N_("perform a non-destructive dry-run"),
REPO_MIGRATE_REF_STORAGE_FORMAT_DRYRUN),
+ OPT_BIT(0, "no-reflog", &flags,
+ N_("drop reflogs entirely during the migration"),
+ REPO_MIGRATE_REF_STORAGE_FORMAT_SKIP_REFLOG),
OPT_END(),
};
struct strbuf errbuf = STRBUF_INIT;
diff --git a/compat/mingw.c b/compat/mingw.c
index 1d5b211b54..f524c54d06 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2278,7 +2278,9 @@ repeat:
old_handle = CreateFileW(wpold, DELETE,
FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
- NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+ NULL, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
+ NULL);
if (old_handle == INVALID_HANDLE_VALUE) {
errno = err_win_to_posix(GetLastError());
return -1;
diff --git a/connect.c b/connect.c
index 91f3990014..e6e25a0479 100644
--- a/connect.c
+++ b/connect.c
@@ -624,7 +624,7 @@ const char *parse_feature_value(const char *feature_list, const char *feature, s
*offset = found + len - orig_start;
return value;
}
- /* feature with a value (e.g., "agent=git/1.2.3") */
+ /* feature with a value (e.g., "agent=git/1.2.3-Linux") */
else if (*value == '=') {
size_t end;
diff --git a/contrib/credential/libsecret/Makefile b/contrib/credential/libsecret/Makefile
index 3e67552cc5..97ce9c92fb 100644
--- a/contrib/credential/libsecret/Makefile
+++ b/contrib/credential/libsecret/Makefile
@@ -1,3 +1,6 @@
+# The default target of this Makefile is...
+all::
+
MAIN:=git-credential-libsecret
all:: $(MAIN)
diff --git a/contrib/credential/osxkeychain/Makefile b/contrib/credential/osxkeychain/Makefile
index 238f5f8c36..0948297e20 100644
--- a/contrib/credential/osxkeychain/Makefile
+++ b/contrib/credential/osxkeychain/Makefile
@@ -1,3 +1,4 @@
+# The default target of this Makefile is...
all:: git-credential-osxkeychain
CC = gcc
diff --git a/contrib/credential/wincred/Makefile b/contrib/credential/wincred/Makefile
index 6e992c0866..5b795fc9fe 100644
--- a/contrib/credential/wincred/Makefile
+++ b/contrib/credential/wincred/Makefile
@@ -1,4 +1,5 @@
-all: git-credential-wincred.exe
+# The default target of this Makefile is...
+all:: git-credential-wincred.exe
-include ../../../config.mak.autogen
-include ../../../config.mak
diff --git a/contrib/diff-highlight/Makefile b/contrib/diff-highlight/Makefile
index f2be7cc924..33c2ccc9f7 100644
--- a/contrib/diff-highlight/Makefile
+++ b/contrib/diff-highlight/Makefile
@@ -1,4 +1,5 @@
-all: diff-highlight
+# The default target of this Makefile is...
+all:: diff-highlight
PERL_PATH = /usr/bin/perl
-include ../../config.mak
diff --git a/contrib/diff-highlight/t/Makefile b/contrib/diff-highlight/t/Makefile
index 5ff5275496..2a98541477 100644
--- a/contrib/diff-highlight/t/Makefile
+++ b/contrib/diff-highlight/t/Makefile
@@ -1,3 +1,6 @@
+# The default target of this Makefile is...
+all::
+
-include ../../../config.mak.autogen
-include ../../../config.mak
@@ -6,7 +9,7 @@ SHELL_PATH ?= $(SHELL)
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
-all: test
+all:: test
test: $(T)
.PHONY: help clean all test $(T)
diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
index 4e603512a3..497ac434d6 100644
--- a/contrib/mw-to-git/Makefile
+++ b/contrib/mw-to-git/Makefile
@@ -12,6 +12,9 @@
#
# make install
+# The default target of this Makefile is...
+all::
+
GIT_MEDIAWIKI_PM=Git/Mediawiki.pm
SCRIPT_PERL=git-remote-mediawiki.perl
SCRIPT_PERL+=git-mw.perl
@@ -27,7 +30,7 @@ INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/ \
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
INSTLIBDIR_SQ = $(subst ','\'',$(INSTLIBDIR))
-all: build
+all:: build
test: all
$(MAKE) -C t
diff --git a/contrib/mw-to-git/t/Makefile b/contrib/mw-to-git/t/Makefile
index f422203fa0..6c9f377caa 100644
--- a/contrib/mw-to-git/t/Makefile
+++ b/contrib/mw-to-git/t/Makefile
@@ -8,7 +8,8 @@
#
## Test git-remote-mediawiki
-all: test
+# The default target of this Makefile is...
+all:: test
-include ../../../config.mak.autogen
-include ../../../config.mak
diff --git a/contrib/persistent-https/Makefile b/contrib/persistent-https/Makefile
index 52b84ba3d4..691737e76b 100644
--- a/contrib/persistent-https/Makefile
+++ b/contrib/persistent-https/Makefile
@@ -12,10 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# The default target of this Makefile is...
+all::
+
BUILD_LABEL=$(shell cut -d" " -f3 ../../GIT-VERSION-FILE)
TAR_OUT=$(shell go env GOOS)_$(shell go env GOARCH).tar.gz
-all: git-remote-persistent-https git-remote-persistent-https--proxy \
+all:: git-remote-persistent-https git-remote-persistent-https--proxy \
git-remote-persistent-http
git-remote-persistent-https--proxy: git-remote-persistent-https
diff --git a/contrib/subtree/t/Makefile b/contrib/subtree/t/Makefile
index 093399c788..2a85f5ee84 100644
--- a/contrib/subtree/t/Makefile
+++ b/contrib/subtree/t/Makefile
@@ -3,6 +3,9 @@
# Copyright (c) 2005 Junio C Hamano
#
+# The default target of this Makefile is...
+all::
+
-include ../../../config.mak.autogen
-include ../../../config.mak
@@ -31,7 +34,7 @@ TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh))
THELPERS = $(sort $(filter-out $(T),$(wildcard *.sh)))
-all: $(DEFAULT_TEST_TARGET)
+all:: $(DEFAULT_TEST_TARGET)
test: pre-clean $(TEST_LINT)
$(MAKE) aggregate-results-and-cleanup
diff --git a/diff.c b/diff.c
index 019fb893a7..c89c15d98e 100644
--- a/diff.c
+++ b/diff.c
@@ -5493,6 +5493,8 @@ static int diff_opt_pickaxe_regex(const struct option *opt,
BUG_ON_OPT_NEG(unset);
options->pickaxe = arg;
options->pickaxe_opts |= DIFF_PICKAXE_KIND_G;
+ if (arg && !*arg)
+ return error(_("-G requires a non-empty argument"));
return 0;
}
@@ -5504,6 +5506,8 @@ static int diff_opt_pickaxe_string(const struct option *opt,
BUG_ON_OPT_NEG(unset);
options->pickaxe = arg;
options->pickaxe_opts |= DIFF_PICKAXE_KIND_S;
+ if (arg && !*arg)
+ return error(_("-S requires a non-empty argument"));
return 0;
}
diff --git a/git-gui/Makefile b/git-gui/Makefile
index 667c39ed56..6c5a12bc32 100644
--- a/git-gui/Makefile
+++ b/git-gui/Makefile
@@ -1,3 +1,4 @@
+# The default target of this Makefile is...
all::
# Define V=1 to have a more verbose compile.
diff --git a/git-gui/po/glossary/Makefile b/git-gui/po/glossary/Makefile
index 749aa2e7ec..e656b0d2b0 100644
--- a/git-gui/po/glossary/Makefile
+++ b/git-gui/po/glossary/Makefile
@@ -1,3 +1,6 @@
+# The default target of this Makefile is...
+update-po::
+
PO_TEMPLATE = git-gui-glossary.pot
ALL_POFILES = $(wildcard *.po)
diff --git a/meson.build b/meson.build
index bf95576f83..021a182135 100644
--- a/meson.build
+++ b/meson.build
@@ -778,7 +778,22 @@ endif
# Note that we only set NO_PERL if the Perl features were disabled by the user.
# It may not be set when we have found Perl, but only use it to run tests.
-perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+#
+# At the time of writing, executing `perl --version` results in a string
+# similar to the following output:
+#
+# This is perl 5, version 40, subversion 0 (v5.40.0) built for x86_64-linux-thread-multi
+#
+# Meson picks up the "40" as version number instead of using "v5.40.0"
+# due to the regular expression it uses. This got fixed in Meson 1.7.0,
+# but meanwhile we have to either use `-V:version` instead of `--version`,
+# which we can do starting with Meson 1.5.0 and newer, or we have to
+# match against the minor version.
+if meson.version().version_compare('>=1.5.0')
+ perl = find_program('perl', dirs: program_path, required: perl_required, version: '>=5.26.0', version_argument: '-V:version')
+else
+ perl = find_program('perl', dirs: program_path, required: perl_required, version: '>=26')
+endif
perl_features_enabled = perl.found() and get_option('perl').allowed()
if perl_features_enabled
build_options_config.set('NO_PERL', '')
diff --git a/refs.c b/refs.c
index e1a6a2d189..91da5325d7 100644
--- a/refs.c
+++ b/refs.c
@@ -3043,9 +3043,11 @@ int repo_migrate_ref_storage_format(struct repository *repo,
if (ret < 0)
goto done;
- ret = refs_for_each_reflog(old_refs, migrate_one_reflog, &data);
- if (ret < 0)
- goto done;
+ if (!(flags & REPO_MIGRATE_REF_STORAGE_FORMAT_SKIP_REFLOG)) {
+ ret = refs_for_each_reflog(old_refs, migrate_one_reflog, &data);
+ if (ret < 0)
+ goto done;
+ }
ret = ref_transaction_commit(transaction, errbuf);
if (ret < 0)
diff --git a/refs.h b/refs.h
index 09be47afbe..2ed14fdb16 100644
--- a/refs.h
+++ b/refs.h
@@ -1143,8 +1143,11 @@ int is_pseudo_ref(const char *refname);
* - REPO_MIGRATE_REF_STORAGE_FORMAT_DRYRUN: perform a dry-run migration
* without touching the main repository. The result will be written into a
* temporary ref storage directory.
+ *
+ * - REPO_MIGRATE_REF_STORAGE_FORMAT_SKIP_REFLOG: skip migration of reflogs.
*/
-#define REPO_MIGRATE_REF_STORAGE_FORMAT_DRYRUN (1 << 0)
+#define REPO_MIGRATE_REF_STORAGE_FORMAT_DRYRUN (1 << 0)
+#define REPO_MIGRATE_REF_STORAGE_FORMAT_SKIP_REFLOG (1 << 1)
/*
* Migrate the ref storage format used by the repository to the
diff --git a/refspec.c b/refspec.c
index 3d6cf4dc92..4cb80b5208 100644
--- a/refspec.c
+++ b/refspec.c
@@ -269,28 +269,28 @@ void refspec_ref_prefixes(const struct refspec *rs,
}
}
-int match_name_with_pattern(const char *key, const char *name,
- const char *value, char **result)
+int match_refname_with_pattern(const char *pattern, const char *refname,
+ const char *replacement, char **result)
{
- const char *kstar = strchr(key, '*');
+ const char *kstar = strchr(pattern, '*');
size_t klen;
size_t ksuffixlen;
size_t namelen;
int ret;
if (!kstar)
- die(_("key '%s' of pattern had no '*'"), key);
- klen = kstar - key;
+ die(_("pattern '%s' has no '*'"), pattern);
+ klen = kstar - pattern;
ksuffixlen = strlen(kstar + 1);
- namelen = strlen(name);
- ret = !strncmp(name, key, klen) && namelen >= klen + ksuffixlen &&
- !memcmp(name + namelen - ksuffixlen, kstar + 1, ksuffixlen);
- if (ret && value) {
+ namelen = strlen(refname);
+ ret = !strncmp(refname, pattern, klen) && namelen >= klen + ksuffixlen &&
+ !memcmp(refname + namelen - ksuffixlen, kstar + 1, ksuffixlen);
+ if (ret && replacement) {
struct strbuf sb = STRBUF_INIT;
- const char *vstar = strchr(value, '*');
+ const char *vstar = strchr(replacement, '*');
if (!vstar)
- die(_("value '%s' of pattern has no '*'"), value);
- strbuf_add(&sb, value, vstar - value);
- strbuf_add(&sb, name + klen, namelen - klen - ksuffixlen);
+ die(_("replacement '%s' has no '*'"), replacement);
+ strbuf_add(&sb, replacement, vstar - replacement);
+ strbuf_add(&sb, refname + klen, namelen - klen - ksuffixlen);
strbuf_addstr(&sb, vstar + 1);
*result = strbuf_detach(&sb, NULL);
}
@@ -301,7 +301,7 @@ static int refspec_match(const struct refspec_item *refspec,
const char *name)
{
if (refspec->pattern)
- return match_name_with_pattern(refspec->src, name, NULL, NULL);
+ return match_refname_with_pattern(refspec->src, name, NULL, NULL);
return !strcmp(refspec->src, name);
}
@@ -352,7 +352,7 @@ static int refspec_find_negative_match(struct refspec *rs, struct refspec_item *
const char *key = refspec->dst ? refspec->dst : refspec->src;
const char *value = refspec->src;
- if (match_name_with_pattern(key, needle, value, &expn_name))
+ if (match_refname_with_pattern(key, needle, value, &expn_name))
string_list_append_nodup(&reversed, expn_name);
} else if (refspec->matching) {
/* For the special matching refspec, any query should match */
@@ -397,7 +397,7 @@ void refspec_find_all_matches(struct refspec *rs,
if (!refspec->dst || refspec->negative)
continue;
if (refspec->pattern) {
- if (match_name_with_pattern(key, needle, value, result))
+ if (match_refname_with_pattern(key, needle, value, result))
string_list_append_nodup(results, *result);
} else if (!strcmp(needle, key)) {
string_list_append(results, value);
@@ -426,7 +426,7 @@ int refspec_find_match(struct refspec *rs, struct refspec_item *query)
if (!refspec->dst || refspec->negative)
continue;
if (refspec->pattern) {
- if (match_name_with_pattern(key, needle, value, result)) {
+ if (match_refname_with_pattern(key, needle, value, result)) {
query->force = refspec->force;
return 0;
}
diff --git a/refspec.h b/refspec.h
index f62f83a7ee..e2b5cc54ef 100644
--- a/refspec.h
+++ b/refspec.h
@@ -75,11 +75,12 @@ void refspec_ref_prefixes(const struct refspec *rs,
int refname_matches_negative_refspec_item(const char *refname, struct refspec *rs);
/*
- * Checks whether a name matches a pattern and optionally generates a result.
- * Returns 1 if the name matches the pattern, 0 otherwise.
+ * Checks if a refname matches a globbing refspec pattern.
+ * If replacement is provided, computes the corresponding mapped refname.
+ * Returns 1 if refname matches pattern, 0 otherwise.
*/
-int match_name_with_pattern(const char *key, const char *name,
- const char *value, char **result);
+int match_refname_with_pattern(const char *pattern, const char *refname,
+ const char *replacement, char **result);
/*
* Queries a refspec for a match and updates the query item.
diff --git a/remote.c b/remote.c
index c1cf363cca..c9c1384c1d 100644
--- a/remote.c
+++ b/remote.c
@@ -1322,9 +1322,9 @@ static char *get_ref_match(const struct refspec *rs, const struct ref *ref,
const char *dst_side = item->dst ? item->dst : item->src;
int match;
if (direction == FROM_SRC)
- match = match_name_with_pattern(item->src, ref->name, dst_side, &name);
+ match = match_refname_with_pattern(item->src, ref->name, dst_side, &name);
else
- match = match_name_with_pattern(dst_side, ref->name, item->src, &name);
+ match = match_refname_with_pattern(dst_side, ref->name, item->src, &name);
if (match) {
matching_refs = i;
break;
@@ -1942,7 +1942,7 @@ static struct ref *get_expanded_map(const struct ref *remote_refs,
if (strchr(ref->name, '^'))
continue; /* a dereference item */
- if (match_name_with_pattern(refspec->src, ref->name,
+ if (match_refname_with_pattern(refspec->src, ref->name,
refspec->dst, &expn_name) &&
!ignore_symref_update(expn_name, &scratch)) {
struct ref *cpy = copy_ref(ref);
diff --git a/sequencer.c b/sequencer.c
index 407ee4e90f..ad0ab75c8d 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2510,9 +2510,15 @@ static int do_pick_commit(struct repository *r,
*check_todo = !!(flags & EDIT_MSG);
if (!res && reword) {
fast_forward_edit:
- res = run_git_commit(NULL, opts, EDIT_MSG |
- VERIFY_MSG | AMEND_MSG |
- (flags & ALLOW_EMPTY));
+ /*
+ * To reword we amend the commit we just
+ * picked or fast-forwarded. As the commit has
+ * already been picked we want to use the same
+ * set of commit flags regardless of how we
+ * got here.
+ */
+ flags = EDIT_MSG | VERIFY_MSG | AMEND_MSG | ALLOW_EMPTY;
+ res = run_git_commit(NULL, opts, flags);
*check_todo = 1;
}
}
diff --git a/t/interop/Makefile b/t/interop/Makefile
index 6911c2915a..4ff4ed0616 100644
--- a/t/interop/Makefile
+++ b/t/interop/Makefile
@@ -1,3 +1,6 @@
+# The default target of this Makefile is...
+all::
+
# Import tree-wide shared Makefile behavior and libraries
include ../../shared.mak
@@ -8,7 +11,7 @@ SHELL_PATH ?= $(SHELL)
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
T = $(sort $(wildcard i[0-9][0-9][0-9][0-9]-*.sh))
-all: $(T)
+all:: $(T)
$(T):
@echo "*** $@ ***"; '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
diff --git a/t/perf/Makefile b/t/perf/Makefile
index e4808aebed..9b3090c4ed 100644
--- a/t/perf/Makefile
+++ b/t/perf/Makefile
@@ -1,10 +1,13 @@
+# The default target of this Makefile is...
+all::
+
# Import tree-wide shared Makefile behavior and libraries
include ../../shared.mak
-include ../../config.mak
export GIT_TEST_OPTIONS
-all: test-lint perf
+all:: test-lint perf
perf: pre-clean
./run
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index a6d9b35a46..2ab97e1b7d 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -9,14 +9,21 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
# Migrate the provided repository from one format to the other and
# verify that the references and logs are migrated over correctly.
-# Usage: test_migration <repo> <format> <skip_reflog_verify>
+# Usage: test_migration <repo> <format> [<skip_reflog_verify> [<options...>]]
# <repo> is the relative path to the repo to be migrated.
# <format> is the ref format to be migrated to.
-# <skip_reflog_verify> (true or false) whether to skip reflog verification.
+# <skip_reflog_verify> (default: false) whether to skip reflog verification.
+# <options...> are other options be passed directly to 'git refs migrate'.
test_migration () {
repo=$1 &&
format=$2 &&
- skip_reflog_verify=${3:-false} &&
+ shift 2 &&
+ skip_reflog_verify=false &&
+ if test $# -ge 1
+ then
+ skip_reflog_verify=$1
+ shift
+ fi &&
git -C "$repo" for-each-ref --include-root-refs \
--format='%(refname) %(objectname) %(symref)' >expect &&
if ! $skip_reflog_verify
@@ -25,7 +32,7 @@ test_migration () {
git -C "$repo" reflog list >expect_log_list
fi &&
- git -C "$repo" refs migrate --ref-format="$2" &&
+ git -C "$repo" refs migrate --ref-format="$format" "$@" &&
git -C "$repo" for-each-ref --include-root-refs \
--format='%(refname) %(objectname) %(symref)' >actual &&
@@ -241,6 +248,19 @@ do
test_cmp expect.reflog actual.reflog
)
'
+
+ test_expect_success "$from_format -> $to_format: skip reflog with --skip-reflog" '
+ test_when_finished "rm -rf repo" &&
+ git init --ref-format=$from_format repo &&
+ test_commit -C repo initial &&
+ # we see that the repository contains reflogs.
+ git -C repo reflog --all >reflogs &&
+ test_line_count = 2 reflogs &&
+ test_migration repo "$to_format" true --no-reflog &&
+ # there should be no reflogs post migration.
+ git -C repo reflog --all >reflogs &&
+ test_must_be_empty reflogs
+ '
done
done
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index ecfc02062c..2aee9789a2 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -791,6 +791,20 @@ test_expect_success 'reword' '
grep "C changed" actual
'
+test_expect_success 'reword fast-forwarded empty commit' '
+ git commit --allow-empty -m "empty commit" --only &&
+ (
+ set_fake_editor &&
+ FAKE_COMMIT_AMEND=edited FAKE_LINES="reword 1" \
+ git rebase -i HEAD^
+ ) &&
+ test_commit_message HEAD <<-\EOF
+ empty commit
+
+ edited
+ EOF
+'
+
test_expect_success 'no uncommitted changes when rewording and the todo list is reloaded' '
git checkout E &&
test_when_finished "git checkout @{-1}" &&
diff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh
index 2593711fec..b84d68c4b9 100755
--- a/t/t3430-rebase-merges.sh
+++ b/t/t3430-rebase-merges.sh
@@ -610,4 +610,24 @@ test_expect_success 'truncate label names' '
grep "label 0123456789-$" out
'
+test_expect_success 'reword fast-forwarded empty merge commit' '
+ oid="$(git commit-tree -m "D1" -p A D^{tree})" &&
+ oid="$(git commit-tree -m "empty merge" -p D -p $oid D^{tree})" &&
+
+ write_script sequence-editor.sh <<-\EOF &&
+ sed /^merge/s/-C/-c/ "$1" >"$1.tmp"
+ mv "$1.tmp" "$1"
+ EOF
+
+ (
+ test_set_sequence_editor "$(pwd)/sequence-editor.sh" &&
+ GIT_EDITOR="echo edited >>" git rebase -i -r D $oid
+ ) &&
+ test_commit_message HEAD <<-\EOF
+ empty merge
+
+ edited
+ EOF
+'
+
test_done
diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
index 2421491931..4a6242ff99 100755
--- a/t/t4203-mailmap.sh
+++ b/t/t4203-mailmap.sh
@@ -113,6 +113,18 @@ test_expect_success 'check-mailmap --stdin simple address: no mapping' '
test_cmp expect actual
'
+test_expect_success 'check-mailmap name and address: mapping' '
+ test_when_finished "rm .mailmap" &&
+ cat >.mailmap <<-EOF &&
+ Bug Reports <bugs-new@company.xx> Bugs <bugs@company.xx>
+ EOF
+ cat >expect <<-EOF &&
+ <bugs@company.xx>
+ EOF
+ git check-mailmap "bugs@company.xx" >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'No mailmap' '
cat >expect <<-EOF &&
$GIT_AUTHOR_NAME (1):
diff --git a/t/t4209-log-pickaxe.sh b/t/t4209-log-pickaxe.sh
index a675ace081..0e2f80a268 100755
--- a/t/t4209-log-pickaxe.sh
+++ b/t/t4209-log-pickaxe.sh
@@ -93,6 +93,22 @@ test_expect_success 'usage: --no-pickaxe-regex' '
test_cmp expect actual
'
+test_expect_success 'usage: -G and -S with empty argument' '
+ cat >expect <<-\EOF &&
+ error: -S requires a non-empty argument
+ EOF
+
+ test_expect_code 129 git log -S "" 2>actual &&
+ test_cmp expect actual &&
+
+ cat >expect <<-\EOF &&
+ error: -G requires a non-empty argument
+ EOF
+
+ test_expect_code 129 git log -G "" 2>actual &&
+ test_cmp expect actual
+'
+
test_log expect_initial --grep initial
test_log expect_nomatch --grep InItial
test_log_icase expect_initial --grep InItial
diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh
index de904c1655..678a346ed0 100755
--- a/t/t5701-git-serve.sh
+++ b/t/t5701-git-serve.sh
@@ -7,24 +7,40 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-test_expect_success 'test capability advertisement' '
+test_expect_success 'setup to generate files with expected content' '
+ printf "agent=git/%s" "$(git version | cut -d" " -f3)" >agent_capability &&
+
test_oid_cache <<-EOF &&
wrong_algo sha1:sha256
wrong_algo sha256:sha1
EOF
+
+ if test_have_prereq WINDOWS
+ then
+ printf "agent=FAKE\n" >agent_capability
+ else
+ printf -- "-%s\n" $(uname -s | test_redact_non_printables) >>agent_capability
+ fi &&
cat >expect.base <<-EOF &&
version 2
- agent=git/$(git version | cut -d" " -f3)
+ $(cat agent_capability)
ls-refs=unborn
fetch=shallow wait-for-done
server-option
object-format=$(test_oid algo)
EOF
- cat >expect.trailer <<-EOF &&
+ cat >expect.trailer <<-EOF
0000
EOF
+'
+
+test_expect_success 'test capability advertisement' '
cat expect.base expect.trailer >expect &&
+ if test_have_prereq WINDOWS
+ then
+ GIT_USER_AGENT=FAKE && export GIT_USER_AGENT
+ fi &&
GIT_TEST_SIDEBAND_ALL=0 test-tool serve-v2 \
--advertise-capabilities >out &&
test-tool pkt-line unpack <out >actual &&
@@ -355,6 +371,10 @@ test_expect_success 'test capability advertisement with uploadpack.advertiseBund
expect.extra \
expect.trailer >expect &&
+ if test_have_prereq WINDOWS
+ then
+ GIT_USER_AGENT=FAKE && export GIT_USER_AGENT
+ fi &&
GIT_TEST_SIDEBAND_ALL=0 test-tool serve-v2 \
--advertise-capabilities >out &&
test-tool pkt-line unpack <out >actual &&
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index b93736e0d5..79377bc0fc 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -2043,3 +2043,11 @@ test_trailing_hash () {
test-tool hexdump |
sed "s/ //g"
}
+
+# Trim and replace each character with ascii code below 32 or above
+# 127 (included) using a dot '.' character.
+# Octal intervals \001-\040 and \177-\377
+# correspond to decimal intervals 1-32 and 127-255
+test_redact_non_printables () {
+ tr -d "\n\r" | tr "[\001-\040][\177-\377]" "."
+}
diff --git a/templates/Makefile b/templates/Makefile
index bd1e9e30c1..722755338d 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -1,3 +1,6 @@
+# The default target of this Makefile is...
+all::
+
# Import tree-wide shared Makefile behavior and libraries
include ../shared.mak
@@ -23,7 +26,7 @@ PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
template_instdir_SQ = $(subst ','\'',$(template_instdir))
-all: boilerplates.made custom
+all:: boilerplates.made custom
# Put templates that can be copied straight from the source
# in a file direc--tory--file in the source. They will be
diff --git a/version.c b/version.c
index 4786c4e0a5..279269cc50 100644
--- a/version.c
+++ b/version.c
@@ -1,6 +1,9 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
#include "git-compat-util.h"
#include "version.h"
#include "strbuf.h"
+#include "gettext.h"
#ifndef GIT_VERSION_H
# include "version-def.h"
@@ -11,6 +14,19 @@
const char git_version_string[] = GIT_VERSION;
const char git_built_from_commit_string[] = GIT_BUILT_FROM_COMMIT;
+/*
+ * Trim and replace each character with ascii code below 32 or above
+ * 127 (included) using a dot '.' character.
+ */
+static void redact_non_printables(struct strbuf *buf)
+{
+ strbuf_trim(buf);
+ for (size_t i = 0; i < buf->len; i++) {
+ if (!isprint(buf->buf[i]) || buf->buf[i] == ' ')
+ buf->buf[i] = '.';
+ }
+}
+
const char *git_user_agent(void)
{
static const char *agent = NULL;
@@ -24,6 +40,27 @@ const char *git_user_agent(void)
return agent;
}
+/*
+ Retrieve, sanitize and cache operating system info for subsequent
+ calls. Return a pointer to the sanitized operating system info
+ string.
+*/
+static const char *os_info(void)
+{
+ static const char *os = NULL;
+
+ if (!os) {
+ struct strbuf buf = STRBUF_INIT;
+
+ get_uname_info(&buf, 0);
+ /* Sanitize the os information immediately */
+ redact_non_printables(&buf);
+ os = strbuf_detach(&buf, NULL);
+ }
+
+ return os;
+}
+
const char *git_user_agent_sanitized(void)
{
static const char *agent = NULL;
@@ -32,13 +69,35 @@ const char *git_user_agent_sanitized(void)
struct strbuf buf = STRBUF_INIT;
strbuf_addstr(&buf, git_user_agent());
- strbuf_trim(&buf);
- for (size_t i = 0; i < buf.len; i++) {
- if (buf.buf[i] <= 32 || buf.buf[i] >= 127)
- buf.buf[i] = '.';
+
+ if (!getenv("GIT_USER_AGENT")) {
+ strbuf_addch(&buf, '-');
+ strbuf_addstr(&buf, os_info());
}
- agent = buf.buf;
+ redact_non_printables(&buf);
+ agent = strbuf_detach(&buf, NULL);
}
return agent;
}
+
+int get_uname_info(struct strbuf *buf, unsigned int full)
+{
+ struct utsname uname_info;
+
+ if (uname(&uname_info)) {
+ strbuf_addf(buf, _("uname() failed with error '%s' (%d)\n"),
+ strerror(errno),
+ errno);
+ return -1;
+ }
+ if (full)
+ strbuf_addf(buf, "%s %s %s %s\n",
+ uname_info.sysname,
+ uname_info.release,
+ uname_info.version,
+ uname_info.machine);
+ else
+ strbuf_addf(buf, "%s\n", uname_info.sysname);
+ return 0;
+}
diff --git a/version.h b/version.h
index 7c62e80577..bbde6d371a 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,20 @@
#ifndef VERSION_H
#define VERSION_H
+struct repository;
+
extern const char git_version_string[];
extern const char git_built_from_commit_string[];
const char *git_user_agent(void);
const char *git_user_agent_sanitized(void);
+/*
+ Try to get information about the system using uname(2).
+ Return -1 and put an error message into 'buf' in case of uname()
+ error. Return 0 and put uname info into 'buf' otherwise.
+*/
+int get_uname_info(struct strbuf *buf, unsigned int full);
+
+
#endif /* VERSION_H */
diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c
index 4685ba6137..8889b8b62a 100644
--- a/xdiff/xdiffi.c
+++ b/xdiff/xdiffi.c
@@ -19,7 +19,6 @@
* Davide Libenzi <davidel@xmailserver.org>
*
*/
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "xinclude.h"
@@ -1014,7 +1013,7 @@ static void xdl_mark_ignorable_lines(xdchange_t *xscr, xdfenv_t *xe, long flags)
static int record_matches_regex(xrecord_t *rec, xpparam_t const *xpp) {
regmatch_t regmatch;
- int i;
+ size_t i;
for (i = 0; i < xpp->ignore_regex_nr; i++)
if (!regexec_buf(xpp->ignore_regex[i], rec->ptr, rec->size, 1,
diff --git a/xdiff/xemit.c b/xdiff/xemit.c
index 75f0fe4986..f8e3f25b03 100644
--- a/xdiff/xemit.c
+++ b/xdiff/xemit.c
@@ -54,7 +54,7 @@ xdchange_t *xdl_get_hunk(xdchange_t **xscr, xdemitconf_t const *xecfg)
xdchange_t *xch, *xchp, *lxch;
long max_common = 2 * xecfg->ctxlen + xecfg->interhunkctxlen;
long max_ignorable = xecfg->ctxlen;
- unsigned long ignored = 0; /* number of ignored blank lines */
+ long ignored = 0; /* number of ignored blank lines */
/* remove ignorable changes that are too far before other changes */
for (xchp = *xscr; xchp && xchp->ignore; xchp = xchp->next) {
diff --git a/xdiff/xhistogram.c b/xdiff/xhistogram.c
index 16a8fe2f3f..040d81e0bc 100644
--- a/xdiff/xhistogram.c
+++ b/xdiff/xhistogram.c
@@ -106,7 +106,7 @@ static int scanA(struct histindex *index, int line1, int count1)
unsigned int chain_len;
struct record **rec_chain, *rec;
- for (ptr = LINE_END(1); line1 <= ptr; ptr--) {
+ for (ptr = LINE_END(1); (unsigned int)line1 <= ptr; ptr--) {
tbl_idx = TABLE_HASH(index, 1, ptr);
rec_chain = index->records + tbl_idx;
rec = *rec_chain;
@@ -181,14 +181,14 @@ static int try_lcs(struct histindex *index, struct region *lcs, int b_ptr,
be = bs;
rc = rec->cnt;
- while (line1 < as && line2 < bs
+ while ((unsigned int)line1 < as && (unsigned int)line2 < bs
&& CMP(index, 1, as - 1, 2, bs - 1)) {
as--;
bs--;
if (1 < rc)
rc = XDL_MIN(rc, CNT(index, as));
}
- while (ae < LINE_END(1) && be < LINE_END(2)
+ while (ae < (unsigned int)LINE_END(1) && be < (unsigned int)LINE_END(2)
&& CMP(index, 1, ae + 1, 2, be + 1)) {
ae++;
be++;
@@ -313,7 +313,7 @@ redo:
if (count1 <= 0 && count2 <= 0)
return 0;
- if (LINE_END(1) >= MAX_PTR)
+ if ((unsigned int)LINE_END(1) >= MAX_PTR)
return -1;
if (!count1) {
diff --git a/xdiff/xinclude.h b/xdiff/xinclude.h
index 7e56542526..a4285ac0eb 100644
--- a/xdiff/xinclude.h
+++ b/xdiff/xinclude.h
@@ -23,8 +23,6 @@
#if !defined(XINCLUDE_H)
#define XINCLUDE_H
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "xmacros.h"
#include "xdiff.h"
diff --git a/xdiff/xpatience.c b/xdiff/xpatience.c
index a2d8955537..82f663004e 100644
--- a/xdiff/xpatience.c
+++ b/xdiff/xpatience.c
@@ -19,6 +19,7 @@
* Davide Libenzi <davidel@xmailserver.org>
*
*/
+
#include "xinclude.h"
/*
@@ -75,7 +76,7 @@ struct hashmap {
static int is_anchor(xpparam_t const *xpp, const char *line)
{
- int i;
+ size_t i;
for (i = 0; i < xpp->anchors_nr; i++) {
if (!strncmp(line, xpp->anchors[i], strlen(xpp->anchors[i])))
return 1;
diff --git a/xdiff/xutils.c b/xdiff/xutils.c
index 9e36f24875..444a108f87 100644
--- a/xdiff/xutils.c
+++ b/xdiff/xutils.c
@@ -375,7 +375,7 @@ static int xdl_format_hunk_hdr(long s1, long c1, long s2, long c2,
nb += 3;
if (func && funclen) {
buf[nb++] = ' ';
- if (funclen > sizeof(buf) - nb - 1)
+ if ((size_t)funclen > sizeof(buf) - nb - 1)
funclen = sizeof(buf) - nb - 1;
memcpy(buf + nb, func, funclen);
nb += funclen;
@@ -437,7 +437,7 @@ void* xdl_alloc_grow_helper(void *p, long nr, long *alloc, size_t size)
{
void *tmp = NULL;
size_t n = ((LONG_MAX - 16) / 2 >= *alloc) ? 2 * *alloc + 16 : LONG_MAX;
- if (nr > n)
+ if ((size_t)nr > n)
n = nr;
if (SIZE_MAX / size >= n)
tmp = xdl_realloc(p, n * size);