Skip to content

Commit c17a3f5

Browse files
committed
Merge branch 'ready-for-upstream'
This is the branch thicket of patches in Git for Windows that are considered ready for upstream. To keep them in a ready-to-submit shape, they are kept as close to the beginning of the branch thicket as possible.
2 parents bed6711 + ce4dbf3 commit c17a3f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1582
-194
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*.pl eof=lf diff=perl
66
*.pm eol=lf diff=perl
77
*.py eol=lf diff=python
8+
*.bat eol=crlf
89
/Documentation/**/*.txt eol=lf
910
/command-list.txt eol=lf
1011
/GIT-VERSION-GEN eol=lf

.gitignore

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,42 @@
191191
/gitweb/static/gitweb.js
192192
/gitweb/static/gitweb.min.*
193193
/command-list.h
194+
/libgit
195+
/test-chmtime
196+
/test-ctype
197+
/test-config
198+
/test-date
199+
/test-delta
200+
/test-dump-cache-tree
201+
/test-dump-split-index
202+
/test-dump-untracked-cache
203+
/test-fake-ssh
204+
/test-scrap-cache-tree
205+
/test-genrandom
206+
/test-hashmap
207+
/test-index-version
208+
/test-line-buffer
209+
/test-match-trees
210+
/test-mergesort
211+
/test-mktemp
212+
/test-parse-options
213+
/test-path-utils
214+
/test-prio-queue
215+
/test-read-cache
216+
/test-regex
217+
/test-revision-walking
218+
/test-run-command
219+
/test-sha1
220+
/test-sha1-array
221+
/test-sigchain
222+
/test-string-list
223+
/test-submodule-config
224+
/test-subprocess
225+
/test-svn-fe
226+
/test-urlmatch-normalization
227+
/test-wildmatch
228+
/vcs-svn_lib
229+
/xdiff_lib
194230
*.tar.gz
195231
*.dsc
196232
*.deb
@@ -228,6 +264,15 @@
228264
*.user
229265
*.idb
230266
*.pdb
231-
/Debug/
232-
/Release/
267+
*.ilk
268+
*.iobj
269+
*.ipdb
270+
*.dll
271+
.vs/
272+
*.manifest
273+
Debug/
274+
Release/
275+
/UpgradeLog*.htm
276+
/git.VC.VC.opendb
277+
/git.VC.db
233278
*.dSYM

Documentation/config.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ the Git commands' behavior. The files `.git/config` and optionally
77
repository are used to store the configuration for that repository, and
88
`$HOME/.gitconfig` is used to store a per-user configuration as
99
fallback values for the `.git/config` file. The file `/etc/gitconfig`
10-
can be used to store a system-wide default configuration.
10+
can be used to store a system-wide default configuration. On Windows,
11+
configuration can also be stored in `C:\ProgramData\Git\config`; This
12+
file will be used also by libgit2-based software.
1113

1214
The configuration variables are used by both the Git plumbing
1315
and the porcelains. The variables are divided into sections, wherein

Documentation/git-config.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,16 @@ FILES
272272
If not set explicitly with `--file`, there are four files where
273273
'git config' will search for configuration options:
274274

275+
$PROGRAMDATA/Git/config::
276+
(Windows-only) System-wide configuration file shared with other Git
277+
implementations. Typically `$PROGRAMDATA` points to `C:\ProgramData`.
278+
275279
$(prefix)/etc/gitconfig::
276280
System-wide configuration file.
281+
(Windows-only) This file contains only the settings which are
282+
specific for this installation of Git for Windows and which should
283+
not be shared with other Git implementations like JGit, libgit2.
284+
`--system` will select this file.
277285

278286
$XDG_CONFIG_HOME/git/config::
279287
Second user-specific configuration file. If $XDG_CONFIG_HOME is not set

Documentation/git-reset.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ SYNOPSIS
1010
[verse]
1111
'git reset' [-q] [<tree-ish>] [--] <paths>...
1212
'git reset' (--patch | -p) [<tree-ish>] [--] [<paths>...]
13+
EXPERIMENTAL: 'git reset' [-q] [--stdin [-z]] [<tree-ish>]
1314
'git reset' [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]
1415

