On Windows, ntohl() returns unsinged long. On Unix it returns
uint32_t. This makes choosing a suitable printf format string
hard.
This commit introduces a mingw specific helper function
git_ntohl() that casts to unsigned int before returning. This
makes gcc's printf format check happy. It should be safe because
we expect ntohl to use 32-bit numbers.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
This commits reverts printf format strings to the
original version from Juion's git. This is a
preparation for the mingw specific fix that follows
in the next commit.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
read_in_full()'s is used in compat/pread.c. read_in_full() is
declared in cache.h. But we can't include cache.h because too
many macros are defined there. Using read_in_full() without
including cache.h is dangerous because we wouldn't recognize if
its prototyp changed. gcc issues a warning about that.
This commit adds a forward decl to git-compat-util.h.
git-compat-util.h is included by compat/pread.c _and_ cache.h.
Hence, changes in cache.h would be detected.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Merge commit 53009e47c2
introduced an if() statement that is not present in
mingw's master.
This commit changes the code to match mingw's master.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
This changes the prototypes to match
http://www.opengroup.org/onlinepubs/7990989775/xsh/exec.html
Note, spawnvpe uses a different type for argv and envp
than execve. So at some point we need to cast. This
commit shifts the cast into the compat functions. From
the outside, execve and execvp match Posix.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
There were some references to the progress indicator, where this
implementation originally appeared.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
On Windows, ntohl() returns unsinged long. On Unix it returns
uint32_t. This makes choosing a suitable printf format string
hard.
This commit introduces a mingw specific helper function
git_ntohl() that casts to unsigned int before returning. This
makes gcc's printf format check happy. It should be safe because
we expect ntohl to use 32-bit numbers.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
read_in_full()'s is used in compat/pread.c. read_in_full() is
declared in cache.h. But we can't include cache.h because too
many macros are defined there. Using read_in_full() without
including cache.h is dangerous because we wouldn't recognize if
its prototyp changed. gcc issues a warning about that.
This commit adds a forward decl to git-compat-util.h.
git-compat-util.h is included by compat/pread.c _and_ cache.h.
Hence, changes in cache.h would be detected.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
In general, we don't add unnecessary braces. But in this case
gcc warns about them. So this commit adds a few braces.
The commit suppresses warnings about unitialized variables
by initializing them to NULL.
The change of bcmp_translate()'s parameter declaration is needed
to avoid warnings about "discards qualifiers from pointer target
type".
[sp: split original commit; more detailed commit message. ]
Signed-off-by: Dmitry Kakurin <Dmitry.Kakurin@gmail.com>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
This emulation of poll() is by far not general. It assumes that the
fds that are to be waited for are connected to pipes. The pipes are
polled in a loop until data becomes available in at least one of them.
If only a single fd is waited for, the implementation actually does
not wait at all, but assumes that a subsequent read() will block.
In order to not burn CPU time, it is yielded to other processes before
the next round in the poll loop using Sleep(0). Note that any sleep
timeout greater than zero will reduce the efficiency by a magnitude.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
The idea is to duplicate the handles that we want to pass to the child
to stdin, stdout, or stderr after making a backup duplicate, then spawn
the child program, then duplicate the backups back in place.
We want to get rid of spawn-pipe.*, but these functions will be needed.
On the way, the function signature was changed to avoid warnings about
incompatible pointer types when the argument is the global variable
"environ".
git_install_prefix() is no longer needed. Relocatable
paths are searched relative to git_exec_dir().
This commit removes git_install_prefix().
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Global gitconfig and templates are searched relativ
to git_exec_dir() to make the installation relocatable.
This commit changes help to do the same for finding
the html documentation.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
mingw uses relative paths for template_dir and ETC_GITCONFIG
to make an installation relocatable. Relative paths will
be expanded relative to git_exec_dir(). This mechanism is
now included in official git.git.
We used a different mechanism to create a relocatable
installation. We used to prefix absolute Unix paths with
the installation prefix, derived from the path of git.exe.
This commit reverts our implementation to match mingw.
Part of the change are reverts of the following commits,
which are no longer needed:
4e8904080d0fbe22da39.
636116b8a7.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
get_pack() receives a pair of file descriptors that communicate with
upload-pack at the remote end. In order to support the case where the
side-band demultiplexer runs in a thread, and, hence, in the same process
as the main routine, we must not close the readable file descriptor early.
The handling of the readable fd is changed in the case where upload-pack
supports side-band communication: The old code closed the fd after it was
inherited to the side-band demultiplexer process. Now we do not close it.
The caller (do_fetch_pack) will close it later anyway. The demultiplexer
is the only reader, it does not matter that the fd remains open in the
main process as well as in unpack-objects/index-pack, which inherits it.
The writable fd is not needed in get_pack(), hence, the old code closed
the fd. For symmetry with the readable fd, we now do not close it; the
caller (do_fetch_pack) will close it later anyway. Therefore, the new
behavior is that the channel now remains open during the entire
conversation, but this has no ill effects because upload-pack does not read
from it once it has begun to send the pack data. For the same reason it
does not matter that the writable fd is now inherited to the demultiplexer
and unpack-objects/index-pack processes.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
On Windows we currently don't support sideband communicaton. The protocol
implementation is already disabled, but it was still announced in the
server capabilities.
Remove getpagesize() from sha1_file.c because is it now
included in git-compat-util.h.
Conflicts:
Makefile
compat/mingw.c
git-compat-util.h
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Commit 8ed2fca458 was a bit draconian in
skipping certain tests which should be perfectly valid even on platform
with a 32-bit off_t.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The wrapper does two things:
- Requests to open /dev/null are redirected to open the nul pseudo file.
- A request to open a file that currently exists as a directory, then
Windows's open fails with EACCES; this is changed to EISDIR.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
If ETC_GITCONFIG is not an absolute path, interpret it relative to
--exec-dir. This makes the installed binaries relocatable because the
prefix is not compiled-in.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In a subsequent patch the path to the system-wide config file will be
computed. This is a preparation for that change. It turns all accesses
of ETC_GITCONFIG into function calls. There is no change in behavior.
As a consequence, config.c is the only file that needs the definition of
ETC_GITCONFIG. Hence, -DETC_GITCONFIG is removed from the CFLAGS and a
special build rule for config.c is introduced. As a side-effect, changing
the defintion of ETC_GITCONFIG (e.g. in config.mak) does not trigger a
complete rebuild anymore.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In order to make git relocatable (i.e. not have the prefix compiled-in)
the template directory must depend on the location where this git instance
is found, which is GIT_EXEC_DIR.
The exec path is prepended only if the compiled-in default template
directory is to be used and that is relative. Any relative directories
that are specified via environment variable or the --exec-dir switch are
taken as is.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This is needed on Windows since open files cannot be unlinked.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
There are shells that do not correctly detect an exit code of -1 as a
failure. We simply truncate the status code to the lower 8 bits.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>