summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Xin <worldhello.net@gmail.com>2019-10-28 13:18:55 +0800
committerJiang Xin <worldhello.net@gmail.com>2019-10-28 13:18:55 +0800
commit468d356a811f527501bd408c97f5c12333b8bfe3 (patch)
treefd71542752e92600f28c63fa309f864c85989359
parentl10n: it.po: update the Italian translation for Git 2.24.0 (diff)
parentGit 2.24-rc1 (diff)
downloadgit-468d356a811f527501bd408c97f5c12333b8bfe3.tar.xz
git-468d356a811f527501bd408c97f5c12333b8bfe3.zip
Merge tag 'v2.24.0-rc1' of github.com:git/git into master
Git 2.24-rc1 * tag 'v2.24.0-rc1' of github.com:git/git: Git 2.24-rc1 repo-settings: read an int for index.version ci: fix GCC install in the Travis CI GCC OSX job Eleventh batch ci(osx): use new location of the `perforce` cask t7419: change test_must_fail to ! for grep t4014: make output-directory tests self-contained ci(visual-studio): actually run the tests in parallel ci(visual-studio): use strict compile flags, and optimization userdiff: fix some corner cases in dts regex test-progress: fix test failures on big-endian systems completion: clarify installation instruction for zsh grep: avoid leak of chartables in PCRE2 grep: make PCRE2 aware of custom allocator grep: make PCRE1 aware of custom allocator remote-curl: pass on atomic capability to remote side diff-highlight: fix a whitespace nit fsmonitor: don't fill bitmap with entries to be removed
-rw-r--r--Documentation/RelNotes/2.24.0.txt10
-rw-r--r--Documentation/gitremote-helpers.txt5
-rwxr-xr-xGIT-VERSION-GEN2
-rw-r--r--azure-pipelines.yml4
-rw-r--r--builtin/grep.c1
-rwxr-xr-xci/install-dependencies.sh6
-rw-r--r--contrib/completion/git-completion.zsh5
-rw-r--r--contrib/diff-highlight/DiffHighlight.pm2
-rw-r--r--fsmonitor.c29
-rw-r--r--grep.c47
-rw-r--r--grep.h2
-rw-r--r--remote-curl.c13
-rw-r--r--repo-settings.c2
-rw-r--r--t/helper/test-progress.c2
-rwxr-xr-xt/t1600-index.sh4
-rwxr-xr-xt/t4014-format-patch.sh13
-rw-r--r--t/t4018/dts-nodes-boolean-prop9
-rw-r--r--t/t4018/dts-nodes-multiline-prop13
-rw-r--r--t/t4018/dts-root2
-rw-r--r--t/t4018/dts-root-comment8
-rwxr-xr-xt/t5541-http-push-smart.sh40
-rwxr-xr-xt/t7419-submodule-set-branch.sh6
-rwxr-xr-xt/t7519-status-fsmonitor.sh17
-rwxr-xr-xt/t7519/fsmonitor-env24
-rw-r--r--transport-helper.c4
-rw-r--r--transport.h3
-rw-r--r--userdiff.c3
27 files changed, 247 insertions, 29 deletions
diff --git a/Documentation/RelNotes/2.24.0.txt b/Documentation/RelNotes/2.24.0.txt
index 4b442a9157c..125169d0daf 100644
--- a/Documentation/RelNotes/2.24.0.txt
+++ b/Documentation/RelNotes/2.24.0.txt
@@ -75,6 +75,9 @@ UI, Workflows & Features
submodules, but this did not apply to "git fetch --multiple" that
fetches from multiple remote repositories. It now does.
+ * The installation instruction for zsh completion script (in
+ contrib/) has been a bit improved.
+
Performance, Internal Implementation, Development Support etc.
@@ -337,6 +340,10 @@ Fixes since v2.23
corrected.
(merge 556895d0c8 jj/stash-reset-only-toplevel later to maint).
+ * The atomic push over smart HTTP transport did not work, which has
+ been corrected.
+ (merge 6f1194246a bc/smart-http-atomic-push later to maint).
+
* Other code cleanup, docfix, build fix, etc.
(merge d1387d3895 en/fast-import-merge-doc later to maint).
(merge 1c24a54ea4 bm/repository-layout-typofix later to maint).
@@ -385,3 +392,6 @@ Fixes since v2.23
(merge 5cc6a4be11 rs/http-push-simplify later to maint).
(merge a81e42d235 rs/column-use-utf8-strnwidth later to maint).
(merge 062a309d36 rs/remote-curl-use-argv-array later to maint).
+ (merge 3b3c79f6c9 nr/diff-highlight-indent-fix later to maint).
+ (merge 3444ec2eb2 wb/fsmonitor-bitmap-fix later to maint).
+ (merge 10da030ab7 cb/pcre2-chartables-leakfix later to maint).
diff --git a/Documentation/gitremote-helpers.txt b/Documentation/gitremote-helpers.txt
index a5c3c043712..f48a031dc34 100644
--- a/Documentation/gitremote-helpers.txt
+++ b/Documentation/gitremote-helpers.txt
@@ -509,6 +509,11 @@ set by Git if the remote helper has the 'option' capability.
Indicate that only the objects wanted need to be fetched, not
their dependents.
+'option atomic' {'true'|'false'}::
+ When pushing, request the remote server to update refs in a single atomic
+ transaction. If successful, all refs will be updated, or none will. If the
+ remote side does not support this capability, the push will fail.
+
SEE ALSO
--------
linkgit:git-remote[1]
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 64543ede287..31d6df5b4c1 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
-DEF_VER=v2.24.0-rc0
+DEF_VER=v2.24.0-rc1
LF='
'
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 9f099b95294..af2a5ea4845 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -157,7 +157,7 @@ jobs:
displayName: 'Download git-sdk-64-minimal'
- powershell: |
& git-sdk-64-minimal\usr\bin\bash.exe -lc @"
- make vcxproj
+ make NDEBUG=1 DEVELOPER=1 vcxproj
"@
if (!$?) { exit(1) }
displayName: Generate Visual Studio Solution
@@ -255,7 +255,7 @@ jobs:
cd t &&
PATH=\"`$PWD/helper:`$PATH\" &&
- test-tool.exe run-command testsuite -V -x --write-junit-xml \
+ test-tool.exe run-command testsuite --jobs=10 -V -x --write-junit-xml \
`$(test-tool.exe path-utils slice-tests \
`$SYSTEM_JOBPOSITIONINPHASE `$SYSTEM_TOTALJOBSINPHASE t[0-9]*.sh)
"@
diff --git a/builtin/grep.c b/builtin/grep.c
index 69ac053acc1..50ce8d94612 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -1147,5 +1147,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
run_pager(&opt, prefix);
clear_pathspec(&pathspec);
free_grep_patterns(&opt);
+ grep_destroy();
return !hit;
}
diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index 85a9d6b15cd..4e64a191120 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -40,9 +40,15 @@ osx-clang|osx-gcc)
test -z "$BREW_INSTALL_PACKAGES" ||
brew install $BREW_INSTALL_PACKAGES
brew link --force gettext
+ brew cask install perforce || {
+ # Update the definitions and try again
+ git -C "$(brew --repository)"/Library/Taps/homebrew/homebrew-cask pull &&
+ brew cask install perforce
+ } ||
brew install caskroom/cask/perforce
case "$jobname" in
osx-gcc)
+ brew link gcc ||
brew link gcc@8
;;
esac
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 886bf95d1f5..eef4eff53df 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -11,8 +11,9 @@
#
# zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh
#
-# The recommended way to install this script is to copy to '~/.zsh/_git', and
-# then add the following to your ~/.zshrc file:
+# The recommended way to install this script is to make a copy of it in
+# ~/.zsh/ directory as ~/.zsh/git-completion.zsh and then add the following
+# to your ~/.zshrc file:
#
# fpath=(~/.zsh $fpath)
diff --git a/contrib/diff-highlight/DiffHighlight.pm b/contrib/diff-highlight/DiffHighlight.pm
index 7440aa1c463..e2589922a65 100644
--- a/contrib/diff-highlight/DiffHighlight.pm
+++ b/contrib/diff-highlight/DiffHighlight.pm
@@ -72,7 +72,7 @@ sub handle_line {
(?:$COLOR?\|$COLOR?[ ])* # zero or more trailing "|"
[ ]* # trailing whitespace for merges
/x) {
- my $graph_prefix = $&;
+ my $graph_prefix = $&;
# We must flush before setting graph indent, since the
# new commit may be indented differently from what we
diff --git a/fsmonitor.c b/fsmonitor.c
index 231e83a94db..1f4aa1b150d 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -14,8 +14,13 @@ struct trace_key trace_fsmonitor = TRACE_KEY_INIT(FSMONITOR);
static void fsmonitor_ewah_callback(size_t pos, void *is)
{
struct index_state *istate = (struct index_state *)is;
- struct cache_entry *ce = istate->cache[pos];
+ struct cache_entry *ce;
+ if (pos >= istate->cache_nr)
+ BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" >= %u)",
+ (uintmax_t)pos, istate->cache_nr);
+
+ ce = istate->cache[pos];
ce->ce_flags &= ~CE_FSMONITOR_VALID;
}
@@ -50,17 +55,24 @@ int read_fsmonitor_extension(struct index_state *istate, const void *data,
}
istate->fsmonitor_dirty = fsmonitor_dirty;
+ if (istate->fsmonitor_dirty->bit_size > istate->cache_nr)
+ BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",
+ (uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
+
trace_printf_key(&trace_fsmonitor, "read fsmonitor extension successful");
return 0;
}
void fill_fsmonitor_bitmap(struct index_state *istate)
{
- unsigned int i;
+ unsigned int i, skipped = 0;
istate->fsmonitor_dirty = ewah_new();
- for (i = 0; i < istate->cache_nr; i++)
- if (!(istate->cache[i]->ce_flags & CE_FSMONITOR_VALID))
- ewah_set(istate->fsmonitor_dirty, i);
+ for (i = 0; i < istate->cache_nr; i++) {
+ if (istate->cache[i]->ce_flags & CE_REMOVE)
+ skipped++;
+ else if (!(istate->cache[i]->ce_flags & CE_FSMONITOR_VALID))
+ ewah_set(istate->fsmonitor_dirty, i - skipped);
+ }
}
void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate)
@@ -71,6 +83,10 @@ void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate)
uint32_t ewah_size = 0;
int fixup = 0;
+ if (istate->fsmonitor_dirty->bit_size > istate->cache_nr)
+ BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",
+ (uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
+
put_be32(&hdr_version, INDEX_EXTENSION_VERSION);
strbuf_add(sb, &hdr_version, sizeof(uint32_t));
@@ -236,6 +252,9 @@ void tweak_fsmonitor(struct index_state *istate)
}
/* Mark all previously saved entries as dirty */
+ if (istate->fsmonitor_dirty->bit_size > istate->cache_nr)
+ BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",
+ (uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
ewah_each_bit(istate->fsmonitor_dirty, fsmonitor_ewah_callback, istate);
/* Now mark the untracked cache for fsmonitor usage */
diff --git a/grep.c b/grep.c
index 0bb4cbd3d82..b7ae5a442a6 100644
--- a/grep.c
+++ b/grep.c
@@ -16,6 +16,20 @@ static int grep_source_is_binary(struct grep_source *gs,
static struct grep_opt grep_defaults;
+#ifdef USE_LIBPCRE2
+static pcre2_general_context *pcre2_global_context;
+
+static void *pcre2_malloc(PCRE2_SIZE size, MAYBE_UNUSED void *memory_data)
+{
+ return malloc(size);
+}
+
+static void pcre2_free(void *pointer, MAYBE_UNUSED void *memory_data)
+{
+ return free(pointer);
+}
+#endif
+
static const char *color_grep_slots[] = {
[GREP_COLOR_CONTEXT] = "context",
[GREP_COLOR_FILENAME] = "filename",
@@ -150,12 +164,28 @@ int grep_config(const char *var, const char *value, void *cb)
* Initialize one instance of grep_opt and copy the
* default values from the template we read the configuration
* information in an earlier call to git_config(grep_config).
+ *
+ * If using PCRE, make sure that the library is configured
+ * to use the same allocator as Git (e.g. nedmalloc on Windows).
+ *
+ * Any allocated memory needs to be released in grep_destroy().
*/
void grep_init(struct grep_opt *opt, struct repository *repo, const char *prefix)
{
struct grep_opt *def = &grep_defaults;
int i;
+#if defined(USE_LIBPCRE2)
+ if (!pcre2_global_context)
+ pcre2_global_context = pcre2_general_context_create(
+ pcre2_malloc, pcre2_free, NULL);
+#endif
+
+#ifdef USE_LIBPCRE1
+ pcre_malloc = malloc;
+ pcre_free = free;
+#endif
+
memset(opt, 0, sizeof(*opt));
opt->repo = repo;
opt->prefix = prefix;
@@ -178,6 +208,13 @@ void grep_init(struct grep_opt *opt, struct repository *repo, const char *prefix
color_set(opt->colors[i], def->colors[i]);
}
+void grep_destroy(void)
+{
+#ifdef USE_LIBPCRE2
+ pcre2_general_context_free(pcre2_global_context);
+#endif
+}
+
static void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, struct grep_opt *opt)
{
/*
@@ -461,7 +498,6 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
PCRE2_UCHAR errbuf[256];
PCRE2_SIZE erroffset;
int options = PCRE2_MULTILINE;
- const uint8_t *character_tables = NULL;
int jitret;
int patinforet;
size_t jitsizearg;
@@ -470,11 +506,15 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
p->pcre2_compile_context = NULL;
+ /* pcre2_global_context is initialized in append_grep_pattern */
if (opt->ignore_case) {
if (!opt->ignore_locale && has_non_ascii(p->pattern)) {
- character_tables = pcre2_maketables(NULL);
+ if (!pcre2_global_context)
+ BUG("pcre2_global_context uninitialized");
+ p->pcre2_tables = pcre2_maketables(pcre2_global_context);
p->pcre2_compile_context = pcre2_compile_context_create(NULL);
- pcre2_set_character_tables(p->pcre2_compile_context, character_tables);
+ pcre2_set_character_tables(p->pcre2_compile_context,
+ p->pcre2_tables);
}
options |= PCRE2_CASELESS;
}
@@ -571,6 +611,7 @@ static void free_pcre2_pattern(struct grep_pat *p)
pcre2_compile_context_free(p->pcre2_compile_context);
pcre2_code_free(p->pcre2_pattern);
pcre2_match_data_free(p->pcre2_match_data);
+ free((void *)p->pcre2_tables);
}
#else /* !USE_LIBPCRE2 */
static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt)
diff --git a/grep.h b/grep.h
index 05dc1bb98e5..811fd274c95 100644
--- a/grep.h
+++ b/grep.h
@@ -78,6 +78,7 @@ struct grep_pat {
pcre2_code *pcre2_pattern;
pcre2_match_data *pcre2_match_data;
pcre2_compile_context *pcre2_compile_context;
+ const uint8_t *pcre2_tables;
uint32_t pcre2_jit_on;
unsigned fixed:1;
unsigned is_fixed:1;
@@ -172,6 +173,7 @@ struct grep_opt {
void init_grep_defaults(struct repository *);
int grep_config(const char *var, const char *value, void *);
void grep_init(struct grep_opt *, struct repository *repo, const char *prefix);
+void grep_destroy(void);
void grep_commit_pattern_type(enum grep_pattern_type, struct grep_opt *opt);
void append_grep_pat(struct grep_opt *opt, const char *pat, size_t patlen, const char *origin, int no, enum grep_pat_token t);
diff --git a/remote-curl.c b/remote-curl.c
index 1612e7f52d7..350d92a074e 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -40,7 +40,8 @@ struct options {
push_cert : 2,
deepen_relative : 1,
from_promisor : 1,
- no_dependents : 1;
+ no_dependents : 1,
+ atomic : 1;
};
static struct options options;
static struct string_list cas_options = STRING_LIST_INIT_DUP;
@@ -148,6 +149,14 @@ static int set_option(const char *name, const char *value)
else
return -1;
return 0;
+ } else if (!strcmp(name, "atomic")) {
+ if (!strcmp(value, "true"))
+ options.atomic = 1;
+ else if (!strcmp(value, "false"))
+ options.atomic = 0;
+ else
+ return -1;
+ return 0;
} else if (!strcmp(name, "push-option")) {
if (*value != '"')
string_list_append(&options.push_options, value);
@@ -1196,6 +1205,8 @@ static int push_git(struct discovery *heads, int nr_spec, const char **specs)
argv_array_push(&args, "--signed=yes");
else if (options.push_cert == SEND_PACK_PUSH_CERT_IF_ASKED)
argv_array_push(&args, "--signed=if-asked");
+ if (options.atomic)
+ argv_array_push(&args, "--atomic");
if (options.verbosity == 0)
argv_array_push(&args, "--quiet");
else if (options.verbosity > 1)
diff --git a/repo-settings.c b/repo-settings.c
index 05546db98ee..a703e407a3f 100644
--- a/repo-settings.c
+++ b/repo-settings.c
@@ -22,7 +22,7 @@ void prepare_repo_settings(struct repository *r)
UPDATE_DEFAULT_BOOL(r->settings.core_commit_graph, 1);
UPDATE_DEFAULT_BOOL(r->settings.gc_write_commit_graph, 1);
- if (!repo_config_get_bool(r, "index.version", &value))
+ if (!repo_config_get_int(r, "index.version", &value))
r->settings.index_version = value;
if (!repo_config_get_maybe_bool(r, "core.untrackedcache", &value)) {
if (value == 0)
diff --git a/t/helper/test-progress.c b/t/helper/test-progress.c
index 4e9f7fafdfb..42b96cb103c 100644
--- a/t/helper/test-progress.c
+++ b/t/helper/test-progress.c
@@ -29,7 +29,7 @@ void progress_test_force_update(void);
int cmd__progress(int argc, const char **argv)
{
- uint64_t total = 0;
+ int total = 0;
const char *title;
struct strbuf line = STRBUF_INIT;
struct progress *progress;
diff --git a/t/t1600-index.sh b/t/t1600-index.sh
index c77721b580c..b7c31aa86a1 100755
--- a/t/t1600-index.sh
+++ b/t/t1600-index.sh
@@ -87,6 +87,10 @@ test_index_version () {
}
test_expect_success 'index version config precedence' '
+ test_index_version 0 false 0 2 &&
+ test_index_version 2 false 0 2 &&
+ test_index_version 3 false 0 2 &&
+ test_index_version 4 false 0 4 &&
test_index_version 2 false 4 4 &&
test_index_version 2 true 0 2 &&
test_index_version 0 true 0 4 &&
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 9facc3a79e9..b8969998b50 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -1615,17 +1615,20 @@ test_expect_success 'format-patch -o with no leading directories' '
'
test_expect_success 'format-patch -o with leading existing directories' '
- git format-patch -o patches/side master..side &&
+ rm -rf existing-dir &&
+ mkdir existing-dir &&
+ git format-patch -o existing-dir/patches master..side &&
count=$(git rev-list --count master..side) &&
- ls patches/side >list &&
+ ls existing-dir/patches >list &&
test_line_count = $count list
'
test_expect_success 'format-patch -o with leading non-existing directories' '
- rm -fr patches &&
- git format-patch -o patches/side master..side &&
+ rm -rf non-existing-dir &&
+ git format-patch -o non-existing-dir/patches master..side &&
count=$(git rev-list --count master..side) &&
- ls patches/side >list &&
+ test_path_is_dir non-existing-dir &&
+ ls non-existing-dir/patches >list &&
test_line_count = $count list
'
diff --git a/t/t4018/dts-nodes-boolean-prop b/t/t4018/dts-nodes-boolean-prop
new file mode 100644
index 00000000000..afc6b5b404e
--- /dev/null
+++ b/t/t4018/dts-nodes-boolean-prop
@@ -0,0 +1,9 @@
+/ {
+ label_1: node1@ff00 {
+ RIGHT@deadf00,4000 {
+ boolean-prop1;
+
+ ChangeMe;
+ };
+ };
+};
diff --git a/t/t4018/dts-nodes-multiline-prop b/t/t4018/dts-nodes-multiline-prop
new file mode 100644
index 00000000000..072d58b69dc
--- /dev/null
+++ b/t/t4018/dts-nodes-multiline-prop
@@ -0,0 +1,13 @@
+/ {
+ label_1: node1@ff00 {
+ RIGHT@deadf00,4000 {
+ multilineprop = <3>,
+ <4>,
+ <5>,
+ <6>,
+ <7>;
+
+ ChangeMe = <0xffeedd00>;
+ };
+ };
+};
diff --git a/t/t4018/dts-root b/t/t4018/dts-root
index 2ef9e6ffaa2..4353b8220c9 100644
--- a/t/t4018/dts-root
+++ b/t/t4018/dts-root
@@ -1,4 +1,4 @@
-/RIGHT { /* Technically just supposed to be a slash */
+/ { RIGHT /* Technically just supposed to be a slash and brace */
#size-cells = <1>;
ChangeMe = <0xffeedd00>;
diff --git a/t/t4018/dts-root-comment b/t/t4018/dts-root-comment
new file mode 100644
index 00000000000..333a625c700
--- /dev/null
+++ b/t/t4018/dts-root-comment
@@ -0,0 +1,8 @@
+/ { RIGHT /* Technically just supposed to be a slash and brace */
+ #size-cells = <1>;
+
+ /* This comment should be ignored */
+
+ some-property = <40+2>;
+ ChangeMe = <0xffeedd00>;
+};
diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
index 92bac432573..4c970787b0e 100755
--- a/t/t5541-http-push-smart.sh
+++ b/t/t5541-http-push-smart.sh
@@ -184,11 +184,12 @@ test_expect_success 'push --atomic also prevents branch creation, reports collat
test_config -C "$d" http.receivepack true &&
up="$HTTPD_URL"/smart/atomic-branches.git &&
- # Tell "$up" about two branches for now
+ # Tell "$up" about three branches for now
test_commit atomic1 &&
test_commit atomic2 &&
git branch collateral &&
- git push "$up" master collateral &&
+ git branch other &&
+ git push "$up" master collateral other &&
# collateral is a valid push, but should be failed by atomic push
git checkout collateral &&
@@ -226,6 +227,41 @@ test_expect_success 'push --atomic also prevents branch creation, reports collat
grep "^ ! .*rejected.* collateral -> collateral .*atomic push failed" output
'
+test_expect_success 'push --atomic fails on server-side errors' '
+ # Use previously set up repository
+ d=$HTTPD_DOCUMENT_ROOT_PATH/atomic-branches.git &&
+ test_config -C "$d" http.receivepack true &&
+ up="$HTTPD_URL"/smart/atomic-branches.git &&
+
+ # break ref updates for other on the remote site
+ mkdir "$d/refs/heads/other.lock" &&
+
+ # add the new commit to other
+ git branch -f other collateral &&
+
+ # --atomic should cause entire push to be rejected
+ test_must_fail git push --atomic "$up" atomic other 2>output &&
+
+ # the new branch should not have been created upstream
+ test_must_fail git -C "$d" show-ref --verify refs/heads/atomic &&
+
+ # upstream should still reflect atomic2, the last thing we pushed
+ # successfully
+ git rev-parse atomic2 >expected &&
+ # ...to other.
+ git -C "$d" rev-parse refs/heads/other >actual &&
+ test_cmp expected actual &&
+
+ # the new branch should not have been created upstream
+ test_must_fail git -C "$d" show-ref --verify refs/heads/atomic &&
+
+ # the failed refs should be indicated to the user
+ grep "^ ! .*rejected.* other -> other .*atomic transaction failed" output &&
+
+ # the collateral failure refs should be indicated to the user
+ grep "^ ! .*rejected.* atomic -> atomic .*atomic transaction failed" output
+'
+
test_expect_success 'push --all can push to empty repo' '
d=$HTTPD_DOCUMENT_ROOT_PATH/empty-all.git &&
git init --bare "$d" &&
diff --git a/t/t7419-submodule-set-branch.sh b/t/t7419-submodule-set-branch.sh
index c4b370ea853..fd25f786a36 100755
--- a/t/t7419-submodule-set-branch.sh
+++ b/t/t7419-submodule-set-branch.sh
@@ -34,7 +34,7 @@ test_expect_success 'submodule config cache setup' '
test_expect_success 'ensure submodule branch is unset' '
(cd super &&
- test_must_fail grep branch .gitmodules
+ ! grep branch .gitmodules
)
'
@@ -54,7 +54,7 @@ test_expect_success 'test submodule set-branch --branch' '
test_expect_success 'test submodule set-branch --default' '
(cd super &&
git submodule set-branch --default submodule &&
- test_must_fail grep branch .gitmodules &&
+ ! grep branch .gitmodules &&
git submodule update --remote &&
cat <<-\EOF >expect &&
a
@@ -80,7 +80,7 @@ test_expect_success 'test submodule set-branch -b' '
test_expect_success 'test submodule set-branch -d' '
(cd super &&
git submodule set-branch -d submodule &&
- test_must_fail grep branch .gitmodules &&
+ ! grep branch .gitmodules &&
git submodule update --remote &&
cat <<-\EOF >expect &&
a
diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh
index 81a375fa0ff..d8df9909723 100755
--- a/t/t7519-status-fsmonitor.sh
+++ b/t/t7519-status-fsmonitor.sh
@@ -354,4 +354,21 @@ test_expect_success 'discard_index() also discards fsmonitor info' '
test_cmp expect actual
'
+# Test staging/unstaging files that appear at the end of the index. Test
+# file names begin with 'z' so that they are sorted to the end of the index.
+test_expect_success 'status succeeds after staging/unstaging ' '
+ test_create_repo fsmonitor-stage-unstage &&
+ (
+ cd fsmonitor-stage-unstage &&
+ test_commit initial &&
+ git update-index --fsmonitor &&
+ removed=$(test_seq 1 100 | sed "s/^/z/") &&
+ touch $removed &&
+ git add $removed &&
+ git config core.fsmonitor "$TEST_DIRECTORY/t7519/fsmonitor-env" &&
+ FSMONITOR_LIST="$removed" git restore -S $removed &&
+ FSMONITOR_LIST="$removed" git status
+ )
+'
+
test_done
diff --git a/t/t7519/fsmonitor-env b/t/t7519/fsmonitor-env
new file mode 100755
index 00000000000..8f1f7ab164e
--- /dev/null
+++ b/t/t7519/fsmonitor-env
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# An test hook script to integrate with git to test fsmonitor.
+#
+# The hook is passed a version (currently 1) and a time in nanoseconds
+# formatted as a string and outputs to stdout all files that have been
+# modified since the given time. Paths must be relative to the root of
+# the working tree and separated by a single NUL.
+#
+#echo "$0 $*" >&2
+
+if test "$#" -ne 2
+then
+ echo "$0: exactly 2 arguments expected" >&2
+ exit 2
+fi
+
+if test "$1" != 1
+then
+ echo "Unsupported core.fsmonitor hook version." >&2
+ exit 1
+fi
+
+printf '%s\n' $FSMONITOR_LIST
diff --git a/transport-helper.c b/transport-helper.c
index 9e1279b928b..a9d690297e1 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -854,6 +854,10 @@ static void set_common_push_options(struct transport *transport,
die(_("helper %s does not support --signed=if-asked"), name);
}
+ if (flags & TRANSPORT_PUSH_ATOMIC)
+ if (set_helper_option(transport, TRANS_OPT_ATOMIC, "true") != 0)
+ die(_("helper %s does not support --atomic"), name);
+
if (flags & TRANSPORT_PUSH_OPTIONS) {
struct string_list_item *item;
for_each_string_list_item(item, transport->push_options)
diff --git a/transport.h b/transport.h
index 0b5f7806f62..e0131daab98 100644
--- a/transport.h
+++ b/transport.h
@@ -208,6 +208,9 @@ void transport_check_allowed(const char *type);
/* Filter objects for partial clone and fetch */
#define TRANS_OPT_LIST_OBJECTS_FILTER "filter"
+/* Request atomic (all-or-nothing) updates when pushing */
+#define TRANS_OPT_ATOMIC "atomic"
+
/**
* Returns 0 if the option was used, non-zero otherwise. Prints a
* message to stderr if the option is not used.
diff --git a/userdiff.c b/userdiff.c
index 86e3244e15d..e187d356f6f 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -25,8 +25,9 @@ IPATTERN("ada",
"|=>|\\.\\.|\\*\\*|:=|/=|>=|<=|<<|>>|<>"),
PATTERNS("dts",
"!;\n"
+ "!=\n"
/* lines beginning with a word optionally preceded by '&' or the root */
- "^[ \t]*((/|&?[a-zA-Z_]).*)",
+ "^[ \t]*((/[ \t]*\\{|&?[a-zA-Z_]).*)",
/* -- */
/* Property names and math operators */
"[a-zA-Z0-9,._+?#-]+"