Skip to content

Commit 1eff314

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 92afe2d + d90a8fc commit 1eff314

Some content is hidden

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

48 files changed

+1620
-377
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: 5 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
@@ -406,6 +408,8 @@ include::config/reset.txt[]
406408

407409
include::config/sendemail.txt[]
408410

411+
include::config/sendpack.txt[]
412+
409413
include::config/sequencer.txt[]
410414

411415
include::config/showbranch.txt[]

Documentation/config/sendpack.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sendpack.sideband::
2+
Allows to disable the side-band-64k capability for send-pack even
3+
when it is advertised by the server. Makes it possible to work
4+
around a limitation in the git for windows implementation together
5+
with the dump git protocol. Defaults to true.

Documentation/git-config.txt

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

287+
$PROGRAMDATA/Git/config::
288+
(Windows-only) System-wide configuration file shared with other Git
289+
implementations. Typically `$PROGRAMDATA` points to `C:\ProgramData`.
290+
287291
$(prefix)/etc/gitconfig::
288292
System-wide configuration file.
293+
(Windows-only) This file contains only the settings which are
294+
specific for this installation of Git for Windows and which should
295+
not be shared with other Git implementations like JGit, libgit2.
296+
`--system` will select this file.
289297

290298
$XDG_CONFIG_HOME/git/config::
291299
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
@@ -1239,7 +1239,7 @@ endif
12391239

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

27352735
# GNU make supports exporting all variables by "export" without parameters.
@@ -2870,6 +2870,33 @@ install: all
28702870
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
28712871
$(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
28722872
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
2873+
ifdef MSVC
2874+
# We DO NOT install the individual foo.o.pdb files because they
2875+
# have already been rolled up into the exe's pdb file.
2876+
# We DO NOT have pdb files for the builtin commands (like git-status.exe)
2877+
# because it is just a copy/hardlink of git.exe, rather than a unique binary.
2878+
$(INSTALL) git.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2879+
$(INSTALL) git-shell.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2880+
$(INSTALL) git-upload-pack.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2881+
$(INSTALL) git-credential-store.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2882+
$(INSTALL) git-daemon.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2883+
$(INSTALL) git-fast-import.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2884+
$(INSTALL) git-http-backend.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2885+
$(INSTALL) git-http-fetch.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2886+
$(INSTALL) git-http-push.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2887+
$(INSTALL) git-imap-send.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2888+
$(INSTALL) git-remote-http.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2889+
$(INSTALL) git-remote-testsvn.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2890+
$(INSTALL) git-sh-i18n--envsubst.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2891+
$(INSTALL) git-show-index.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2892+
ifndef DEBUG
2893+
$(INSTALL) $(vcpkg_rel_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
2894+
$(INSTALL) $(vcpkg_rel_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2895+
else
2896+
$(INSTALL) $(vcpkg_dbg_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
2897+
$(INSTALL) $(vcpkg_dbg_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2898+
endif
2899+
endif
28732900
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
28742901
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
28752902
$(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
@@ -3082,6 +3109,19 @@ endif
30823109
$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
30833110
$(RM) GIT-USER-AGENT GIT-PREFIX
30843111
$(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
3112+
ifdef MSVC
3113+
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3114+
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3115+
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3116+
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3117+
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3118+
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3119+
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3120+
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3121+
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3122+
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3123+
$(RM) compat/vcbuild/MSVC-DEFS-GEN
3124+
endif
30853125

30863126
.PHONY: all install profile-clean cocciclean clean strip
30873127
.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
@@ -1190,7 +1190,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
11901190
}
11911191

11921192
if (!is_local && !complete_refs_before_fetch)
1193-
transport_fetch_refs(transport, mapped_refs);
1193+
if (transport_fetch_refs(transport, mapped_refs))
1194+
die(_("could not fetch refs from %s"),
1195+
transport->url);
11941196

11951197
remote_head = find_ref_by_name(refs, "HEAD");
11961198
remote_head_points_at =

0 commit comments

Comments
 (0)