1516
DESCRIPTION
@@ -101,6 +102,15 @@ OPTIONS
101102
`reset.quiet` config option. `--quiet` and `--no-quiet` will
102103
override the default behavior.
103104

105+
--stdin::
106+
EXPERIMENTAL: Instead of taking list of paths from the
107+
command line, read list of paths from the standard input.
108+
Paths are separated by LF (i.e. one path per line) by
109+
default.
110+
111+
-z::
112+
EXPERIMENTAL: Only meaningful with `--stdin`; paths are
113+
separated with NUL character instead of LF.
104114

105115
EXAMPLES
106116
--------

Documentation/git.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,8 @@ for further details.
586586

587587
`GIT_CONFIG_NOSYSTEM`::
588588
Whether to skip reading settings from the system-wide
589-
`$(prefix)/etc/gitconfig` file. This environment variable can
589+
`$(prefix)/etc/gitconfig` file (and on Windows, also from the
590+
`%PROGRAMDATA%\Git\config` file). This environment variable can
590591
be used along with `$HOME` and `$XDG_CONFIG_HOME` to create a
591592
predictable environment for a picky script, or you can set it
592593
temporarily to avoid using a buggy `/etc/gitconfig` file while

Makefile

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ endif
12421242

12431243
ifdef SANE_TOOL_PATH
12441244
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
1245-
BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
1245+
BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
12461246
PATH := $(SANE_TOOL_PATH):${PATH}
12471247
else
12481248
BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
@@ -2732,7 +2732,7 @@ bin-wrappers/%: wrap-for-bin.sh
27322732
@mkdir -p bin-wrappers
27332733
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
27342734
-e 's|@@BUILD_DIR@@|$(shell pwd)|' \
2735-
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
2735+
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%$(X),$(@F))$(patsubst git%,$(X),$(filter $(@F),$(BINDIR_PROGRAMS_NEED_X)))|' < $< > $@ && \
27362736
chmod +x $@
27372737

