Skip to content

Commit

Permalink
Merge branch 'backports'
Browse files Browse the repository at this point in the history
These topics already made it into git/git's main branch, and are
backported for Git for Windows' benefit.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Oct 20, 2020
2 parents 6989800 + 2cda7cd commit fa3fb26
Show file tree
Hide file tree
Showing 117 changed files with 2,812 additions and 1,751 deletions.
39 changes: 24 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,6 @@ jobs:
## Unzip and remove the artifact
unzip artifacts.zip
rm artifacts.zip
- name: generate Visual Studio solution
shell: powershell
run: |
& .\git-sdk-64-minimal\usr\bin\bash.exe -lc @"
make NDEBUG=1 DEVELOPER=1 vcxproj
"@
if (!$?) { exit(1) }
- name: download vcpkg artifacts
shell: powershell
run: |
Expand All @@ -163,6 +156,17 @@ jobs:
Remove-Item compat.zip
- name: add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.0
- name: copy dlls to root
shell: powershell
run: |
& compat\vcbuild\vcpkg_copy_dlls.bat release
if (!$?) { exit(1) }
- name: generate Visual Studio solution
shell: bash
run: |
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \
-DIconv_LIBRARY=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows/lib/libiconv.lib -DIconv_INCLUDE_DIR=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows/include \
-DMSGFMT_EXE=`pwd`/git-sdk-64-minimal/mingw64/bin/msgfmt.exe -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON
- name: MSBuild
run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
- name: bundle artifact tar
Expand All @@ -171,8 +175,6 @@ jobs:
MSVC: 1
VCPKG_ROOT: ${{github.workspace}}\compat\vcbuild\vcpkg
run: |
& compat\vcbuild\vcpkg_copy_dlls.bat release
if (!$?) { exit(1) }
& git-sdk-64-minimal\usr\bin\bash.exe -lc @"
mkdir -p artifacts &&
eval \"`$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts 2>&1 | grep ^tar)\"
Expand Down Expand Up @@ -203,7 +205,7 @@ jobs:
- name: extract build artifacts
shell: bash
run: tar xf artifacts.tar.gz
- name: test (parallel)
- name: test
shell: powershell
env:
MSYSTEM: MINGW64
Expand All @@ -214,12 +216,19 @@ jobs:
# Let Git ignore the SDK and the test-cache
printf '%s\n' /git-sdk-64-minimal/ /test-cache/ >>.git/info/exclude
cd t &&
PATH=\"`$PWD/helper:`$PATH\" &&
test-tool.exe run-command testsuite --jobs=10 -V -x --write-junit-xml \
`$(test-tool.exe path-utils slice-tests \
${{matrix.nr}} 10 t[0-9]*.sh)
ci/run-test-slice.sh ${{matrix.nr}} 10
"@
- name: ci/print-test-failures.sh
if: failure()
shell: powershell
run: |
& .\git-sdk-64-minimal\usr\bin\bash.exe -lc ci/print-test-failures.sh
- name: Upload failed tests' directories
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
uses: actions/upload-artifact@v1
with:
name: failed-tests-windows
path: ${{env.FAILED_TEST_ARTIFACTS}}
regular:
needs: ci-config
if: needs.ci-config.outputs.enabled == 'yes'
Expand Down
4 changes: 2 additions & 2 deletions Documentation/technical/api-parse-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ There are some macros to easily define options:
will be overwritten, so this should only be used for options where
the last one specified on the command line wins.

`OPT_PASSTHRU_ARGV(short, long, &argv_array_var, arg_str, description, flags)`::
`OPT_PASSTHRU_ARGV(short, long, &strvec_var, arg_str, description, flags)`::
Introduce an option where all instances of it on the command-line will
be reconstructed into an argv_array. This is useful when you need to
be reconstructed into a strvec. This is useful when you need to
pass the command-line option, which can be specified multiple times,
to another command.

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,6 @@ LIB_OBJS += apply.o
LIB_OBJS += archive-tar.o
LIB_OBJS += archive-zip.o
LIB_OBJS += archive.o
LIB_OBJS += argv-array.o
LIB_OBJS += attr.o
LIB_OBJS += base85.o
LIB_OBJS += bisect.o
Expand Down Expand Up @@ -986,6 +985,7 @@ LIB_OBJS += sigchain.o
LIB_OBJS += split-index.o
LIB_OBJS += stable-qsort.o
LIB_OBJS += strbuf.o
LIB_OBJS += strvec.o
LIB_OBJS += streaming.o
LIB_OBJS += string-list.o
LIB_OBJS += sub-process.o
Expand Down
28 changes: 14 additions & 14 deletions add-interactive.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,18 +935,18 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
opts->prompt = N_("Patch update");
count = list_and_choose(s, files, opts);
if (count > 0) {
struct argv_array args = ARGV_ARRAY_INIT;
struct strvec args = STRVEC_INIT;
struct pathspec ps_selected = { 0 };

for (i = 0; i < files->items.nr; i++)
if (files->selected[i])
argv_array_push(&args,
files->items.items[i].string);
strvec_push(&args,
files->items.items[i].string);
parse_pathspec(&ps_selected,
PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
PATHSPEC_LITERAL_PATH, "", args.argv);
PATHSPEC_LITERAL_PATH, "", args.v);
res = run_add_p(s->r, ADD_P_ADD, NULL, &ps_selected);
argv_array_clear(&args);
strvec_clear(&args);
clear_pathspec(&ps_selected);
}

Expand Down Expand Up @@ -976,18 +976,18 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,
count = list_and_choose(s, files, opts);
opts->flags = 0;
if (count > 0) {
struct argv_array args = ARGV_ARRAY_INIT;
struct strvec args = STRVEC_INIT;

argv_array_pushl(&args, "git", "diff", "-p", "--cached",
oid_to_hex(!is_initial ? &oid :
s->r->hash_algo->empty_tree),
"--", NULL);
strvec_pushl(&args, "git", "diff", "-p", "--cached",
oid_to_hex(!is_initial ? &oid :
s->r->hash_algo->empty_tree),
"--", NULL);
for (i = 0; i < files->items.nr; i++)
if (files->selected[i])
argv_array_push(&args,
files->items.items[i].string);
res = run_command_v_opt(args.argv, 0);
argv_array_clear(&args);
strvec_push(&args,
files->items.items[i].string);
res = run_command_v_opt(args.v, 0);
strvec_clear(&args);
}

putchar('\n');
Expand Down
48 changes: 24 additions & 24 deletions add-patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "add-interactive.h"
#include "strbuf.h"
#include "run-command.h"
#include "argv-array.h"
#include "strvec.h"
#include "pathspec.h"
#include "color.h"
#include "diff.h"
Expand Down Expand Up @@ -286,12 +286,12 @@ static void setup_child_process(struct add_p_state *s,

va_start(ap, cp);
while ((arg = va_arg(ap, const char *)))
argv_array_push(&cp->args, arg);
strvec_push(&cp->args, arg);
va_end(ap);

cp->git_cmd = 1;
argv_array_pushf(&cp->env_array,
INDEX_ENVIRONMENT "=%s", s->s.r->index_file);
strvec_pushf(&cp->env_array,
INDEX_ENVIRONMENT "=%s", s->s.r->index_file);
}

static int parse_range(const char **p,
Expand Down Expand Up @@ -370,7 +370,7 @@ static int is_octal(const char *p, size_t len)

static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
{
struct argv_array args = ARGV_ARRAY_INIT;
struct strvec args = STRVEC_INIT;
const char *diff_algorithm = s->s.interactive_diff_algorithm;
struct strbuf *plain = &s->plain, *colored = NULL;
struct child_process cp = CHILD_PROCESS_INIT;
Expand All @@ -380,32 +380,32 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
struct hunk *hunk = NULL;
int res;

argv_array_pushv(&args, s->mode->diff_cmd);
strvec_pushv(&args, s->mode->diff_cmd);
if (diff_algorithm)
argv_array_pushf(&args, "--diff-algorithm=%s", diff_algorithm);
strvec_pushf(&args, "--diff-algorithm=%s", diff_algorithm);
if (s->revision) {
struct object_id oid;
argv_array_push(&args,
/* could be on an unborn branch */
!strcmp("HEAD", s->revision) &&
get_oid("HEAD", &oid) ?
empty_tree_oid_hex() : s->revision);
strvec_push(&args,
/* could be on an unborn branch */
!strcmp("HEAD", s->revision) &&
get_oid("HEAD", &oid) ?
empty_tree_oid_hex() : s->revision);
}
color_arg_index = args.argc;
color_arg_index = args.nr;
/* Use `--no-color` explicitly, just in case `diff.color = always`. */
argv_array_pushl(&args, "--no-color", "-p", "--", NULL);
strvec_pushl(&args, "--no-color", "-p", "--", NULL);
for (i = 0; i < ps->nr; i++)
argv_array_push(&args, ps->items[i].original);
strvec_push(&args, ps->items[i].original);

setup_child_process(s, &cp, NULL);
cp.argv = args.argv;
cp.argv = args.v;
res = capture_command(&cp, plain, 0);
if (res) {
argv_array_clear(&args);
strvec_clear(&args);
return error(_("could not parse diff"));
}
if (!plain->len) {
argv_array_clear(&args);
strvec_clear(&args);
return 0;
}
strbuf_complete_line(plain);
Expand All @@ -415,11 +415,11 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
const char *diff_filter = s->s.interactive_diff_filter;

setup_child_process(s, &colored_cp, NULL);
xsnprintf((char *)args.argv[color_arg_index], 8, "--color");
colored_cp.argv = args.argv;
xsnprintf((char *)args.v[color_arg_index], 8, "--color");
colored_cp.argv = args.v;
colored = &s->colored;
res = capture_command(&colored_cp, colored, 0);
argv_array_clear(&args);
strvec_clear(&args);
if (res)
return error(_("could not parse colored diff"));

Expand All @@ -444,7 +444,7 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
colored_p = colored->buf;
colored_pend = colored_p + colored->len;
}
argv_array_clear(&args);
strvec_clear(&args);

/* parse files and hunks */
p = plain->buf;
Expand Down Expand Up @@ -1158,7 +1158,7 @@ static int run_apply_check(struct add_p_state *s,

setup_child_process(s, &cp,
"apply", "--check", NULL);
argv_array_pushv(&cp.args, s->mode->apply_check_args);
strvec_pushv(&cp.args, s->mode->apply_check_args);
if (pipe_command(&cp, s->buf.buf, s->buf.len, NULL, 0, NULL, 0))
return error(_("'git apply --cached' failed"));

Expand Down Expand Up @@ -1619,7 +1619,7 @@ static int patch_update_file(struct add_p_state *s,
s->mode->is_reverse);
else {
setup_child_process(s, &cp, "apply", NULL);
argv_array_pushv(&cp.args, s->mode->apply_args);
strvec_pushv(&cp.args, s->mode->apply_args);
if (pipe_command(&cp, s->buf.buf, s->buf.len,
NULL, 0, NULL, 0))
error(_("'git apply' failed"));
Expand Down
109 changes: 0 additions & 109 deletions argv-array.c

This file was deleted.

Loading

0 comments on commit fa3fb26

Please sign in to comment.