mirror of
https://github.com/git-for-windows/git.git
synced 2026-07-06 20:49:15 -05:00
Merge branch 'busybox-w32'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -4,6 +4,7 @@
|
||||
*.perl eol=lf diff=perl
|
||||
*.pl eof=lf diff=perl
|
||||
*.pm eol=lf diff=perl
|
||||
*.png binary
|
||||
*.py eol=lf diff=python
|
||||
*.bat eol=crlf
|
||||
/Documentation/**/*.txt eol=lf
|
||||
|
||||
@@ -294,9 +294,9 @@ docdep_prereqs = \
|
||||
cmd-list.made $(cmds_txt)
|
||||
|
||||
doc.dep : $(docdep_prereqs) $(wildcard *.txt) $(wildcard config/*.txt) build-docdep.perl
|
||||
$(QUIET_GEN)$(RM) $@+ $@ && \
|
||||
$(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
|
||||
mv $@+ $@
|
||||
$(QUIET_GEN)$(RM) $@.new $@ && \
|
||||
$(PERL_PATH) ./build-docdep.perl >$@.new $(QUIET_STDERR) && \
|
||||
mv $@.new $@
|
||||
|
||||
-include doc.dep
|
||||
|
||||
@@ -332,8 +332,8 @@ mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
|
||||
date >$@
|
||||
|
||||
clean:
|
||||
$(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
|
||||
$(RM) *.texi *.texi+ *.texi++ git.info gitman.info
|
||||
$(RM) *.xml *.xml.new *.html *.html.new *.1 *.5 *.7
|
||||
$(RM) *.texi *.texi.new *.texi.new.new git.info gitman.info
|
||||
$(RM) *.pdf
|
||||
$(RM) howto-index.txt howto/*.html doc.dep
|
||||
$(RM) technical/*.html technical/api-index.txt
|
||||
@@ -342,14 +342,14 @@ clean:
|
||||
$(RM) manpage-base-url.xsl
|
||||
|
||||
$(MAN_HTML): %.html : %.txt asciidoc.conf
|
||||
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
|
||||
$(TXT_TO_HTML) -d manpage -o $@+ $< && \
|
||||
mv $@+ $@
|
||||
$(QUIET_ASCIIDOC)$(RM) $@.new $@ && \
|
||||
$(TXT_TO_HTML) -d manpage -o $@.new $< && \
|
||||
mv $@.new $@
|
||||
|
||||
$(OBSOLETE_HTML): %.html : %.txto asciidoc.conf
|
||||
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
|
||||
$(TXT_TO_HTML) -o $@+ $< && \
|
||||
mv $@+ $@
|
||||
$(QUIET_ASCIIDOC)$(RM) $@.new $@ && \
|
||||
$(TXT_TO_HTML) -o $@.new $< && \
|
||||
mv $@.new $@
|
||||
|
||||
manpage-base-url.xsl: manpage-base-url.xsl.in
|
||||
$(QUIET_GEN)sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
|
||||
@@ -359,14 +359,14 @@ manpage-base-url.xsl: manpage-base-url.xsl.in
|
||||
$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
|
||||
|
||||
%.xml : %.txt asciidoc.conf
|
||||
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
|
||||
$(TXT_TO_XML) -d manpage -o $@+ $< && \
|
||||
mv $@+ $@
|
||||
$(QUIET_ASCIIDOC)$(RM) $@.new $@ && \
|
||||
$(TXT_TO_XML) -d manpage -o $@.new $< && \
|
||||
mv $@.new $@
|
||||
|
||||
user-manual.xml: user-manual.txt user-manual.conf
|
||||
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
|
||||
$(TXT_TO_XML) -d book -o $@+ $< && \
|
||||
mv $@+ $@
|
||||
$(QUIET_ASCIIDOC)$(RM) $@.new $@ && \
|
||||
$(TXT_TO_XML) -d book -o $@.new $< && \
|
||||
mv $@.new $@
|
||||
|
||||
technical/api-index.txt: technical/api-index-skel.txt \
|
||||
technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
|
||||
@@ -383,46 +383,46 @@ XSLT = docbook.xsl
|
||||
XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
|
||||
|
||||
user-manual.html: user-manual.xml $(XSLT)
|
||||
$(QUIET_XSLTPROC)$(RM) $@+ $@ && \
|
||||
xsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \
|
||||
mv $@+ $@
|
||||
$(QUIET_XSLTPROC)$(RM) $@.new $@ && \
|
||||
xsltproc $(XSLTOPTS) -o $@.new $(XSLT) $< && \
|
||||
mv $@.new $@
|
||||
|
||||
git.info: user-manual.texi
|
||||
$(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
|
||||
|
||||
user-manual.texi: user-manual.xml
|
||||
$(QUIET_DB2TEXI)$(RM) $@+ $@ && \
|
||||
$(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
|
||||
$(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
|
||||
rm $@++ && \
|
||||
mv $@+ $@
|
||||
$(QUIET_DB2TEXI)$(RM) $@.new $@ && \
|
||||
$(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@.new.new && \
|
||||
$(PERL_PATH) fix-texi.perl <$@.new.new >$@.new && \
|
||||
rm $@.new.new && \
|
||||
mv $@.new $@
|
||||
|
||||
user-manual.pdf: user-manual.xml
|
||||
$(QUIET_DBLATEX)$(RM) $@+ $@ && \
|
||||
$(DBLATEX) -o $@+ $(DBLATEX_COMMON) $< && \
|
||||
mv $@+ $@
|
||||
$(QUIET_DBLATEX)$(RM) $@.new $@ && \
|
||||
$(DBLATEX) -o $@.new $(DBLATEX_COMMON) $< && \
|
||||
mv $@.new $@
|
||||
|
||||
gitman.texi: $(MAN_XML) cat-texi.perl texi.xsl
|
||||
$(QUIET_DB2TEXI)$(RM) $@+ $@ && \
|
||||
($(foreach xml,$(sort $(MAN_XML)),xsltproc -o $(xml)+ texi.xsl $(xml) && \
|
||||
$(DOCBOOK2X_TEXI) --encoding=UTF-8 --to-stdout $(xml)+ && \
|
||||
rm $(xml)+ &&) true) > $@++ && \
|
||||
$(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
|
||||
rm $@++ && \
|
||||
mv $@+ $@
|
||||
$(QUIET_DB2TEXI)$(RM) $@.new $@ && \
|
||||
($(foreach xml,$(sort $(MAN_XML)),xsltproc -o $(xml).new texi.xsl $(xml) && \
|
||||
$(DOCBOOK2X_TEXI) --encoding=UTF-8 --to-stdout $(xml).new && \
|
||||
rm $(xml).new &&) true) > $@.new.new && \
|
||||
$(PERL_PATH) cat-texi.perl $@ <$@.new.new >$@.new && \
|
||||
rm $@.new.new && \
|
||||
mv $@.new $@
|
||||
|
||||
gitman.info: gitman.texi
|
||||
$(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
|
||||
|
||||
$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
|
||||
$(QUIET_DB2TEXI)$(RM) $@+ $@ && \
|
||||
$(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
|
||||
mv $@+ $@
|
||||
$(QUIET_DB2TEXI)$(RM) $@.new $@ && \
|
||||
$(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@.new && \
|
||||
mv $@.new $@
|
||||
|
||||
howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
|
||||
$(QUIET_GEN)$(RM) $@+ $@ && \
|
||||
'$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(wildcard howto/*.txt)) >$@+ && \
|
||||
mv $@+ $@
|
||||
$(QUIET_GEN)$(RM) $@.new $@ && \
|
||||
'$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(wildcard howto/*.txt)) >$@.new && \
|
||||
mv $@.new $@
|
||||
|
||||
$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
|
||||
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
|
||||
@@ -431,10 +431,10 @@ WEBDOC_DEST = /pub/software/scm/git/docs
|
||||
|
||||
howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
|
||||
$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
|
||||
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
|
||||
$(QUIET_ASCIIDOC)$(RM) $@.new $@ && \
|
||||
sed -e '1,/^$$/d' $< | \
|
||||
$(TXT_TO_HTML) - >$@+ && \
|
||||
mv $@+ $@
|
||||
$(TXT_TO_HTML) - >$@.new && \
|
||||
mv $@.new $@
|
||||
|
||||
install-webdoc : html
|
||||
'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
|
||||
|
||||
@@ -7,7 +7,9 @@ the Git commands' behavior. The files `.git/config` and optionally
|
||||
repository are used to store the configuration for that repository, and
|
||||
`$HOME/.gitconfig` is used to store a per-user configuration as
|
||||
fallback values for the `.git/config` file. The file `/etc/gitconfig`
|
||||
can be used to store a system-wide default configuration.
|
||||
can be used to store a system-wide default configuration. On Windows,
|
||||
configuration can also be stored in `C:\ProgramData\Git\config`; This
|
||||
file will be used also by libgit2-based software.
|
||||
|
||||
The configuration variables are used by both the Git plumbing
|
||||
and the porcelains. The variables are divided into sections, wherein
|
||||
|
||||
@@ -270,8 +270,16 @@ FILES
|
||||
If not set explicitly with `--file`, there are four files where
|
||||
'git config' will search for configuration options:
|
||||
|
||||
$PROGRAMDATA/Git/config::
|
||||
(Windows-only) System-wide configuration file shared with other Git
|
||||
implementations. Typically `$PROGRAMDATA` points to `C:\ProgramData`.
|
||||
|
||||
$(prefix)/etc/gitconfig::
|
||||
System-wide configuration file.
|
||||
(Windows-only) This file contains only the settings which are
|
||||
specific for this installation of Git for Windows and which should
|
||||
not be shared with other Git implementations like JGit, libgit2.
|
||||
`--system` will select this file.
|
||||
|
||||
$XDG_CONFIG_HOME/git/config::
|
||||
Second user-specific configuration file. If $XDG_CONFIG_HOME is not set
|
||||
|
||||
@@ -567,7 +567,8 @@ for further details.
|
||||
|
||||
`GIT_CONFIG_NOSYSTEM`::
|
||||
Whether to skip reading settings from the system-wide
|
||||
`$(prefix)/etc/gitconfig` file. This environment variable can
|
||||
`$(prefix)/etc/gitconfig` file (and on Windows, also from the
|
||||
`%PROGRAMDATA%\Git\config` file). This environment variable can
|
||||
be used along with `$HOME` and `$XDG_CONFIG_HOME` to create a
|
||||
predictable environment for a picky script, or you can set it
|
||||
temporarily to avoid using a buggy `/etc/gitconfig` file while
|
||||
|
||||
@@ -382,6 +382,36 @@ sign `$` upon checkout. Any byte sequence that begins with
|
||||
with `$Id$` upon check-in.
|
||||
|
||||
|
||||
`symlink`
|
||||
^^^^^^^^^
|
||||
|
||||
On Windows, symbolic links have a type: a "file symlink" must point at
|
||||
a file, and a "directory symlink" must point at a directory. If the
|
||||
type of symlink does not match its target, it doesn't work.
|
||||
|
||||
Git does not record the type of symlink in the index or in a tree. On
|
||||
checkout it'll guess the type, which only works if the target exists
|
||||
at the time the symlink is created. This may often not be the case,
|
||||
for example when the link points at a directory inside a submodule.
|
||||
|
||||
The `symlink` attribute allows you to explicitly set the type of symlink
|
||||
to `file` or `dir`, so Git doesn't have to guess. If you have a set of
|
||||
symlinks that point at other files, you can do:
|
||||
|
||||
------------------------
|
||||
*.gif symlink=file
|
||||
------------------------
|
||||
|
||||
To tell Git that a symlink points at a directory, use:
|
||||
|
||||
------------------------
|
||||
tools_folder symlink=dir
|
||||
------------------------
|
||||
|
||||
The `symlink` attribute is ignored on platforms other than Windows,
|
||||
since they don't distinguish between different types of symlinks.
|
||||
|
||||
|
||||
`filter`
|
||||
^^^^^^^^
|
||||
|
||||
|
||||
2
Makefile
2
Makefile
@@ -729,6 +729,7 @@ X =
|
||||
PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
|
||||
|
||||
TEST_BUILTINS_OBJS += test-chmtime.o
|
||||
TEST_BUILTINS_OBJS += test-cmp.o
|
||||
TEST_BUILTINS_OBJS += test-config.o
|
||||
TEST_BUILTINS_OBJS += test-ctype.o
|
||||
TEST_BUILTINS_OBJS += test-date.o
|
||||
@@ -743,6 +744,7 @@ TEST_BUILTINS_OBJS += test-genrandom.o
|
||||
TEST_BUILTINS_OBJS += test-hash.o
|
||||
TEST_BUILTINS_OBJS += test-hashmap.o
|
||||
TEST_BUILTINS_OBJS += test-hash-speed.o
|
||||
TEST_BUILTINS_OBJS += test-iconv.o
|
||||
TEST_BUILTINS_OBJS += test-index-version.o
|
||||
TEST_BUILTINS_OBJS += test-json-writer.o
|
||||
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
|
||||
|
||||
@@ -578,6 +578,7 @@ static int *list_and_choose(struct menu_opts *opts, struct menu_stuff *stuff)
|
||||
clean_get_color(CLEAN_COLOR_RESET));
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
if (strbuf_getline_lf(&choice, stdin) != EOF) {
|
||||
strbuf_trim(&choice);
|
||||
} else {
|
||||
@@ -660,6 +661,7 @@ static int filter_by_patterns_cmd(void)
|
||||
clean_print_color(CLEAN_COLOR_PROMPT);
|
||||
printf(_("Input ignore patterns>> "));
|
||||
clean_print_color(CLEAN_COLOR_RESET);
|
||||
fflush(stdout);
|
||||
if (strbuf_getline_lf(&confirm, stdin) != EOF)
|
||||
strbuf_trim(&confirm);
|
||||
else
|
||||
@@ -758,6 +760,7 @@ static int ask_each_cmd(void)
|
||||
qname = quote_path_relative(item->string, NULL, &buf);
|
||||
/* TRANSLATORS: Make sure to keep [y/N] as is */
|
||||
printf(_("Remove %s [y/N]? "), qname);
|
||||
fflush(stdout);
|
||||
if (strbuf_getline_lf(&confirm, stdin) != EOF) {
|
||||
strbuf_trim(&confirm);
|
||||
} else {
|
||||
|
||||
926
compat/mingw.c
926
compat/mingw.c
File diff suppressed because it is too large
Load Diff
@@ -123,10 +123,6 @@ struct utsname {
|
||||
* trivial stubs
|
||||
*/
|
||||
|
||||
static inline int readlink(const char *path, char *buf, size_t bufsiz)
|
||||
{ errno = ENOSYS; return -1; }
|
||||
static inline int symlink(const char *oldpath, const char *newpath)
|
||||
{ errno = ENOSYS; return -1; }
|
||||
static inline int fchmod(int fildes, mode_t mode)
|
||||
{ errno = ENOSYS; return -1; }
|
||||
#ifndef __MINGW64_VERSION_MAJOR
|
||||
@@ -218,6 +214,8 @@ int setitimer(int type, struct itimerval *in, struct itimerval *out);
|
||||
int sigaction(int sig, struct sigaction *in, struct sigaction *out);
|
||||
int link(const char *oldpath, const char *newpath);
|
||||
int uname(struct utsname *buf);
|
||||
int symlink(const char *target, const char *link);
|
||||
int readlink(const char *path, char *buf, size_t bufsiz);
|
||||
|
||||
/*
|
||||
* replacements of existing functions
|
||||
@@ -467,6 +465,8 @@ static inline void convert_slashes(char *path)
|
||||
#define PATH_SEP ';'
|
||||
extern char *mingw_query_user_email(void);
|
||||
#define query_user_email mingw_query_user_email
|
||||
extern const char *program_data_config(void);
|
||||
#define git_program_data_config program_data_config
|
||||
#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)
|
||||
#define PRIuMAX "I64u"
|
||||
#define PRId64 "I64d"
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#ifndef NO_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#include "git-compat-util.h"
|
||||
#include "run-command.h"
|
||||
#include "compat/terminal.h"
|
||||
#include "sigchain.h"
|
||||
#include "strbuf.h"
|
||||
#include "cache.h"
|
||||
|
||||
#if defined(HAVE_DEV_TTY) || defined(GIT_WINDOWS_NATIVE)
|
||||
|
||||
@@ -91,6 +96,55 @@ static int disable_echo(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *shell_prompt(const char *prompt, int echo)
|
||||
{
|
||||
const char *read_input[] = {
|
||||
/* Note: call 'bash' explicitly, as 'read -s' is bash-specific */
|
||||
"bash", "-c", echo ?
|
||||
"cat >/dev/tty && read -r line </dev/tty && echo \"$line\"" :
|
||||
"cat >/dev/tty && read -r -s line </dev/tty && echo \"$line\" && echo >/dev/tty",
|
||||
NULL
|
||||
};
|
||||
struct child_process child = CHILD_PROCESS_INIT;
|
||||
static struct strbuf buffer = STRBUF_INIT;
|
||||
int prompt_len = strlen(prompt), len = -1, code;
|
||||
|
||||
child.argv = read_input;
|
||||
child.in = -1;
|
||||
child.out = -1;
|
||||
child.silent_exec_failure = 1;
|
||||
|
||||
if (start_command(&child))
|
||||
return NULL;
|
||||
|
||||
if (write_in_full(child.in, prompt, prompt_len) != prompt_len) {
|
||||
error("could not write to prompt script");
|
||||
close(child.in);
|
||||
goto ret;
|
||||
}
|
||||
close(child.in);
|
||||
|
||||
strbuf_reset(&buffer);
|
||||
len = strbuf_read(&buffer, child.out, 1024);
|
||||
if (len < 0) {
|
||||
error("could not read from prompt script");
|
||||
goto ret;
|
||||
}
|
||||
|
||||
strbuf_strip_suffix(&buffer, "\n");
|
||||
strbuf_strip_suffix(&buffer, "\r");
|
||||
|
||||
ret:
|
||||
close(child.out);
|
||||
code = finish_command(&child);
|
||||
if (code) {
|
||||
error("failed to execute prompt script (exit code %d)", code);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return len < 0 ? NULL : buffer.buf;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef FORCE_TEXT
|
||||
@@ -103,6 +157,15 @@ char *git_terminal_prompt(const char *prompt, int echo)
|
||||
int r;
|
||||
FILE *input_fh, *output_fh;
|
||||
|
||||
#ifdef GIT_WINDOWS_NATIVE
|
||||
|
||||
/* try shell_prompt first, fall back to CONIN/OUT if bash is missing */
|
||||
char *result = shell_prompt(prompt, echo);
|
||||
if (result || errno != ENOENT)
|
||||
return result;
|
||||
|
||||
#endif
|
||||
|
||||
input_fh = fopen(INPUT_PATH, "r" FORCE_TEXT);
|
||||
if (!input_fh)
|
||||
return NULL;
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static inline int file_attr_to_st_mode (DWORD attr)
|
||||
static inline int file_attr_to_st_mode (DWORD attr, DWORD tag)
|
||||
{
|
||||
int fMode = S_IREAD;
|
||||
if (attr & FILE_ATTRIBUTE_DIRECTORY)
|
||||
if ((attr & FILE_ATTRIBUTE_REPARSE_POINT) && tag == IO_REPARSE_TAG_SYMLINK)
|
||||
fMode |= S_IFLNK;
|
||||
else if (attr & FILE_ATTRIBUTE_DIRECTORY)
|
||||
fMode |= S_IFDIR;
|
||||
else
|
||||
fMode |= S_IFREG;
|
||||
|
||||
@@ -16,7 +16,10 @@ static inline void finddata2dirent(struct dirent *ent, WIN32_FIND_DATAW *fdata)
|
||||
xwcstoutf(ent->d_name, fdata->cFileName, MAX_PATH * 3);
|
||||
|
||||
/* Set file type, based on WIN32_FIND_DATA */
|
||||
if (fdata->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
if ((fdata->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
|
||||
&& fdata->dwReserved0 == IO_REPARSE_TAG_SYMLINK)
|
||||
ent->d_type = DT_LNK;
|
||||
else if (fdata->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
ent->d_type = DT_DIR;
|
||||
else
|
||||
ent->d_type = DT_REG;
|
||||
|
||||
@@ -158,9 +158,10 @@ static struct fsentry *fseentry_create_entry(struct fscache *cache, struct fsent
|
||||
|
||||
fse = fsentry_alloc(cache, list, buf, len);
|
||||
|
||||
fse->st_mode = file_attr_to_st_mode(fdata->dwFileAttributes);
|
||||
fse->st_size = (((off64_t) (fdata->nFileSizeHigh)) << 32)
|
||||
| fdata->nFileSizeLow;
|
||||
fse->st_mode = file_attr_to_st_mode(fdata->dwFileAttributes,
|
||||
fdata->dwReserved0);
|
||||
fse->st_size = S_ISLNK(fse->st_mode) ? MAX_LONG_PATH :
|
||||
fdata->nFileSizeLow | (((off_t) fdata->nFileSizeHigh) << 32);
|
||||
filetime_to_timespec(&(fdata->ftLastAccessTime), &(fse->st_atim));
|
||||
filetime_to_timespec(&(fdata->ftLastWriteTime), &(fse->st_mtim));
|
||||
filetime_to_timespec(&(fdata->ftCreationTime), &(fse->st_ctim));
|
||||
@@ -520,7 +521,8 @@ static struct dirent *fscache_readdir(DIR *base_dir)
|
||||
if (!next)
|
||||
return NULL;
|
||||
dir->pfsentry = next;
|
||||
dir->dirent.d_type = S_ISDIR(next->st_mode) ? DT_DIR : DT_REG;
|
||||
dir->dirent.d_type = S_ISREG(next->st_mode) ? DT_REG :
|
||||
S_ISDIR(next->st_mode) ? DT_DIR : DT_LNK;
|
||||
dir->dirent.d_name = (char*) next->name;
|
||||
return &(dir->dirent);
|
||||
}
|
||||
|
||||
25
compat/win32/git.manifest
Normal file
25
compat/win32/git.manifest
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity type="win32" name="Git" version="0.0.0.1" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <wingdi.h>
|
||||
#include <winreg.h>
|
||||
#include "win32.h"
|
||||
#include "win32/lazyload.h"
|
||||
|
||||
static int fd_is_interactive[3] = { 0, 0, 0 };
|
||||
#define FD_CONSOLE 0x1
|
||||
@@ -41,26 +42,21 @@ typedef struct _CONSOLE_FONT_INFOEX {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef BOOL (WINAPI *PGETCURRENTCONSOLEFONTEX)(HANDLE, BOOL,
|
||||
PCONSOLE_FONT_INFOEX);
|
||||
|
||||
static void warn_if_raster_font(void)
|
||||
{
|
||||
DWORD fontFamily = 0;
|
||||
PGETCURRENTCONSOLEFONTEX pGetCurrentConsoleFontEx;
|
||||
DECLARE_PROC_ADDR(kernel32.dll, BOOL, GetCurrentConsoleFontEx,
|
||||
HANDLE, BOOL, PCONSOLE_FONT_INFOEX);
|
||||
|
||||
/* don't bother if output was ascii only */
|
||||
if (!non_ascii_used)
|
||||
return;
|
||||
|
||||
/* GetCurrentConsoleFontEx is available since Vista */
|
||||
pGetCurrentConsoleFontEx = (PGETCURRENTCONSOLEFONTEX) GetProcAddress(
|
||||
GetModuleHandle("kernel32.dll"),
|
||||
"GetCurrentConsoleFontEx");
|
||||
if (pGetCurrentConsoleFontEx) {
|
||||
if (INIT_PROC_ADDR(GetCurrentConsoleFontEx)) {
|
||||
CONSOLE_FONT_INFOEX cfi;
|
||||
cfi.cbSize = sizeof(cfi);
|
||||
if (pGetCurrentConsoleFontEx(console, 0, &cfi))
|
||||
if (GetCurrentConsoleFontEx(console, 0, &cfi))
|
||||
fontFamily = cfi.FontFamily;
|
||||
} else {
|
||||
/* pre-Vista: check default console font in registry */
|
||||
@@ -664,10 +660,20 @@ void winansi_init(void)
|
||||
*/
|
||||
HANDLE winansi_get_osfhandle(int fd)
|
||||
{
|
||||
HANDLE ret;
|
||||
|
||||
if (fd == 1 && (fd_is_interactive[1] & FD_SWAPPED))
|
||||
return hconsole1;
|
||||
if (fd == 2 && (fd_is_interactive[2] & FD_SWAPPED))
|
||||
return hconsole2;
|
||||
|
||||
return (HANDLE)_get_osfhandle(fd);
|
||||
ret = (HANDLE)_get_osfhandle(fd);
|
||||
|
||||
/*
|
||||
* There are obviously circumstances under which _get_osfhandle()
|
||||
* returns (HANDLE)-2. This is not documented anywhere, but that is so
|
||||
* clearly an invalid handle value that we can just work around this
|
||||
* and return the correct value for invalid handles.
|
||||
*/
|
||||
return ret == (HANDLE)-2 ? INVALID_HANDLE_VALUE : ret;
|
||||
}
|
||||
|
||||
13
config.c
13
config.c
@@ -1674,9 +1674,16 @@ static int do_git_config_sequence(const struct config_options *opts,
|
||||
repo_config = NULL;
|
||||
|
||||
current_parsing_scope = CONFIG_SCOPE_SYSTEM;
|
||||
if (git_config_system() && !access_or_die(git_etc_gitconfig(), R_OK, 0))
|
||||
ret += git_config_from_file(fn, git_etc_gitconfig(),
|
||||
data);
|
||||
if (git_config_system()) {
|
||||
if (git_program_data_config() &&
|
||||
!access_or_die(git_program_data_config(), R_OK, 0))
|
||||
ret += git_config_from_file(fn,
|
||||
git_program_data_config(),
|
||||
data);
|
||||
if (!access_or_die(git_etc_gitconfig(), R_OK, 0))
|
||||
ret += git_config_from_file(fn, git_etc_gitconfig(),
|
||||
data);
|
||||
}
|
||||
|
||||
current_parsing_scope = CONFIG_SCOPE_GLOBAL;
|
||||
if (xdg_config && !access_or_die(xdg_config, R_OK, ACCESS_EACCES_OK))
|
||||
|
||||
@@ -587,7 +587,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
|
||||
NO_STRTOUMAX = YesPlease
|
||||
NO_MKDTEMP = YesPlease
|
||||
NO_SVN_TESTS = YesPlease
|
||||
NO_PERL_MAKEMAKER = YesPlease
|
||||
RUNTIME_PREFIX = YesPlease
|
||||
HAVE_WPGMPTR = YesWeDo
|
||||
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
|
||||
@@ -616,7 +615,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
|
||||
NATIVE_CRLF = YesPlease
|
||||
X = .exe
|
||||
ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
|
||||
htmldir = doc/git/html/
|
||||
htmldir = share/doc/git/$(firstword $(subst -, ,$(GIT_VERSION)))/html
|
||||
prefix =
|
||||
INSTALL = /bin/install
|
||||
EXTLIBS += /mingw/lib/libz.a
|
||||
@@ -649,7 +648,8 @@ else
|
||||
BASIC_LDFLAGS += -Wl,--large-address-aware
|
||||
endif
|
||||
CC = gcc
|
||||
COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY
|
||||
COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
|
||||
-fstack-protector-strong
|
||||
EXTLIBS += -lntdll
|
||||
INSTALL = /bin/install
|
||||
NO_R_TO_GCC_LINKER = YesPlease
|
||||
@@ -661,11 +661,71 @@ else
|
||||
NO_LIBPCRE1_JIT = UnfortunatelyYes
|
||||
NO_CURL =
|
||||
USE_NED_ALLOCATOR = YesPlease
|
||||
NO_PYTHON =
|
||||
else
|
||||
COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
|
||||
NO_CURL = YesPlease
|
||||
endif
|
||||
endif
|
||||
ifeq (i686,$(uname_M))
|
||||
MINGW_PREFIX := mingw32
|
||||
endif
|
||||
ifeq (x86_64,$(uname_M))
|
||||
MINGW_PREFIX := mingw64
|
||||
endif
|
||||
|
||||
DESTDIR_WINDOWS = $(shell cygpath -aw '$(DESTDIR_SQ)')
|
||||
DESTDIR_MIXED = $(shell cygpath -am '$(DESTDIR_SQ)')
|
||||
install-mingit-test-artifacts:
|
||||
install -m755 -d '$(DESTDIR_SQ)/usr/bin'
|
||||
printf '%s\n%s\n' >'$(DESTDIR_SQ)/usr/bin/perl' \
|
||||
"#!/mingw64/bin/busybox sh" \
|
||||
"exec \"$(shell cygpath -am /usr/bin/perl.exe)\" \"\$$@\""
|
||||
|
||||
install -m755 -d '$(DESTDIR_SQ)'
|
||||
printf '%s%s\n%s\n%s\n%s\n%s\n' >'$(DESTDIR_SQ)/init.bat' \
|
||||
"PATH=$(DESTDIR_WINDOWS)\\$(MINGW_PREFIX)\\bin;" \
|
||||
"C:\\WINDOWS;C:\\WINDOWS\\system32" \
|
||||
"@set GIT_TEST_INSTALLED=$(DESTDIR_MIXED)/$(MINGW_PREFIX)/bin" \
|
||||
"@`echo "$(DESTDIR_WINDOWS)" | sed 's/:.*/:/'`" \
|
||||
"@cd `echo "$(DESTDIR_WINDOWS)" | sed 's/^.://'`\\test-git\\t" \
|
||||
"@echo Now, run 'helper\\test-run-command testsuite'"
|
||||
|
||||
install -m755 -d '$(DESTDIR_SQ)/test-git'
|
||||
sed 's/^\(NO_PERL\|NO_PYTHON\)=.*/\1=YesPlease/' \
|
||||
<GIT-BUILD-OPTIONS >'$(DESTDIR_SQ)/test-git/GIT-BUILD-OPTIONS'
|
||||
|
||||
install -m755 -d '$(DESTDIR_SQ)/test-git/t/helper'
|
||||
install -m755 $(TEST_PROGRAMS) '$(DESTDIR_SQ)/test-git/t/helper'
|
||||
(cd t && $(TAR) cf - t[0-9][0-9][0-9][0-9] diff-lib) | \
|
||||
(cd '$(DESTDIR_SQ)/test-git/t' && $(TAR) xf -)
|
||||
install -m755 t/t556x_common t/*.sh '$(DESTDIR_SQ)/test-git/t'
|
||||
|
||||
install -m755 -d '$(DESTDIR_SQ)/test-git/templates'
|
||||
(cd templates && $(TAR) cf - blt) | \
|
||||
(cd '$(DESTDIR_SQ)/test-git/templates' && $(TAR) xf -)
|
||||
|
||||
# po/build/locale for t0200
|
||||
install -m755 -d '$(DESTDIR_SQ)/test-git/po/build/locale'
|
||||
(cd po/build/locale && $(TAR) cf - .) | \
|
||||
(cd '$(DESTDIR_SQ)/test-git/po/build/locale' && $(TAR) xf -)
|
||||
|
||||
# git-daemon.exe for t5802, git-http-backend.exe for t5560
|
||||
install -m755 -d '$(DESTDIR_SQ)/$(MINGW_PREFIX)/bin'
|
||||
install -m755 git-daemon.exe git-http-backend.exe \
|
||||
'$(DESTDIR_SQ)/$(MINGW_PREFIX)/bin'
|
||||
|
||||
# git-remote-testgit for t5801
|
||||
install -m755 -d '$(DESTDIR_SQ)/$(MINGW_PREFIX)/libexec/git-core'
|
||||
install -m755 git-remote-testgit \
|
||||
'$(DESTDIR_SQ)/$(MINGW_PREFIX)/libexec/git-core'
|
||||
|
||||
# git-upload-archive (dashed) for t5000
|
||||
install -m755 git-upload-archive.exe '$(DESTDIR_SQ)/$(MINGW_PREFIX)/bin'
|
||||
|
||||
# git-difftool--helper for t7800
|
||||
install -m755 git-difftool--helper \
|
||||
'$(DESTDIR_SQ)/$(MINGW_PREFIX)/libexec/git-core'
|
||||
endif
|
||||
ifeq ($(uname_S),QNX)
|
||||
COMPAT_CFLAGS += -DSA_RESTART=0
|
||||
|
||||
4
diff.c
4
diff.c
@@ -4207,6 +4207,10 @@ static void run_external_diff(const char *pgm,
|
||||
argv_array_pushf(&env, "GIT_DIFF_PATH_COUNTER=%d", ++o->diff_path_counter);
|
||||
argv_array_pushf(&env, "GIT_DIFF_PATH_TOTAL=%d", q->nr);
|
||||
|
||||
if (one && one->should_munmap)
|
||||
diff_free_filespec_data(one);
|
||||
if (two && two->should_munmap)
|
||||
diff_free_filespec_data(two);
|
||||
if (run_command_v_opt_cd_env(argv.argv, RUN_USING_SHELL, NULL, env.argv))
|
||||
die(_("external diff died, stopping at %s"), name);
|
||||
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
#ifndef NO_GETTEXT
|
||||
# include <locale.h>
|
||||
# include <libintl.h>
|
||||
# ifdef HAVE_LIBCHARSET_H
|
||||
# ifdef GIT_WINDOWS_NATIVE
|
||||
# define locale_charset() "UTF-8"
|
||||
# elif defined HAVE_LIBCHARSET_H
|
||||
# include <libcharset.h>
|
||||
# else
|
||||
# include <langinfo.h>
|
||||
|
||||
@@ -422,6 +422,10 @@ static inline char *git_find_last_dir_sep(const char *path)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef git_program_data_config
|
||||
#define git_program_data_config() NULL
|
||||
#endif
|
||||
|
||||
#if defined(__HP_cc) && (__HP_cc >= 61000)
|
||||
#define NORETURN __attribute__((noreturn))
|
||||
#define NORETURN_PTR
|
||||
|
||||
@@ -332,17 +332,30 @@ create_virtual_base() {
|
||||
# Platform specific tweaks to work around some commands
|
||||
case $(uname -s) in
|
||||
*MINGW*)
|
||||
# Windows has its own (incompatible) sort and find
|
||||
sort () {
|
||||
/usr/bin/sort "$@"
|
||||
}
|
||||
find () {
|
||||
/usr/bin/find "$@"
|
||||
}
|
||||
# git sees Windows-style pwd
|
||||
pwd () {
|
||||
builtin pwd -W
|
||||
}
|
||||
if test -x /usr/bin/sort
|
||||
then
|
||||
# Windows has its own (incompatible) sort; override
|
||||
sort () {
|
||||
/usr/bin/sort "$@"
|
||||
}
|
||||
fi
|
||||
if test -x /usr/bin/find
|
||||
then
|
||||
# Windows has its own (incompatible) find; override
|
||||
find () {
|
||||
/usr/bin/find "$@"
|
||||
}
|
||||
fi
|
||||
# On Windows, Git wants Windows paths. But /usr/bin/pwd spits out
|
||||
# Unix-style paths. At least in Bash, we have a builtin pwd that
|
||||
# understands the -W option to force "mixed" paths, i.e. with drive
|
||||
# prefix but still with forward slashes. Let's use that, if available.
|
||||
if type builtin >/dev/null 2>&1
|
||||
then
|
||||
pwd () {
|
||||
builtin pwd -W
|
||||
}
|
||||
fi
|
||||
is_absolute_path () {
|
||||
case "$1" in
|
||||
[/\\]* | [A-Za-z]:*)
|
||||
|
||||
2
git.rc
2
git.rc
@@ -20,3 +20,5 @@ BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
1 RT_MANIFEST "compat/win32/git.manifest"
|
||||
|
||||
@@ -293,11 +293,9 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
|
||||
struct child_process gpg = CHILD_PROCESS_INIT;
|
||||
int ret;
|
||||
size_t i, j, bottom;
|
||||
struct strbuf gpg_status = STRBUF_INIT;
|
||||
|
||||
argv_array_pushl(&gpg.args,
|
||||
use_format->program,
|
||||
"--status-fd=2",
|
||||
"-bsau", signing_key,
|
||||
NULL);
|
||||
|
||||
@@ -309,12 +307,10 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
|
||||
*/
|
||||
sigchain_push(SIGPIPE, SIG_IGN);
|
||||
ret = pipe_command(&gpg, buffer->buf, buffer->len,
|
||||
signature, 1024, &gpg_status, 0);
|
||||
signature, 1024, NULL, 0);
|
||||
sigchain_pop(SIGPIPE);
|
||||
|
||||
ret |= !strstr(gpg_status.buf, "\n[GNUPG:] SIG_CREATED ");
|
||||
strbuf_release(&gpg_status);
|
||||
if (ret)
|
||||
if (ret || signature->len == bottom)
|
||||
return error(_("gpg failed to sign the data"));
|
||||
|
||||
/* Strip CR from the line endings, in case we are on Windows. */
|
||||
|
||||
@@ -17,14 +17,14 @@ static void trim_last_path_component(struct strbuf *path)
|
||||
int i = path->len;
|
||||
|
||||
/* back up past trailing slashes, if any */
|
||||
while (i && path->buf[i - 1] == '/')
|
||||
while (i && is_dir_sep(path->buf[i - 1]))
|
||||
i--;
|
||||
|
||||
/*
|
||||
* then go backwards until a slash, or the beginning of the
|
||||
* string
|
||||
*/
|
||||
while (i && path->buf[i - 1] != '/')
|
||||
while (i && !is_dir_sep(path->buf[i - 1]))
|
||||
i--;
|
||||
|
||||
strbuf_setlen(path, i);
|
||||
|
||||
10
strbuf.c
10
strbuf.c
@@ -468,8 +468,6 @@ ssize_t strbuf_write(struct strbuf *sb, FILE *f)
|
||||
}
|
||||
|
||||
|
||||
#define STRBUF_MAXLINK (2*PATH_MAX)
|
||||
|
||||
int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)
|
||||
{
|
||||
size_t oldalloc = sb->alloc;
|
||||
@@ -477,15 +475,15 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)
|
||||
if (hint < 32)
|
||||
hint = 32;
|
||||
|
||||
while (hint < STRBUF_MAXLINK) {
|
||||
for (;;) {
|
||||
ssize_t len;
|
||||
|
||||
strbuf_grow(sb, hint);
|
||||
len = readlink(path, sb->buf, hint);
|
||||
strbuf_grow(sb, hint + 1);
|
||||
len = readlink(path, sb->buf, hint + 1);
|
||||
if (len < 0) {
|
||||
if (errno != ERANGE)
|
||||
break;
|
||||
} else if (len < hint) {
|
||||
} else if (len <= hint) {
|
||||
strbuf_setlen(sb, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 275 B |
73
t/helper/test-cmp.c
Normal file
73
t/helper/test-cmp.c
Normal file
@@ -0,0 +1,73 @@
|
||||
#include "test-tool.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "strbuf.h"
|
||||
#include "gettext.h"
|
||||
#include "parse-options.h"
|
||||
#include "run-command.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define NO_SUCH_DIR "\\\\.\\GLOBALROOT\\invalid"
|
||||
#else
|
||||
#define NO_SUCH_DIR "/dev/null"
|
||||
#endif
|
||||
|
||||
static int run_diff(const char *path1, const char *path2)
|
||||
{
|
||||
const char *argv[] = {
|
||||
"diff", "--no-index", NULL, NULL, NULL
|
||||
};
|
||||
const char *env[] = {
|
||||
"GIT_PAGER=cat",
|
||||
"GIT_DIR=" NO_SUCH_DIR,
|
||||
"HOME=" NO_SUCH_DIR,
|
||||
NULL
|
||||
};
|
||||
|
||||
argv[2] = path1;
|
||||
argv[3] = path2;
|
||||
return run_command_v_opt_cd_env(argv,
|
||||
RUN_COMMAND_NO_STDIN | RUN_GIT_CMD,
|
||||
NULL, env);
|
||||
}
|
||||
|
||||
int cmd__cmp(int argc, const char **argv)
|
||||
{
|
||||
FILE *f0, *f1;
|
||||
struct strbuf b0 = STRBUF_INIT, b1 = STRBUF_INIT;
|
||||
|
||||
if (argc != 3)
|
||||
die("Require exactly 2 arguments, got %d", argc);
|
||||
|
||||
if (!(f0 = !strcmp(argv[1], "-") ? stdin : fopen(argv[1], "r")))
|
||||
return error_errno("could not open '%s'", argv[1]);
|
||||
if (!(f1 = !strcmp(argv[2], "-") ? stdin : fopen(argv[2], "r"))) {
|
||||
fclose(f0);
|
||||
return error_errno("could not open '%s'", argv[2]);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
int r0 = strbuf_getline(&b0, f0);
|
||||
int r1 = strbuf_getline(&b1, f1);
|
||||
|
||||
if (r0 == EOF) {
|
||||
fclose(f0);
|
||||
fclose(f1);
|
||||
strbuf_release(&b0);
|
||||
strbuf_release(&b1);
|
||||
if (r1 == EOF)
|
||||
return 0;
|
||||
cmp_failed:
|
||||
if (!run_diff(argv[1], argv[2]))
|
||||
die("Huh? 'diff --no-index %s %s' succeeded",
|
||||
argv[1], argv[2]);
|
||||
return 1;
|
||||
}
|
||||
if (r1 == EOF || strbuf_cmp(&b0, &b1)) {
|
||||
fclose(f0);
|
||||
fclose(f1);
|
||||
strbuf_release(&b0);
|
||||
strbuf_release(&b1);
|
||||
goto cmp_failed;
|
||||
}
|
||||
}
|
||||
}
|
||||
47
t/helper/test-iconv.c
Normal file
47
t/helper/test-iconv.c
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "test-tool.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "strbuf.h"
|
||||
#include "gettext.h"
|
||||
#include "parse-options.h"
|
||||
#include "utf8.h"
|
||||
|
||||
int cmd__iconv(int argc, const char **argv)
|
||||
{
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
char *from = NULL, *to = NULL, *p;
|
||||
size_t len;
|
||||
int ret = 0;
|
||||
const char * const iconv_usage[] = {
|
||||
N_("test-helper --iconv [<options>]"),
|
||||
NULL
|
||||
};
|
||||
struct option options[] = {
|
||||
OPT_STRING('f', "from-code", &from, "encoding", "from"),
|
||||
OPT_STRING('t', "to-code", &to, "encoding", "to"),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
argc = parse_options(argc, argv, NULL, options,
|
||||
iconv_usage, 0);
|
||||
|
||||
if (argc > 1 || !from || !to)
|
||||
usage_with_options(iconv_usage, options);
|
||||
|
||||
if (!argc) {
|
||||
if (strbuf_read(&buf, 0, 2048) < 0)
|
||||
die_errno("Could not read from stdin");
|
||||
} else if (strbuf_read_file(&buf, argv[0], 2048) < 0)
|
||||
die_errno("Could not read from '%s'", argv[0]);
|
||||
|
||||
p = reencode_string_len(buf.buf, buf.len, to, from, &len);
|
||||
if (!p)
|
||||
die_errno("Could not reencode");
|
||||
if (write(1, p, len) < 0)
|
||||
ret = !!error_errno("Could not write %"PRIuMAX" bytes",
|
||||
(uintmax_t)len);
|
||||
|
||||
strbuf_release(&buf);
|
||||
free(p);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -10,9 +10,14 @@
|
||||
|
||||
#include "test-tool.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "cache.h"
|
||||
#include "run-command.h"
|
||||
#include "argv-array.h"
|
||||
#include "strbuf.h"
|
||||
#include "parse-options.h"
|
||||
#include "string-list.h"
|
||||
#include "thread-utils.h"
|
||||
#include "wildmatch.h"
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -50,11 +55,196 @@ static int task_finished(int result,
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct testsuite {
|
||||
struct string_list tests, failed;
|
||||
int next;
|
||||
int quiet, immediate, verbose, trace;
|
||||
};
|
||||
|
||||
static int next_test(struct child_process *cp, struct strbuf *err, void *cb,
|
||||
void **task_cb)
|
||||
{
|
||||
struct testsuite *suite = cb;
|
||||
const char *test;
|
||||
if (suite->next >= suite->tests.nr)
|
||||
return 0;
|
||||
|
||||
test = suite->tests.items[suite->next++].string;
|
||||
argv_array_pushl(&cp->args, "sh", test, NULL);
|
||||
if (suite->quiet)
|
||||
argv_array_push(&cp->args, "--quiet");
|
||||
if (suite->immediate)
|
||||
argv_array_push(&cp->args, "-i");
|
||||
if (suite->verbose)
|
||||
argv_array_push(&cp->args, "-v");
|
||||
if (suite->trace)
|
||||
argv_array_push(&cp->args, "-x");
|
||||
|
||||
strbuf_addf(err, "Output of '%s':\n", test);
|
||||
*task_cb = (void *)test;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int test_finished(int result, struct strbuf *err, void *cb,
|
||||
void *task_cb)
|
||||
{
|
||||
struct testsuite *suite = cb;
|
||||
const char *name = (const char *)task_cb;
|
||||
|
||||
if (result)
|
||||
string_list_append(&suite->failed, name);
|
||||
|
||||
strbuf_addf(err, "%s: '%s'\n", result ? "FAIL" : "SUCCESS", name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_failed(struct strbuf *out, void *cb, void *task_cb)
|
||||
{
|
||||
struct testsuite *suite = cb;
|
||||
const char *name = (const char *)task_cb;
|
||||
|
||||
string_list_append(&suite->failed, name);
|
||||
strbuf_addf(out, "FAILED TO START: '%s'\n", name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char * const testsuite_usage[] = {
|
||||
"test-run-command testsuite [<options>] [<pattern>...]",
|
||||
NULL
|
||||
};
|
||||
|
||||
static int testsuite(int argc, const char **argv)
|
||||
{
|
||||
struct testsuite suite;
|
||||
int max_jobs = 1, i, ret;
|
||||
DIR *dir;
|
||||
struct dirent *d;
|
||||
struct option options[] = {
|
||||
OPT_BOOL('i', "immediate", &suite.immediate,
|
||||
"stop at first failed test case(s)"),
|
||||
OPT_INTEGER('j', "jobs", &max_jobs, "run <N> jobs in parallel"),
|
||||
OPT_BOOL('q', "quiet", &suite.quiet, "be terse"),
|
||||
OPT_BOOL('v', "verbose", &suite.verbose, "be verbose"),
|
||||
OPT_BOOL('x', "trace", &suite.trace, "trace shell commands"),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
memset(&suite, 0, sizeof(suite));
|
||||
suite.tests.strdup_strings = suite.failed.strdup_strings = 1;
|
||||
|
||||
argc = parse_options(argc, argv, NULL, options,
|
||||
testsuite_usage, PARSE_OPT_STOP_AT_NON_OPTION);
|
||||
|
||||
if (max_jobs <= 0)
|
||||
max_jobs = online_cpus();
|
||||
|
||||
dir = opendir(".");
|
||||
if (!dir)
|
||||
die("Could not open the current directory");
|
||||
while ((d = readdir(dir))) {
|
||||
const char *p = d->d_name;
|
||||
|
||||
if (*p != 't' || !isdigit(p[1]) || !isdigit(p[2]) ||
|
||||
!isdigit(p[3]) || !isdigit(p[4]) || p[5] != '-' ||
|
||||
!ends_with(p, ".sh"))
|
||||
continue;
|
||||
|
||||
/* No pattern: match all */
|
||||
if (!argc) {
|
||||
string_list_append(&suite.tests, p);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
if (!wildmatch(argv[i], p, 0)) {
|
||||
string_list_append(&suite.tests, p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
if (!suite.tests.nr)
|
||||
die("No tests match!");
|
||||
if (max_jobs > suite.tests.nr)
|
||||
max_jobs = suite.tests.nr;
|
||||
|
||||
fprintf(stderr, "Running %d tests (%d at a time)\n",
|
||||
suite.tests.nr, max_jobs);
|
||||
|
||||
ret = run_processes_parallel(max_jobs, next_test, test_failed,
|
||||
test_finished, &suite);
|
||||
|
||||
if (suite.failed.nr > 0) {
|
||||
ret = 1;
|
||||
fprintf(stderr, "%d tests failed:\n\n", suite.failed.nr);
|
||||
for (i = 0; i < suite.failed.nr; i++)
|
||||
fprintf(stderr, "\t%s\n", suite.failed.items[i].string);
|
||||
}
|
||||
|
||||
string_list_clear(&suite.tests, 0);
|
||||
string_list_clear(&suite.failed, 0);
|
||||
|
||||
return !!ret;
|
||||
}
|
||||
|
||||
static int inherit_handle(const char *argv0)
|
||||
{
|
||||
struct child_process cp = CHILD_PROCESS_INIT;
|
||||
char path[PATH_MAX];
|
||||
int tmp;
|
||||
|
||||
/* First, open an inheritable handle */
|
||||
xsnprintf(path, sizeof(path), "out-XXXXXX");
|
||||
tmp = xmkstemp(path);
|
||||
|
||||
argv_array_pushl(&cp.args,
|
||||
"test-tool", argv0, "inherited-handle-child", NULL);
|
||||
cp.in = -1;
|
||||
cp.no_stdout = cp.no_stderr = 1;
|
||||
if (start_command(&cp) < 0)
|
||||
die("Could not start child process");
|
||||
|
||||
/* Then close it, and try to delete it. */
|
||||
close(tmp);
|
||||
if (unlink(path))
|
||||
die("Could not delete '%s'", path);
|
||||
|
||||
if (close(cp.in) < 0 || finish_command(&cp) < 0)
|
||||
die("Child did not finish");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int inherit_handle_child(void)
|
||||
{
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
|
||||
if (strbuf_read(&buf, 0, 0) < 0)
|
||||
die("Could not read stdin");
|
||||
printf("Received %s\n", buf.buf);
|
||||
strbuf_release(&buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cmd__run_command(int argc, const char **argv)
|
||||
{
|
||||
struct child_process proc = CHILD_PROCESS_INIT;
|
||||
int jobs;
|
||||
|
||||
if (argc > 1 && !strcmp(argv[1], "testsuite"))
|
||||
exit(testsuite(argc - 1, argv + 1));
|
||||
|
||||
if (argc < 2)
|
||||
return 1;
|
||||
if (!strcmp(argv[1], "inherited-handle"))
|
||||
exit(inherit_handle(argv[0]));
|
||||
if (!strcmp(argv[1], "inherited-handle-child"))
|
||||
exit(inherit_handle_child());
|
||||
|
||||
if (argc < 3)
|
||||
return 1;
|
||||
while (!strcmp(argv[1], "env")) {
|
||||
|
||||
@@ -8,6 +8,7 @@ struct test_cmd {
|
||||
|
||||
static struct test_cmd cmds[] = {
|
||||
{ "chmtime", cmd__chmtime },
|
||||
{ "cmp", cmd__cmp },
|
||||
{ "config", cmd__config },
|
||||
{ "ctype", cmd__ctype },
|
||||
{ "date", cmd__date },
|
||||
@@ -21,6 +22,7 @@ static struct test_cmd cmds[] = {
|
||||
{ "genrandom", cmd__genrandom },
|
||||
{ "hashmap", cmd__hashmap },
|
||||
{ "hash-speed", cmd__hash_speed },
|
||||
{ "iconv", cmd__iconv },
|
||||
{ "index-version", cmd__index_version },
|
||||
{ "json-writer", cmd__json_writer },
|
||||
{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "git-compat-util.h"
|
||||
|
||||
int cmd__chmtime(int argc, const char **argv);
|
||||
int cmd__cmp(int argc, const char **argv);
|
||||
int cmd__config(int argc, const char **argv);
|
||||
int cmd__ctype(int argc, const char **argv);
|
||||
int cmd__date(int argc, const char **argv);
|
||||
@@ -18,6 +19,7 @@ int cmd__example_decorate(int argc, const char **argv);
|
||||
int cmd__genrandom(int argc, const char **argv);
|
||||
int cmd__hashmap(int argc, const char **argv);
|
||||
int cmd__hash_speed(int argc, const char **argv);
|
||||
int cmd__iconv(int argc, const char **argv);
|
||||
int cmd__index_version(int argc, const char **argv);
|
||||
int cmd__json_writer(int argc, const char **argv);
|
||||
int cmd__lazy_init_name_hash(int argc, const char **argv);
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
. ../../GIT-BUILD-OPTIONS
|
||||
INTEROP_ROOT=$(pwd)
|
||||
BUILD_ROOT=$INTEROP_ROOT/build
|
||||
case "$PATH" in
|
||||
*\;*) PATH_SEP=\; ;;
|
||||
*) PATH_SEP=: ;;
|
||||
esac
|
||||
|
||||
build_version () {
|
||||
if test -z "$1"
|
||||
@@ -57,7 +61,7 @@ wrap_git () {
|
||||
write_script "$1" <<-EOF
|
||||
GIT_EXEC_PATH="$2"
|
||||
export GIT_EXEC_PATH
|
||||
PATH="$2:\$PATH"
|
||||
PATH="$2$PATH_SEP\$PATH"
|
||||
export GIT_EXEC_PATH
|
||||
exec git "\$@"
|
||||
EOF
|
||||
@@ -71,7 +75,7 @@ generate_wrappers () {
|
||||
echo >&2 fatal: test tried to run generic git
|
||||
exit 1
|
||||
EOF
|
||||
PATH=$(pwd)/.bin:$PATH
|
||||
PATH=$(pwd)/.bin$PATH_SEP$PATH
|
||||
}
|
||||
|
||||
VERSION_A=${GIT_TEST_VERSION_A:-$VERSION_A}
|
||||
|
||||
@@ -214,7 +214,7 @@ setup_ext_wrapper () {
|
||||
cd "$TRASH_DIRECTORY/remote" &&
|
||||
eval "$*"
|
||||
EOF
|
||||
PATH=$TRASH_DIRECTORY:$PATH &&
|
||||
PATH=$TRASH_DIRECTORY$PATH_SEP$PATH &&
|
||||
export TRASH_DIRECTORY
|
||||
'
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ test_expect_success SYMLINKS 're-init to move gitdir symlink' '
|
||||
# Tests for the hidden file attribute on windows
|
||||
is_hidden () {
|
||||
# Use the output of `attrib`, ignore the absolute path
|
||||
case "$(attrib "$1")" in *H*?:*) return 0;; esac
|
||||
case "$("$SYSTEMROOT"/system32/attrib "$1")" in *H*?:*) return 0;; esac
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ test_description='blob conversion via gitattributes'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
TEST_ROOT="$PWD"
|
||||
PATH=$TEST_ROOT:$PATH
|
||||
TEST_ROOT="$(pwd)"
|
||||
PATH=$PWD$PATH_SEP$PATH
|
||||
|
||||
write_script <<\EOF "$TEST_ROOT/rot13.sh"
|
||||
tr \
|
||||
|
||||
@@ -135,25 +135,25 @@ ancestor /foo /fo -1
|
||||
ancestor /foo /foo -1
|
||||
ancestor /foo /bar -1
|
||||
ancestor /foo /foo/bar -1
|
||||
ancestor /foo /foo:/bar -1
|
||||
ancestor /foo /:/foo:/bar 0
|
||||
ancestor /foo /foo:/:/bar 0
|
||||
ancestor /foo /:/bar:/foo 0
|
||||
ancestor /foo "/foo$PATH_SEP/bar" -1
|
||||
ancestor /foo "/$PATH_SEP/foo$PATH_SEP/bar" 0
|
||||
ancestor /foo "/foo$PATH_SEP/$PATH_SEP/bar" 0
|
||||
ancestor /foo "/$PATH_SEP/bar$PATH_SEP/foo" 0
|
||||
ancestor /foo/bar / 0
|
||||
ancestor /foo/bar /fo -1
|
||||
ancestor /foo/bar /foo 4
|
||||
ancestor /foo/bar /foo/ba -1
|
||||
ancestor /foo/bar /:/fo 0
|
||||
ancestor /foo/bar /foo:/foo/ba 4
|
||||
ancestor /foo/bar "/$PATH_SEP/fo" 0
|
||||
ancestor /foo/bar "/foo$PATH_SEP/foo/ba" 4
|
||||
ancestor /foo/bar /bar -1
|
||||
ancestor /foo/bar /fo -1
|
||||
ancestor /foo/bar /foo:/bar 4
|
||||
ancestor /foo/bar /:/foo:/bar 4
|
||||
ancestor /foo/bar /foo:/:/bar 4
|
||||
ancestor /foo/bar /:/bar:/fo 0
|
||||
ancestor /foo/bar /:/bar 0
|
||||
ancestor /foo/bar "/foo$PATH_SEP/bar" 4
|
||||
ancestor /foo/bar "/$PATH_SEP/foo$PATH_SEP/bar" 4
|
||||
ancestor /foo/bar "/foo$PATH_SEP/$PATH_SEP/bar" 4
|
||||
ancestor /foo/bar "/$PATH_SEP/bar$PATH_SEP/fo" 0
|
||||
ancestor /foo/bar "/$PATH_SEP/bar" 0
|
||||
ancestor /foo/bar /foo 4
|
||||
ancestor /foo/bar /foo:/bar 4
|
||||
ancestor /foo/bar "/foo$PATH_SEP/bar" 4
|
||||
ancestor /foo/bar /bar -1
|
||||
|
||||
test_expect_success 'strip_path_suffix' '
|
||||
|
||||
@@ -12,6 +12,10 @@ cat >hello-script <<-EOF
|
||||
cat hello-script
|
||||
EOF
|
||||
|
||||
test_expect_success MINGW 'subprocess inherits only std handles' '
|
||||
test-tool run-command inherited-handle
|
||||
'
|
||||
|
||||
test_expect_success 'start_command reports ENOENT (slash)' '
|
||||
test-tool run-command start-command-ENOENT ./does-not-exist 2>err &&
|
||||
test_i18ngrep "\./does-not-exist" err
|
||||
@@ -65,7 +69,7 @@ test_expect_success 'run_command does not try to execute a directory' '
|
||||
cat bin2/greet
|
||||
EOF
|
||||
|
||||
PATH=$PWD/bin1:$PWD/bin2:$PATH \
|
||||
PATH=$PWD/bin1$PATH_SEP$PWD/bin2$PATH_SEP$PATH \
|
||||
test-tool run-command run-command greet >actual 2>err &&
|
||||
test_cmp bin2/greet actual &&
|
||||
test_must_be_empty err
|
||||
@@ -82,7 +86,7 @@ test_expect_success POSIXPERM 'run_command passes over non-executable file' '
|
||||
cat bin2/greet
|
||||
EOF
|
||||
|
||||
PATH=$PWD/bin1:$PWD/bin2:$PATH \
|
||||
PATH=$PWD/bin1$PATH_SEP$PWD/bin2$PATH_SEP$PATH \
|
||||
test-tool run-command run-command greet >actual 2>err &&
|
||||
test_cmp bin2/greet actual &&
|
||||
test_must_be_empty err
|
||||
@@ -102,7 +106,7 @@ test_expect_success POSIXPERM,SANITY 'unreadable directory in PATH' '
|
||||
git config alias.nitfol "!echo frotz" &&
|
||||
chmod a-rx local-command &&
|
||||
(
|
||||
PATH=./local-command:$PATH &&
|
||||
PATH=./local-command$PATH_SEP$PATH &&
|
||||
git nitfol >actual
|
||||
) &&
|
||||
echo frotz >expect &&
|
||||
@@ -210,4 +214,10 @@ test_expect_success MINGW 'verify curlies are quoted properly' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success MINGW 'can spawn with argv[0] containing spaces' '
|
||||
cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" ./ &&
|
||||
test_must_fail "$PWD/test-fake-ssh$X" 2>err &&
|
||||
grep TRASH_DIRECTORY err
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -30,7 +30,7 @@ test_expect_success 'setup helper scripts' '
|
||||
test -z "$pass" || echo password=$pass
|
||||
EOF
|
||||
|
||||
PATH="$PWD:$PATH"
|
||||
PATH="$PWD$PATH_SEP$PATH"
|
||||
'
|
||||
|
||||
test_expect_success 'credential_fill invokes helper' '
|
||||
|
||||
@@ -1709,7 +1709,7 @@ test_expect_success '--show-origin getting a single key' '
|
||||
test_cmp expect output
|
||||
'
|
||||
|
||||
test_expect_success 'set up custom config file' '
|
||||
test_expect_success !MINGW 'set up custom config file' '
|
||||
CUSTOM_CONFIG_FILE="file\" (dq) and spaces.conf" &&
|
||||
cat >"$CUSTOM_CONFIG_FILE" <<-\EOF
|
||||
[user]
|
||||
@@ -1725,7 +1725,7 @@ test_expect_success !MINGW '--show-origin escape special file name characters' '
|
||||
test_cmp expect output
|
||||
'
|
||||
|
||||
test_expect_success '--show-origin stdin' '
|
||||
test_expect_success !MINGW '--show-origin stdin' '
|
||||
cat >expect <<-\EOF &&
|
||||
standard input: user.custom=true
|
||||
EOF
|
||||
|
||||
@@ -79,9 +79,9 @@ then
|
||||
GIT_CEILING_DIRECTORIES="$TRASH_ROOT/top/"
|
||||
test_fail subdir_ceil_at_top_slash
|
||||
|
||||
GIT_CEILING_DIRECTORIES=":$TRASH_ROOT/top"
|
||||
GIT_CEILING_DIRECTORIES="$PATH_SEP$TRASH_ROOT/top"
|
||||
test_prefix subdir_ceil_at_top_no_resolve "sub/dir/"
|
||||
GIT_CEILING_DIRECTORIES=":$TRASH_ROOT/top/"
|
||||
GIT_CEILING_DIRECTORIES="$PATH_SEP$TRASH_ROOT/top/"
|
||||
test_prefix subdir_ceil_at_top_slash_no_resolve "sub/dir/"
|
||||
fi
|
||||
|
||||
@@ -111,13 +111,13 @@ GIT_CEILING_DIRECTORIES="$TRASH_ROOT/subdi"
|
||||
test_prefix subdir_ceil_at_subdi_slash "sub/dir/"
|
||||
|
||||
|
||||
GIT_CEILING_DIRECTORIES="/foo:$TRASH_ROOT/sub"
|
||||
GIT_CEILING_DIRECTORIES="/foo$PATH_SEP$TRASH_ROOT/sub"
|
||||
test_fail second_of_two
|
||||
|
||||
GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub:/bar"
|
||||
GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub$PATH_SEP/bar"
|
||||
test_fail first_of_two
|
||||
|
||||
GIT_CEILING_DIRECTORIES="/foo:$TRASH_ROOT/sub:/bar"
|
||||
GIT_CEILING_DIRECTORIES="/foo$PATH_SEP$TRASH_ROOT/sub$PATH_SEP/bar"
|
||||
test_fail second_of_three
|
||||
|
||||
|
||||
|
||||
51
t/t2040-checkout-symlink-attr.sh
Executable file
51
t/t2040-checkout-symlink-attr.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='checkout symlinks with `symlink` attribute on Windows
|
||||
|
||||
Ensures that Git for Windows creates symlinks of the right type,
|
||||
as specified by the `symlink` attribute in `.gitattributes`.'
|
||||
|
||||
# Tell MSYS to create native symlinks. Without this flag test-lib's
|
||||
# prerequisite detection for SYMLINKS doesn't detect the right thing.
|
||||
MSYS=winsymlinks:nativestrict && export MSYS
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
if ! test_have_prereq MINGW,SYMLINKS
|
||||
then
|
||||
skip_all='skipping $0: MinGW-only test, which requires symlink support.'
|
||||
test_done
|
||||
fi
|
||||
|
||||
# Adds a symlink to the index without clobbering the work tree.
|
||||
cache_symlink () {
|
||||
sha=$(printf '%s' "$1" | git hash-object --stdin -w) &&
|
||||
git update-index --add --cacheinfo 120000,$sha,"$2"
|
||||
}
|
||||
|
||||
# MSYS2 is very forgiving, it will resolve symlinks even if the
|
||||
# symlink type isn't correct. To make this test meaningful, try
|
||||
# them with a native, non-MSYS executable.
|
||||
cat_native () {
|
||||
filename=$(cygpath -w "$1") &&
|
||||
cmd.exe /c "type \"$filename\""
|
||||
}
|
||||
|
||||
test_expect_success 'checkout symlinks with attr' '
|
||||
cache_symlink file1 file-link &&
|
||||
cache_symlink dir dir-link &&
|
||||
|
||||
printf "file-link symlink=file\ndir-link symlink=dir\n" >.gitattributes &&
|
||||
git add .gitattributes &&
|
||||
|
||||
git checkout . &&
|
||||
|
||||
mkdir dir &&
|
||||
echo "contents1" >file1 &&
|
||||
echo "contents2" >dir/file2 &&
|
||||
|
||||
test "$(cat_native file-link)" = "contents1" &&
|
||||
test "$(cat_native dir-link/file2)" = "contents2"
|
||||
'
|
||||
|
||||
test_done
|
||||
@@ -16,7 +16,7 @@ test_cd_to_toplevel () {
|
||||
test_expect_success $3 "$2" '
|
||||
(
|
||||
cd '"'$1'"' &&
|
||||
PATH="$EXEC_PATH:$PATH" &&
|
||||
PATH="$EXEC_PATH$PATH_SEP$PATH" &&
|
||||
. git-sh-setup &&
|
||||
cd_to_toplevel &&
|
||||
[ "$(pwd -P)" = "$TOPLEVEL" ]
|
||||
|
||||
@@ -26,7 +26,7 @@ test_expect_success 'example 1: notes to add an Acked-by line' '
|
||||
'
|
||||
|
||||
test_expect_success 'example 2: binary notes' '
|
||||
cp "$TEST_DIRECTORY"/test-binary-1.png . &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/test-binary-1.png . &&
|
||||
git checkout B &&
|
||||
blob=$(git hash-object -w test-binary-1.png) &&
|
||||
git notes --ref=logo add -C "$blob" &&
|
||||
|
||||
@@ -143,7 +143,7 @@ test_expect_success 'rebase -s funny -Xopt' '
|
||||
git checkout -b test-funny master^ &&
|
||||
test_commit funny &&
|
||||
(
|
||||
PATH=./test-bin:$PATH &&
|
||||
PATH=./test-bin$PATH_SEP$PATH &&
|
||||
git rebase -s funny -Xopt master
|
||||
) &&
|
||||
test -f funny.was.run
|
||||
|
||||
@@ -60,7 +60,7 @@ test_expect_success 'rebase --continue remembers merge strategy and options' '
|
||||
EOF
|
||||
chmod +x test-bin/git-merge-funny &&
|
||||
(
|
||||
PATH=./test-bin:$PATH &&
|
||||
PATH=./test-bin$PATH_SEP$PATH &&
|
||||
test_must_fail git rebase -s funny -Xopt master topic
|
||||
) &&
|
||||
test -f funny.was.run &&
|
||||
@@ -68,7 +68,7 @@ test_expect_success 'rebase --continue remembers merge strategy and options' '
|
||||
echo "Resolved" >F2 &&
|
||||
git add F2 &&
|
||||
(
|
||||
PATH=./test-bin:$PATH &&
|
||||
PATH=./test-bin$PATH_SEP$PATH &&
|
||||
git rebase --continue
|
||||
) &&
|
||||
test -f funny.was.run
|
||||
@@ -92,7 +92,7 @@ test_expect_success 'rebase -i --continue handles merge strategy and options' '
|
||||
EOF
|
||||
chmod +x test-bin/git-merge-funny &&
|
||||
(
|
||||
PATH=./test-bin:$PATH &&
|
||||
PATH=./test-bin$PATH_SEP$PATH &&
|
||||
test_must_fail git rebase -i -s funny -Xopt -Xfoo master topic
|
||||
) &&
|
||||
test -f funny.was.run &&
|
||||
@@ -100,7 +100,7 @@ test_expect_success 'rebase -i --continue handles merge strategy and options' '
|
||||
echo "Resolved" >F2 &&
|
||||
git add F2 &&
|
||||
(
|
||||
PATH=./test-bin:$PATH &&
|
||||
PATH=./test-bin$PATH_SEP$PATH &&
|
||||
git rebase --continue
|
||||
) &&
|
||||
test -f funny.was.run
|
||||
|
||||
@@ -1084,7 +1084,7 @@ test_expect_success 'stash -- <subdir> works with binary files' '
|
||||
git reset &&
|
||||
>subdir/untracked &&
|
||||
>subdir/tracked &&
|
||||
cp "$TEST_DIRECTORY"/test-binary-1.png subdir/tracked-binary &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/test-binary-1.png subdir/tracked-binary &&
|
||||
git add subdir/tracked* &&
|
||||
git stash -- subdir/ &&
|
||||
test_path_is_missing subdir/tracked &&
|
||||
|
||||
@@ -19,7 +19,7 @@ test_expect_success 'prepare repository' '
|
||||
echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&
|
||||
git update-index --add a b c d &&
|
||||
echo git >a &&
|
||||
cat "$TEST_DIRECTORY"/test-binary-1.png >b &&
|
||||
cat "$TEST_DIRECTORY"/diff-lib/test-binary-1.png >b &&
|
||||
echo git >c &&
|
||||
cat b b >d
|
||||
'
|
||||
|
||||
@@ -6,12 +6,12 @@ test_description='rewrite diff'
|
||||
|
||||
test_expect_success setup '
|
||||
|
||||
cat "$TEST_DIRECTORY"/../COPYING >test &&
|
||||
cat "$TEST_DIRECTORY"/diff-lib/COPYING >test &&
|
||||
git add test &&
|
||||
tr \
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \
|
||||
"nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \
|
||||
<"$TEST_DIRECTORY"/../COPYING >test &&
|
||||
<"$TEST_DIRECTORY"/diff-lib/COPYING >test &&
|
||||
echo "to be deleted" >test2 &&
|
||||
blob=$(git hash-object test2) &&
|
||||
blob=$(git rev-parse --short $blob) &&
|
||||
|
||||
@@ -7,21 +7,21 @@ test_description='typechange rename detection'
|
||||
test_expect_success setup '
|
||||
|
||||
rm -f foo bar &&
|
||||
cat "$TEST_DIRECTORY"/../COPYING >foo &&
|
||||
cat "$TEST_DIRECTORY"/diff-lib/COPYING >foo &&
|
||||
test_ln_s_add linklink bar &&
|
||||
git add foo &&
|
||||
git commit -a -m Initial &&
|
||||
git tag one &&
|
||||
|
||||
git rm -f foo bar &&
|
||||
cat "$TEST_DIRECTORY"/../COPYING >bar &&
|
||||
cat "$TEST_DIRECTORY"/diff-lib/COPYING >bar &&
|
||||
test_ln_s_add linklink foo &&
|
||||
git add bar &&
|
||||
git commit -a -m Second &&
|
||||
git tag two &&
|
||||
|
||||
git rm -f foo bar &&
|
||||
cat "$TEST_DIRECTORY"/../COPYING >foo &&
|
||||
cat "$TEST_DIRECTORY"/diff-lib/COPYING >foo &&
|
||||
git add foo &&
|
||||
git commit -a -m Third &&
|
||||
git tag three &&
|
||||
@@ -35,15 +35,15 @@ test_expect_success setup '
|
||||
# This is purely for sanity check
|
||||
|
||||
git rm -f foo bar &&
|
||||
cat "$TEST_DIRECTORY"/../COPYING >foo &&
|
||||
cat "$TEST_DIRECTORY"/../Makefile >bar &&
|
||||
cat "$TEST_DIRECTORY"/diff-lib/COPYING >foo &&
|
||||
cat "$TEST_DIRECTORY"/diff-lib/README >bar &&
|
||||
git add foo bar &&
|
||||
git commit -a -m Fifth &&
|
||||
git tag five &&
|
||||
|
||||
git rm -f foo bar &&
|
||||
cat "$TEST_DIRECTORY"/../Makefile >foo &&
|
||||
cat "$TEST_DIRECTORY"/../COPYING >bar &&
|
||||
cat "$TEST_DIRECTORY"/diff-lib/README >foo &&
|
||||
cat "$TEST_DIRECTORY"/diff-lib/COPYING >bar &&
|
||||
git add foo bar &&
|
||||
git commit -a -m Sixth &&
|
||||
git tag six
|
||||
|
||||
@@ -32,7 +32,7 @@ test_expect_success 'binary changes do not count in lines' '
|
||||
git reset --hard &&
|
||||
echo a >a &&
|
||||
echo c >c &&
|
||||
cat "$TEST_DIRECTORY"/test-binary-1.png >d &&
|
||||
cat "$TEST_DIRECTORY"/diff-lib/test-binary-1.png >d &&
|
||||
cat >expect <<-\EOF &&
|
||||
a | 1 +
|
||||
c | 1 +
|
||||
|
||||
@@ -45,7 +45,7 @@ test_fix () {
|
||||
apply_patch --whitespace=fix || return 1
|
||||
|
||||
# find touched lines
|
||||
$DIFF file target | sed -n -e "s/^> //p" >fixed
|
||||
$DIFF -u file target | sed -n -e "3,\$s/^+//p" >fixed
|
||||
|
||||
# the changed lines are all expected to change
|
||||
fixed_cnt=$(wc -l <fixed)
|
||||
|
||||
@@ -39,33 +39,39 @@ check_zip() {
|
||||
extracted=${dir_with_prefix}a
|
||||
original=a
|
||||
|
||||
test_expect_success UNZIP " extract ZIP archive with EOL conversion" '
|
||||
test_expect_success !BUSYBOX,UNZIP \
|
||||
" extract ZIP archive with EOL conversion" '
|
||||
(mkdir $dir && cd $dir && "$GIT_UNZIP" -a ../$zipfile)
|
||||
'
|
||||
|
||||
test_expect_success UNZIP " validate that text files are converted" "
|
||||
test_expect_success !BUSYBOX,UNZIP \
|
||||
" validate that text files are converted" "
|
||||
test_cmp_bin $extracted/text.cr $extracted/text.crlf &&
|
||||
test_cmp_bin $extracted/text.cr $extracted/text.lf
|
||||
"
|
||||
|
||||
test_expect_success UNZIP " validate that binary files are unchanged" "
|
||||
test_expect_success !BUSYBOX,UNZIP \
|
||||
" validate that binary files are unchanged" "
|
||||
test_cmp_bin $original/binary.cr $extracted/binary.cr &&
|
||||
test_cmp_bin $original/binary.crlf $extracted/binary.crlf &&
|
||||
test_cmp_bin $original/binary.lf $extracted/binary.lf
|
||||
"
|
||||
|
||||
test_expect_success UNZIP " validate that diff files are converted" "
|
||||
test_expect_success !BUSYBOX,UNZIP \
|
||||
" validate that diff files are converted" "
|
||||
test_cmp_bin $extracted/diff.cr $extracted/diff.crlf &&
|
||||
test_cmp_bin $extracted/diff.cr $extracted/diff.lf
|
||||
"
|
||||
|
||||
test_expect_success UNZIP " validate that -diff files are unchanged" "
|
||||
test_expect_success !BUSYBOX,UNZIP \
|
||||
" validate that -diff files are unchanged" "
|
||||
test_cmp_bin $original/nodiff.cr $extracted/nodiff.cr &&
|
||||
test_cmp_bin $original/nodiff.crlf $extracted/nodiff.crlf &&
|
||||
test_cmp_bin $original/nodiff.lf $extracted/nodiff.lf
|
||||
"
|
||||
|
||||
test_expect_success UNZIP " validate that custom diff is unchanged " "
|
||||
test_expect_success !BUSYBOX,UNZIP \
|
||||
" validate that custom diff is unchanged " "
|
||||
test_cmp_bin $original/custom.cr $extracted/custom.cr &&
|
||||
test_cmp_bin $original/custom.crlf $extracted/custom.crlf &&
|
||||
test_cmp_bin $original/custom.lf $extracted/custom.lf
|
||||
@@ -77,7 +83,7 @@ test_expect_success \
|
||||
'mkdir a &&
|
||||
echo simple textfile >a/a &&
|
||||
mkdir a/bin &&
|
||||
cp /bin/sh a/bin &&
|
||||
cp "$TEST_DIRECTORY/diff-lib/test-binary-1.png" a/bin &&
|
||||
printf "text\r" >a/text.cr &&
|
||||
printf "text\r\n" >a/text.crlf &&
|
||||
printf "text\n" >a/text.lf &&
|
||||
|
||||
@@ -25,7 +25,7 @@ test_expect_success 'setup proxy script' '
|
||||
|
||||
write_script proxy <<-\EOF
|
||||
echo >&2 "proxying for $*"
|
||||
cmd=$(./proxy-get-cmd)
|
||||
cmd=$("$PERL_PATH" ./proxy-get-cmd)
|
||||
echo >&2 "Running $cmd"
|
||||
exec $cmd
|
||||
EOF
|
||||
|
||||
@@ -8,6 +8,21 @@ repo_is_hardlinked() {
|
||||
test_line_count = 0 output
|
||||
}
|
||||
|
||||
if test_have_prereq MINGW,BUSYBOX
|
||||
then
|
||||
# BusyBox' `find` does not support `-links`. Besides, BusyBox-w32's
|
||||
# lstat() does not report hard links, just like Git's mingw_lstat()
|
||||
# (from where BusyBox-w32 got its initial implementation).
|
||||
repo_is_hardlinked() {
|
||||
for f in $(find "$1/objects" -type f)
|
||||
do
|
||||
"$SYSTEMROOT"/system32/fsutil.exe \
|
||||
hardlink list $f >links &&
|
||||
test_line_count -gt 1 links || return 1
|
||||
done
|
||||
}
|
||||
fi
|
||||
|
||||
test_expect_success 'preparing origin repository' '
|
||||
: >file && git add . && git commit -m1 &&
|
||||
git clone --bare . a.git &&
|
||||
|
||||
@@ -95,7 +95,7 @@ test_expect_success 'clone -c remote.<remote>.fetch=<refspec> --origin=<name>' '
|
||||
# Tests for the hidden file attribute on windows
|
||||
is_hidden () {
|
||||
# Use the output of `attrib`, ignore the absolute path
|
||||
case "$(attrib "$1")" in *H*?:*) return 0;; esac
|
||||
case "$("$SYSTEMROOT"/system32/attrib "$1")" in *H*?:*) return 0;; esac
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ test_expect_success 'access alternate via absolute path' '
|
||||
'
|
||||
|
||||
test_expect_success 'access multiple alternates' '
|
||||
check_obj "$PWD/one.git/objects:$PWD/two.git/objects" <<-EOF
|
||||
check_obj "$PWD/one.git/objects$PATH_SEP$PWD/two.git/objects" <<-EOF
|
||||
$one blob
|
||||
$two blob
|
||||
EOF
|
||||
@@ -74,7 +74,7 @@ test_expect_success 'access alternate via relative path (subdir)' '
|
||||
quoted='"one.git\057objects"'
|
||||
unquoted='two.git/objects'
|
||||
test_expect_success 'mix of quoted and unquoted alternates' '
|
||||
check_obj "$quoted:$unquoted" <<-EOF
|
||||
check_obj "$quoted$PATH_SEP$unquoted" <<-EOF
|
||||
$one blob
|
||||
$two blob
|
||||
EOF
|
||||
|
||||
@@ -85,7 +85,7 @@ test_expect_success 'set up fake git-daemon' '
|
||||
"$TRASH_DIRECTORY/remote"
|
||||
EOF
|
||||
export TRASH_DIRECTORY &&
|
||||
PATH=$TRASH_DIRECTORY:$PATH
|
||||
PATH=$TRASH_DIRECTORY$PATH_SEP$PATH
|
||||
'
|
||||
|
||||
test_expect_success 'ext command can connect to git daemon (no vhost)' '
|
||||
|
||||
@@ -14,8 +14,23 @@ test_expect_success 'setup repository to clone' '
|
||||
'
|
||||
|
||||
test_proto "host:path" ssh "remote:repo.git"
|
||||
test_proto "ssh://" ssh "ssh://remote$PWD/remote/repo.git"
|
||||
test_proto "git+ssh://" ssh "git+ssh://remote$PWD/remote/repo.git"
|
||||
|
||||
hostdir="$PWD"
|
||||
if test_have_prereq MINGW && test "/${PWD#/}" != "$PWD"
|
||||
then
|
||||
case "$PWD" in
|
||||
[A-Za-z]:/*)
|
||||
hostdir="${PWD#?:}"
|
||||
;;
|
||||
*)
|
||||
skip_all="Unhandled PWD '$PWD'; skipping rest"
|
||||
test_done
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
test_proto "ssh://" ssh "ssh://remote$hostdir/remote/repo.git"
|
||||
test_proto "git+ssh://" ssh "git+ssh://remote$hostdir/remote/repo.git"
|
||||
|
||||
# Don't even bother setting up a "-remote" directory, as ssh would generally
|
||||
# complain about the bogus option rather than completing our request. Our
|
||||
|
||||
@@ -221,7 +221,7 @@ test_expect_success "expected conflict markers" "test_cmp expect out"
|
||||
|
||||
test_expect_success 'binary files cannot be merged' '
|
||||
test_must_fail git merge-file -p \
|
||||
orig.txt "$TEST_DIRECTORY"/test-binary-1.png new1.txt 2> merge.err &&
|
||||
orig.txt "$TEST_DIRECTORY"/diff-lib/test-binary-1.png new1.txt 2> merge.err &&
|
||||
grep "Cannot merge binary files" merge.err
|
||||
'
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ test_description='ask merge-recursive to merge binary files'
|
||||
|
||||
test_expect_success setup '
|
||||
|
||||
cat "$TEST_DIRECTORY"/test-binary-1.png >m &&
|
||||
cat "$TEST_DIRECTORY"/diff-lib/test-binary-1.png >m &&
|
||||
git add m &&
|
||||
git ls-files -s | sed -e "s/ 0 / 1 /" >E1 &&
|
||||
test_tick &&
|
||||
|
||||
@@ -6,7 +6,7 @@ test_description='git mv in subdirs'
|
||||
test_expect_success \
|
||||
'prepare reference tree' \
|
||||
'mkdir path0 path1 &&
|
||||
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/COPYING path0/COPYING &&
|
||||
git add path0/COPYING &&
|
||||
git commit -m add -a'
|
||||
|
||||
@@ -108,7 +108,7 @@ test_expect_success \
|
||||
|
||||
test_expect_success \
|
||||
'adding another file' \
|
||||
'cp "$TEST_DIRECTORY"/../README.md path0/README &&
|
||||
'cp "$TEST_DIRECTORY"/diff-lib/README path0/ &&
|
||||
git add path0/README &&
|
||||
git commit -m add2 -a'
|
||||
|
||||
|
||||
@@ -1345,12 +1345,6 @@ test_expect_success GPG \
|
||||
'test_config user.signingkey BobTheMouse &&
|
||||
test_must_fail git tag -s -m tail tag-gpg-failure'
|
||||
|
||||
# try to produce invalid signature
|
||||
test_expect_success GPG \
|
||||
'git tag -s fails if gpg is misconfigured (bad signature format)' \
|
||||
'test_config gpg.program echo &&
|
||||
test_must_fail git tag -s -m tail tag-gpg-failure'
|
||||
|
||||
# try to sign with bad user.signingkey
|
||||
test_expect_success GPGSM \
|
||||
'git tag -s fails if gpgsm is misconfigured (bad key)' \
|
||||
@@ -1358,13 +1352,6 @@ test_expect_success GPGSM \
|
||||
test_config gpg.format x509 &&
|
||||
test_must_fail git tag -s -m tail tag-gpg-failure'
|
||||
|
||||
# try to produce invalid signature
|
||||
test_expect_success GPGSM \
|
||||
'git tag -s fails if gpgsm is misconfigured (bad signature format)' \
|
||||
'test_config gpg.x509.program echo &&
|
||||
test_config gpg.format x509 &&
|
||||
test_must_fail git tag -s -m tail tag-gpg-failure'
|
||||
|
||||
# try to verify without gpg:
|
||||
|
||||
rm -rf gpghome
|
||||
|
||||
@@ -54,7 +54,7 @@ test_expect_success !MINGW,TTY 'LESS and LV envvars set by git-sh-setup' '
|
||||
sane_unset LESS LV &&
|
||||
PAGER="env >pager-env.out; wc" &&
|
||||
export PAGER &&
|
||||
PATH="$(git --exec-path):$PATH" &&
|
||||
PATH="$(git --exec-path)$PATH_SEP$PATH" &&
|
||||
export PATH &&
|
||||
test_terminal sh -c ". git-sh-setup && git_pager"
|
||||
) &&
|
||||
@@ -388,7 +388,7 @@ test_default_pager() {
|
||||
EOF
|
||||
chmod +x \$less &&
|
||||
(
|
||||
PATH=.:\$PATH &&
|
||||
PATH=.$PATH_SEP\$PATH &&
|
||||
export PATH &&
|
||||
$full_command
|
||||
) &&
|
||||
|
||||
@@ -62,7 +62,7 @@ EOF
|
||||
|
||||
test_expect_success 'rename & unmerged setup' '
|
||||
git rm -f -r . &&
|
||||
cat "$TEST_DIRECTORY/README" >ONE &&
|
||||
cat "$TEST_DIRECTORY/diff-lib/README" >ONE &&
|
||||
git add ONE &&
|
||||
test_tick &&
|
||||
git commit -m "One commit with ONE" &&
|
||||
|
||||
@@ -18,7 +18,12 @@ GIT_FORCE_UNTRACKED_CACHE=true
|
||||
export GIT_FORCE_UNTRACKED_CACHE
|
||||
|
||||
sync_mtime () {
|
||||
find . -type d -ls >/dev/null
|
||||
if test_have_prereq BUSYBOX
|
||||
then
|
||||
find . -type d -print0 | xargs -0r ls -ld >/dev/null
|
||||
else
|
||||
find . -type d -ls >/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
avoid_racy() {
|
||||
|
||||
@@ -9,7 +9,7 @@ test_description='git reset should cull empty subdirs'
|
||||
test_expect_success \
|
||||
'creating initial files' \
|
||||
'mkdir path0 &&
|
||||
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/COPYING path0/COPYING &&
|
||||
git add path0/COPYING &&
|
||||
git commit -m add -a'
|
||||
|
||||
@@ -17,10 +17,10 @@ test_expect_success \
|
||||
'creating second files' \
|
||||
'mkdir path1 &&
|
||||
mkdir path1/path2 &&
|
||||
cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
|
||||
cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
|
||||
cp "$TEST_DIRECTORY"/../COPYING COPYING &&
|
||||
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING-TOO &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/COPYING path1/path2/COPYING &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/COPYING path1/COPYING &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/COPYING COPYING &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/COPYING path0/COPYING-TOO &&
|
||||
git add path1/path2/COPYING &&
|
||||
git add path1/COPYING &&
|
||||
git add COPYING &&
|
||||
|
||||
@@ -23,7 +23,7 @@ test_expect_success 'set up custom strategy' '
|
||||
EOF
|
||||
|
||||
chmod +x git-merge-theirs &&
|
||||
PATH=.:$PATH &&
|
||||
PATH=.$PATH_SEP$PATH &&
|
||||
export PATH
|
||||
'
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ test_expect_success SIMPLEPAGER 'git grep -O' '
|
||||
EOF
|
||||
echo grep.h >expect.notless &&
|
||||
|
||||
PATH=.:$PATH git grep -O GREP_PATTERN >out &&
|
||||
PATH=.$PATH_SEP$PATH git grep -O GREP_PATTERN >out &&
|
||||
{
|
||||
test_cmp expect.less pager-args ||
|
||||
test_cmp expect.notless pager-args
|
||||
|
||||
@@ -1180,8 +1180,8 @@ test_expect_success $PREREQ 'in-reply-to but no threading' '
|
||||
--to=nobody@example.com \
|
||||
--in-reply-to="<in-reply-id@example.com>" \
|
||||
--no-thread \
|
||||
$patches |
|
||||
grep "In-Reply-To: <in-reply-id@example.com>"
|
||||
$patches >out &&
|
||||
grep "In-Reply-To: <in-reply-id@example.com>" out
|
||||
'
|
||||
|
||||
test_expect_success $PREREQ 'no in-reply-to and no threading' '
|
||||
|
||||
@@ -12,7 +12,7 @@ test_expect_success 'setup' '
|
||||
echo distimdistim was called
|
||||
EOF
|
||||
|
||||
PATH="$PATH:." &&
|
||||
PATH="$PATH$PATH_SEP." &&
|
||||
export PATH &&
|
||||
|
||||
git commit --allow-empty -m "a single log entry" &&
|
||||
|
||||
@@ -12,8 +12,14 @@ then
|
||||
test_done
|
||||
fi
|
||||
|
||||
if test_have_prereq MINGW
|
||||
then
|
||||
skip_all='skipping remote-svn tests for lack of POSIX'
|
||||
test_done
|
||||
fi
|
||||
|
||||
# Override svnrdump with our simulator
|
||||
PATH="$HOME:$PATH"
|
||||
PATH="$HOME$PATH_SEP$PATH"
|
||||
export PATH PYTHON_PATH GIT_BUILD_DIR
|
||||
|
||||
write_script "$HOME/svnrdump" <<\EOF
|
||||
|
||||
@@ -43,14 +43,18 @@ test_expect_success 'setup repository and import' '
|
||||
|
||||
test_expect_success 'run log' "
|
||||
git reset --hard origin/a &&
|
||||
git svn log -r2 origin/trunk | grep ^r2 &&
|
||||
git svn log -r4 origin/trunk | grep ^r4 &&
|
||||
git svn log -r3 | grep ^r3
|
||||
git svn log -r2 origin/trunk >out &&
|
||||
grep ^r2 out &&
|
||||
git svn log -r4 origin/trunk >out &&
|
||||
grep ^r4 out &&
|
||||
git svn log -r3 >out &&
|
||||
grep ^r3 out
|
||||
"
|
||||
|
||||
test_expect_success 'run log against a from trunk' "
|
||||
git reset --hard origin/trunk &&
|
||||
git svn log -r3 origin/a | grep ^r3
|
||||
git svn log -r3 origin/a >out &&
|
||||
grep ^r3 out
|
||||
"
|
||||
|
||||
printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4
|
||||
|
||||
@@ -11,6 +11,13 @@ if ! test_have_prereq PERL; then
|
||||
test_done
|
||||
fi
|
||||
|
||||
case "$PWD" in
|
||||
*:*)
|
||||
skip_all='cvs would get confused by the colon in `pwd`; skipping tests'
|
||||
test_done
|
||||
;;
|
||||
esac
|
||||
|
||||
cvs >/dev/null 2>&1
|
||||
if test $? -ne 1
|
||||
then
|
||||
@@ -55,8 +62,8 @@ test_expect_success \
|
||||
'mkdir A B C D E F &&
|
||||
echo hello1 >A/newfile1.txt &&
|
||||
echo hello2 >B/newfile2.txt &&
|
||||
cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png &&
|
||||
cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/test-binary-1.png C/newfile3.png &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/test-binary-1.png D/newfile4.png &&
|
||||
git add A/newfile1.txt &&
|
||||
git add B/newfile2.txt &&
|
||||
git add C/newfile3.png &&
|
||||
@@ -81,8 +88,8 @@ test_expect_success \
|
||||
rm -f B/newfile2.txt &&
|
||||
rm -f C/newfile3.png &&
|
||||
echo Hello5 >E/newfile5.txt &&
|
||||
cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png &&
|
||||
cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/test-binary-2.png D/newfile4.png &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/test-binary-1.png F/newfile6.png &&
|
||||
git add E/newfile5.txt &&
|
||||
git add F/newfile6.png &&
|
||||
git commit -a -m "Test: Remove, add and update" &&
|
||||
@@ -170,7 +177,7 @@ test_expect_success \
|
||||
'mkdir "G g" &&
|
||||
echo ok then >"G g/with spaces.txt" &&
|
||||
git add "G g/with spaces.txt" && \
|
||||
cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \
|
||||
cp "$TEST_DIRECTORY"/diff-lib/test-binary-1.png "G g/with spaces.png" && \
|
||||
git add "G g/with spaces.png" &&
|
||||
git commit -a -m "With spaces" &&
|
||||
id=$(git rev-list --max-count=1 HEAD) &&
|
||||
@@ -182,7 +189,8 @@ test_expect_success \
|
||||
test_expect_success \
|
||||
'Update file with spaces in file name' \
|
||||
'echo Ok then >>"G g/with spaces.txt" &&
|
||||
cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \
|
||||
cat "$TEST_DIRECTORY"/diff-lib/test-binary-1.png \
|
||||
>>"G g/with spaces.png" && \
|
||||
git add "G g/with spaces.png" &&
|
||||
git commit -a -m "Update with spaces" &&
|
||||
id=$(git rev-list --max-count=1 HEAD) &&
|
||||
@@ -207,7 +215,7 @@ test_expect_success !MINGW \
|
||||
'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
|
||||
echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
|
||||
git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
|
||||
cp "$TEST_DIRECTORY"/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
|
||||
cp "$TEST_DIRECTORY"/diff-lib/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
|
||||
git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
|
||||
git commit -a -m "Går det så går det" && \
|
||||
id=$(git rev-list --max-count=1 HEAD) &&
|
||||
|
||||
@@ -94,7 +94,12 @@ test_expect_success 'fast-export --show-original-ids | git fast-import' '
|
||||
test $MUSS = $(git rev-parse --verify refs/tags/muss)
|
||||
'
|
||||
|
||||
test_expect_success 'iso-8859-1' '
|
||||
test_lazy_prereq UTF8_ONLY_ENV '
|
||||
. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
|
||||
! git var GIT_AUTHOR_IDENT | grep "Áéí"
|
||||
'
|
||||
|
||||
test_expect_success !UTF8_ONLY_ENV 'iso-8859-1' '
|
||||
|
||||
git config i18n.commitencoding ISO8859-1 &&
|
||||
# use author and committer name in ISO-8859-1 to match it.
|
||||
@@ -110,6 +115,11 @@ test_expect_success 'iso-8859-1' '
|
||||
grep "Áéí óú" actual)
|
||||
|
||||
'
|
||||
|
||||
# The subsequent tests validate timestamps, and we may just have skipped a tick
|
||||
test_have_prereq !UTF8_ONLY_ENV ||
|
||||
test_tick
|
||||
|
||||
test_expect_success 'import/export-marks' '
|
||||
|
||||
git checkout -b marks master &&
|
||||
@@ -224,7 +234,7 @@ GIT_COMMITTER_NAME='C O Mitter'; export GIT_COMMITTER_NAME
|
||||
|
||||
test_expect_success 'setup copies' '
|
||||
|
||||
git config --unset i18n.commitencoding &&
|
||||
{ git config --unset i18n.commitencoding || :; } &&
|
||||
git checkout -b copy rein &&
|
||||
git mv file file3 &&
|
||||
git commit -m move1 &&
|
||||
|
||||
@@ -198,7 +198,7 @@ test_expect_success 'exit when p4 fails to produce marshaled output' '
|
||||
EOF
|
||||
chmod 755 badp4dir/p4 &&
|
||||
(
|
||||
PATH="$TRASH_DIRECTORY/badp4dir:$PATH" &&
|
||||
PATH="$TRASH_DIRECTORY/badp4dir$PATH_SEP$PATH" &&
|
||||
export PATH &&
|
||||
test_expect_code 1 git p4 clone --dest="$git" //depot >errs 2>&1
|
||||
) &&
|
||||
|
||||
@@ -126,12 +126,7 @@ invalid_variable_name='${foo.bar}'
|
||||
|
||||
actual="$TRASH_DIRECTORY/actual"
|
||||
|
||||
if test_have_prereq MINGW
|
||||
then
|
||||
ROOT="$(pwd -W)"
|
||||
else
|
||||
ROOT="$(pwd)"
|
||||
fi
|
||||
ROOT="$(pwd)"
|
||||
|
||||
test_expect_success 'setup for __git_find_repo_path/__gitdir tests' '
|
||||
mkdir -p subdir/subsubdir &&
|
||||
|
||||
@@ -757,7 +757,7 @@ test_expect_code () {
|
||||
# - not all diff versions understand "-u"
|
||||
|
||||
test_cmp() {
|
||||
$GIT_TEST_CMP "$@"
|
||||
GIT_ALLOC_LIMIT=0 $GIT_TEST_CMP "$@"
|
||||
}
|
||||
|
||||
# Check that the given config key has the expected value.
|
||||
@@ -1042,72 +1042,6 @@ test_skip_or_die () {
|
||||
esac
|
||||
}
|
||||
|
||||
# The following mingw_* functions obey POSIX shell syntax, but are actually
|
||||
# bash scripts, and are meant to be used only with bash on Windows.
|
||||
|
||||
# A test_cmp function that treats LF and CRLF equal and avoids to fork
|
||||
# diff when possible.
|
||||
mingw_test_cmp () {
|
||||
# Read text into shell variables and compare them. If the results
|
||||
# are different, use regular diff to report the difference.
|
||||
local test_cmp_a= test_cmp_b=
|
||||
|
||||
# When text came from stdin (one argument is '-') we must feed it
|
||||
# to diff.
|
||||
local stdin_for_diff=
|
||||
|
||||
# Since it is difficult to detect the difference between an
|
||||
# empty input file and a failure to read the files, we go straight
|
||||
# to diff if one of the inputs is empty.
|
||||
if test -s "$1" && test -s "$2"
|
||||
then
|
||||
# regular case: both files non-empty
|
||||
mingw_read_file_strip_cr_ test_cmp_a <"$1"
|
||||
mingw_read_file_strip_cr_ test_cmp_b <"$2"
|
||||
elif test -s "$1" && test "$2" = -
|
||||
then
|
||||
# read 2nd file from stdin
|
||||
mingw_read_file_strip_cr_ test_cmp_a <"$1"
|
||||
mingw_read_file_strip_cr_ test_cmp_b
|
||||
stdin_for_diff='<<<"$test_cmp_b"'
|
||||
elif test "$1" = - && test -s "$2"
|
||||
then
|
||||
# read 1st file from stdin
|
||||
mingw_read_file_strip_cr_ test_cmp_a
|
||||
mingw_read_file_strip_cr_ test_cmp_b <"$2"
|
||||
stdin_for_diff='<<<"$test_cmp_a"'
|
||||
fi
|
||||
test -n "$test_cmp_a" &&
|
||||
test -n "$test_cmp_b" &&
|
||||
test "$test_cmp_a" = "$test_cmp_b" ||
|
||||
eval "diff -u \"\$@\" $stdin_for_diff"
|
||||
}
|
||||
|
||||
# $1 is the name of the shell variable to fill in
|
||||
mingw_read_file_strip_cr_ () {
|
||||
# Read line-wise using LF as the line separator
|
||||
# and use IFS to strip CR.
|
||||
local line
|
||||
while :
|
||||
do
|
||||
if IFS=$'\r' read -r -d $'\n' line
|
||||
then
|
||||
# good
|
||||
line=$line$'\n'
|
||||
else
|
||||
# we get here at EOF, but also if the last line
|
||||
# was not terminated by LF; in the latter case,
|
||||
# some text was read
|
||||
if test -z "$line"
|
||||
then
|
||||
# EOF, really
|
||||
break
|
||||
fi
|
||||
fi
|
||||
eval "$1=\$$1\$line"
|
||||
done
|
||||
}
|
||||
|
||||
# Like "env FOO=BAR some-program", but run inside a subshell, which means
|
||||
# it also works for shell functions (though those functions cannot impact
|
||||
# the environment outside of the test_env invocation).
|
||||
|
||||
@@ -15,6 +15,15 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/ .
|
||||
|
||||
# On Unix/Linux, the path separator is the colon, on other systems it
|
||||
# may be different, though. On Windows, for example, it is a semicolon.
|
||||
# If the PATH variable contains semicolons, it is pretty safe to assume
|
||||
# that the path separator is a semicolon.
|
||||
case "$PATH" in
|
||||
*\;*) PATH_SEP=\; ;;
|
||||
*) PATH_SEP=: ;;
|
||||
esac
|
||||
|
||||
# Test the binaries we have just built. The tests are kept in
|
||||
# t/ subdirectory and are run in 'trash directory' subdirectory.
|
||||
if test -z "$TEST_DIRECTORY"
|
||||
@@ -368,23 +377,18 @@ fi
|
||||
# /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
|
||||
# deriving from the command substitution clustered with the other
|
||||
# ones.
|
||||
unset VISUAL EMAIL LANGUAGE COLUMNS $("$PERL_PATH" -e '
|
||||
my @env = keys %ENV;
|
||||
my $ok = join("|", qw(
|
||||
TRACE
|
||||
DEBUG
|
||||
TEST
|
||||
.*_TEST
|
||||
PROVE
|
||||
VALGRIND
|
||||
UNZIP
|
||||
PERF_
|
||||
CURL_VERBOSE
|
||||
TRACE_CURL
|
||||
));
|
||||
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
|
||||
print join("\n", @vars);
|
||||
')
|
||||
unset VISUAL EMAIL LANGUAGE COLUMNS $(env | sed -n \
|
||||
-e '/^GIT_TRACE/d' \
|
||||
-e '/^GIT_DEBUG/d' \
|
||||
-e '/^GIT_TEST/d' \
|
||||
-e '/^GIT_.*_TEST/d' \
|
||||
-e '/^GIT_PROVE/d' \
|
||||
-e '/^GIT_VALGRIND/d' \
|
||||
-e '/^GIT_UNZIP/d' \
|
||||
-e '/^GIT_PERF_/d' \
|
||||
-e '/^GIT_CURL_VERBOSE/d' \
|
||||
-e '/^GIT_TRACE_CURL/d' \
|
||||
-e 's/^\(GIT_[^=]*\)=.*/\1/p')
|
||||
unset XDG_CACHE_HOME
|
||||
unset XDG_CONFIG_HOME
|
||||
unset GITPERLLIB
|
||||
@@ -1215,7 +1219,7 @@ then
|
||||
done
|
||||
done
|
||||
IFS=$OLDIFS
|
||||
PATH=$GIT_VALGRIND/bin:$PATH
|
||||
PATH=$GIT_VALGRIND/bin$PATH_SEP$PATH
|
||||
GIT_EXEC_PATH=$GIT_VALGRIND/bin
|
||||
export GIT_VALGRIND
|
||||
GIT_VALGRIND_MODE="$valgrind"
|
||||
@@ -1227,7 +1231,7 @@ elif test -n "$GIT_TEST_INSTALLED"
|
||||
then
|
||||
GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
|
||||
error "Cannot run git from $GIT_TEST_INSTALLED."
|
||||
PATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR/t/helper:$PATH
|
||||
PATH=$GIT_TEST_INSTALLED$PATH_SEP$GIT_BUILD_DIR/t/helper$PATH_SEP$PATH
|
||||
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
|
||||
else # normal case, use ../bin-wrappers only unless $with_dashes:
|
||||
if test -n "$no_bin_wrappers"
|
||||
@@ -1243,12 +1247,12 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
|
||||
fi
|
||||
with_dashes=t
|
||||
fi
|
||||
PATH="$git_bin_dir:$PATH"
|
||||
PATH="$git_bin_dir$PATH_SEP$PATH"
|
||||
fi
|
||||
GIT_EXEC_PATH=$GIT_BUILD_DIR
|
||||
if test -n "$with_dashes"
|
||||
then
|
||||
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
|
||||
PATH="$GIT_BUILD_DIR$PATH_SEP$GIT_BUILD_DIR/t/helper$PATH_SEP$PATH"
|
||||
fi
|
||||
fi
|
||||
GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
|
||||
@@ -1348,17 +1352,30 @@ yes () {
|
||||
uname_s=$(uname -s)
|
||||
case $uname_s in
|
||||
*MINGW*)
|
||||
# Windows has its own (incompatible) sort and find
|
||||
sort () {
|
||||
/usr/bin/sort "$@"
|
||||
}
|
||||
find () {
|
||||
/usr/bin/find "$@"
|
||||
}
|
||||
# git sees Windows-style pwd
|
||||
pwd () {
|
||||
builtin pwd -W
|
||||
}
|
||||
if test -x /usr/bin/sort
|
||||
then
|
||||
# Windows has its own (incompatible) sort; override
|
||||
sort () {
|
||||
/usr/bin/sort "$@"
|
||||
}
|
||||
fi
|
||||
if test -x /usr/bin/find
|
||||
then
|
||||
# Windows has its own (incompatible) find; override
|
||||
find () {
|
||||
/usr/bin/find "$@"
|
||||
}
|
||||
fi
|
||||
# On Windows, Git wants Windows paths. But /usr/bin/pwd spits out
|
||||
# Unix-style paths. At least in Bash, we have a builtin pwd that
|
||||
# understands the -W option to force "mixed" paths, i.e. with drive
|
||||
# prefix but still with forward slashes. Let's use that, if available.
|
||||
if type builtin >/dev/null 2>&1
|
||||
then
|
||||
pwd () {
|
||||
builtin pwd -W
|
||||
}
|
||||
fi
|
||||
# no POSIX permissions
|
||||
# backslashes in pathspec are converted to '/'
|
||||
# exec does not inherit the PID
|
||||
@@ -1366,7 +1383,13 @@ case $uname_s in
|
||||
test_set_prereq NATIVE_CRLF
|
||||
test_set_prereq SED_STRIPS_CR
|
||||
test_set_prereq GREP_STRIPS_CR
|
||||
GIT_TEST_CMP=mingw_test_cmp
|
||||
GIT_TEST_CMP="test-tool cmp"
|
||||
if ! type iconv >/dev/null 2>&1
|
||||
then
|
||||
iconv () {
|
||||
test-tool iconv "$@"
|
||||
}
|
||||
fi
|
||||
;;
|
||||
*CYGWIN*)
|
||||
test_set_prereq POSIXPERM
|
||||
@@ -1517,6 +1540,10 @@ test_lazy_prereq UNZIP '
|
||||
test $? -ne 127
|
||||
'
|
||||
|
||||
test_lazy_prereq BUSYBOX '
|
||||
case "$($SHELL --help 2>&1)" in *BusyBox*) true;; *) false;; esac
|
||||
'
|
||||
|
||||
run_with_limited_cmdline () {
|
||||
(ulimit -s 128 && "$@")
|
||||
}
|
||||
|
||||
@@ -119,10 +119,10 @@ static struct child_process *get_helper(struct transport *transport)
|
||||
helper->in = -1;
|
||||
helper->out = -1;
|
||||
helper->err = 0;
|
||||
argv_array_pushf(&helper->args, "git-remote-%s", data->name);
|
||||
argv_array_pushf(&helper->args, "remote-%s", data->name);
|
||||
argv_array_push(&helper->args, transport->remote->name);
|
||||
argv_array_push(&helper->args, remove_ext_force(transport->url));
|
||||
helper->git_cmd = 0;
|
||||
helper->git_cmd = 1;
|
||||
helper->silent_exec_failure = 1;
|
||||
|
||||
if (have_git_dir())
|
||||
|
||||
Reference in New Issue
Block a user