27382738
# GNU make supports exporting all variables by "export" without parameters.
@@ -2875,6 +2875,33 @@ install: all
28752875
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
28762876
$(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
28772877
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
2878+
ifdef MSVC
2879+
# We DO NOT install the individual foo.o.pdb files because they
2880+
# have already been rolled up into the exe's pdb file.
2881+
# We DO NOT have pdb files for the builtin commands (like git-status.exe)
2882+
# because it is just a copy/hardlink of git.exe, rather than a unique binary.
2883+
$(INSTALL) git.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2884+
$(INSTALL) git-shell.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2885+
$(INSTALL) git-upload-pack.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2886+
$(INSTALL) git-credential-store.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2887+
$(INSTALL) git-daemon.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2888+
$(INSTALL) git-fast-import.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2889+
$(INSTALL) git-http-backend.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2890+
$(INSTALL) git-http-fetch.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2891+
$(INSTALL) git-http-push.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2892+
$(INSTALL) git-imap-send.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2893+
$(INSTALL) git-remote-http.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2894+
$(INSTALL) git-remote-testsvn.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2895+
$(INSTALL) git-sh-i18n--envsubst.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2896+
$(INSTALL) git-show-index.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2897+
ifndef DEBUG
2898+
$(INSTALL) $(vcpkg_rel_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
2899+
$(INSTALL) $(vcpkg_rel_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2900+
else
2901+
$(INSTALL) $(vcpkg_dbg_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
2902+
$(INSTALL) $(vcpkg_dbg_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2903+
endif
2904+
endif
28782905
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
28792906
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
28802907
$(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
@@ -3087,6 +3114,19 @@ endif
30873114
$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
30883115
$(RM) GIT-USER-AGENT GIT-PREFIX
30893116
$(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
3117+
ifdef MSVC
3118+
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3119+
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3120+
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3121+
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3122+
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3123+
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3124+
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3125+
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3126+
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3127+
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3128+
$(RM) compat/vcbuild/MSVC-DEFS-GEN
3129+
endif
30903130

30913131
.PHONY: all install profile-clean cocciclean clean strip
30923132
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell

archive-tar.c

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ static unsigned long offset;
1717

1818
static int tar_umask = 002;
1919

20+
static gzFile gzip;
21+
2022
static int write_tar_filter_archive(const struct archiver *ar,
2123
struct archiver_args *args);
2224

@@ -38,11 +40,21 @@ static int write_tar_filter_archive(const struct archiver *ar,
3840
#define USTAR_MAX_MTIME 077777777777ULL
3941
#endif
4042

43+
/* writes out the whole block, or dies if fails */
44+
static void write_block_or_die(const char *block) {
45+
if (gzip) {
46+
if (gzwrite(gzip, block, (unsigned) BLOCKSIZE) != BLOCKSIZE)
47+
die(_("gzwrite failed"));
48+
} else {
49+
write_or_die(1, block, BLOCKSIZE);
50+
}
51+
}
52+
4153
/* writes out the whole block, but only if it is full */
4254
static void write_if_needed(void)
4355
{
4456
if (offset == BLOCKSIZE) {
45-
write_or_die(1, block, BLOCKSIZE);
57+
write_block_or_die(block);
4658
offset = 0;
4759
}
4860
}
@@ -66,7 +78,7 @@ static void do_write_blocked(const void *data, unsigned long size)
6678
write_if_needed();
6779
}
6880
while (size >= BLOCKSIZE) {
69-
write_or_die(1, buf, BLOCKSIZE);
81+
write_block_or_die(buf);
7082
size -= BLOCKSIZE;
7183
buf += BLOCKSIZE;
7284
}
@@ -101,10 +113,10 @@ static void write_trailer(void)
101113
{
102114
int tail = BLOCKSIZE - offset;
103115
memset(block + offset, 0, tail);
104-
write_or_die(1, block, BLOCKSIZE);
116+
write_block_or_die(block);
105117
if (tail < 2 * RECORDSIZE) {
106118
memset(block, 0, offset);
107-
write_or_die(1, block, BLOCKSIZE);
119+
write_block_or_die(block);
108120
}
109121
}
110122

@@ -455,18 +467,34 @@ static int write_tar_filter_archive(const struct archiver *ar,
455467
filter.use_shell = 1;
456468
filter.in = -1;
457469

458-
if (start_command(&filter) < 0)
459-
die_errno(_("unable to start '%s' filter"), argv[0]);
460-
close(1);
461-
if (dup2(filter.in, 1) < 0)
462-
die_errno(_("unable to redirect descriptor"));
463-
close(filter.in);
470+
if (!strcmp("gzip -cn", ar->data)) {
471+
char outmode[4] = "wb\0";
472+
473+
if (args->compression_level >= 0 && args->compression_level <= 9)
474+
outmode[2] = '0' + args->compression_level;
475+
476+
gzip = gzdopen(fileno(stdout), outmode);
477+
if (!gzip)
478+
die(_("Could not gzdopen stdout"));
479+
} else {
480+
if (start_command(&filter) < 0)
481+
die_errno(_("unable to start '%s' filter"), argv[0]);
482+
close(1);
483+
if (dup2(filter.in, 1) < 0)
484+
die_errno(_("unable to redirect descriptor"));
485+
close(filter.in);
486+
}
464487

465488
r = write_tar_archive(ar, args);
466489

467-
close(1);
468-
if (finish_command(&filter) != 0)
469-
die(_("'%s' filter reported error"), argv[0]);
490+
if (gzip) {
491+
if (gzclose(gzip) != Z_OK)
492+
die(_("gzclose failed"));
493+
} else {
494+
close(1);
495+
if (finish_command(&filter) != 0)
496+
die(_("'%s' filter reported error"), argv[0]);
497+
}
470498

471499
strbuf_release(&cmd);
472500
return r;

builtin/clone.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
11871187
}
11881188

11891189
if (!is_local && !complete_refs_before_fetch)
1190-
transport_fetch_refs(transport, mapped_refs);
1190+
if (transport_fetch_refs(transport, mapped_refs))
1191+
die(_("could not fetch refs from %s"),
1192+
transport->url);
11911193

11921194
remote_head = find_ref_by_name(refs, "HEAD");
11931195
remote_head_points_at =

0 commit comments

Comments
 (0)