Commit Graph

13264 Commits

Author SHA1 Message Date
Steffen Prohaska
b3c41bf395 Merge commit 'mingw/master' into work/towards-mingw
Conflicts:

	compat/mingw.c
	exec_cmd.c
	git-compat-util.h
	run-command.c
	spawn-pipe.c
2007-11-21 21:54:43 +01:00
Steffen Prohaska
329bdf025b Fix ntohl() related warnings about printf formatting
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>
2007-11-21 20:31:15 +01:00
Steffen Prohaska
43664aa169 Revert ntohl()/printf format to Junio's git
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>
2007-11-21 20:31:12 +01:00
Steffen Prohaska
31023be999 compat/pread.c: Add foward decl to fix warning
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>
2007-11-21 20:31:10 +01:00
Steffen Prohaska
d3dcd10775 git.c: Take '--bare' handling from mingw master
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>
2007-11-21 20:31:08 +01:00
Steffen Prohaska
565861de3b spawn-pipe.c: Remove unnecessary cast
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-21 20:05:49 +01:00
Steffen Prohaska
ad941f2336 exec_cmd.c: Add cast that is needed for Posix execvp
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-21 20:05:47 +01:00
Steffen Prohaska
af18e7d9d3 Fix prototypes for mingw_execve and mingw_execvp to match Posix
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>
2007-11-21 20:05:43 +01:00
Steffen Prohaska
66417d164e Add ifdef __MINGW32__ to avoid warning about unused "progress"
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-21 20:05:41 +01:00
Johannes Sixt
726fb5ed5d fetch-pack: Enable sideband communication. 2007-11-21 13:15:57 +01:00
Johannes Sixt
6447cf7fb2 Merge branch 'js/mingw-fallouts' 2007-11-21 13:12:49 +01:00
Johannes Sixt
a6ed49cf52 Fix error messages in timer implementation.
There were some references to the progress indicator, where this
implementation originally appeared.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
2007-11-21 09:28:59 +01:00
Steffen Prohaska
c2849fc4b1 Fix ntohl() related warnings about printf formatting
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>
2007-11-21 07:58:10 +01:00
Steffen Prohaska
5a09d6a3ac compat/pread.c: Add foward decl to fix warning
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>
2007-11-21 07:46:20 +01:00
Dmitry Kakurin
ad0b9993f9 compat/regex.c: Fix warnings
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>
2007-11-21 07:34:44 +01:00
Johannes Sixt
40c18e8ee6 upload-pack: Remove MinGW specific code.
Now that a poll() implementation is available, upload-pack also offers
side-band communication.
2007-11-19 13:26:12 +01:00
Johannes Sixt
f801325ed5 Implement a rudimentary poll() emulation for Windows.
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>
2007-11-19 12:36:32 +01:00
Steffen Prohaska
a8d8425ec6 Fix prototypes for mingw_execve and mingw_execvp to match Posix
This changes the prototypes to match
http://www.opengroup.org/onlinepubs/7990989775/xsh/exec.html

[js: updated message]

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
2007-11-18 20:40:35 +01:00
Steffen Prohaska
f593be0480 test-chmtime.c: Cast HANDLE to fix warning
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
2007-11-18 20:36:21 +01:00
Steffen Prohaska
8ddaf895a8 compat/mingw.c: Add cast of handle to fix warning
[js: whitespace removed]

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
2007-11-18 20:35:57 +01:00
Johannes Sixt
d51703c665 Remove now unused spawn-pipe.c with spawnvpe_pipe() function. 2007-11-18 20:33:36 +01:00
Johannes Sixt
855cdbbc3b Remove now unused spawnv_git_cmd(). 2007-11-18 20:30:15 +01:00
Johannes Sixt
3393222e48 Reimplement start_command() to work just like the old spawnvpe_pipe().
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.
2007-11-18 20:25:03 +01:00
Johannes Sixt
f8fd915d0c Move environment functions from spawn-pipe.c to compat/mingw.c
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".
2007-11-18 20:22:04 +01:00
Steffen Prohaska
32dead9686 Use getpagesize() from git-compat-util.h
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-18 12:10:21 +01:00
Steffen Prohaska
5e23af17e4 Remove unnecessary decl of sync()
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-18 12:10:08 +01:00
Steffen Prohaska
51355b1ede remove git_install_prefix()
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>
2007-11-18 12:09:52 +01:00
Steffen Prohaska
e9d8b9207e help: search html documentation relativ to git_exec_dir()
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>
2007-11-18 12:09:42 +01:00
Steffen Prohaska
0699304102 Use relative paths to make installation relocatable
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:
4e8904080d
0fbe22da39.
636116b8a7.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-18 12:09:33 +01:00
Johannes Sixt
1f759eeede fetch-pack: Prepare for a side-band demultiplexer in a thread.
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>
2007-11-17 20:27:29 -08:00
Johannes Sixt
3deda75919 upload-pack: Do not announce sideband support when it is not supported
On Windows we currently don't support sideband communicaton. The protocol
implementation is already disabled, but it was still announced in the
server capabilities.
2007-11-17 22:42:52 +01:00
Steffen Prohaska
fcdd78c3c3 Merge commit 'mingw/master' into work/merge-mingw-master
Conflicts:

	git-compat-util.h
	help.c
	pager.c

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-17 12:17:45 +01:00
Johannes Sixt
7828980b8c Revert "sum.exe is available from GNUWin32 (CoreUtils)."
This reverts commit efe7309073.
This "sum.exe" knows it better and writes CRLF line endings. Hmpf.
2007-11-17 00:01:59 +01:00
Johannes Sixt
2d12ef8d57 Merge branch 'js/mingw-fallouts' 2007-11-16 23:14:51 +01:00
Johannes Sixt
3dffb74b2c Use start_command() and finish_command() to run the pager.
This gets rid of a call to spawnvpe_pipe() (and Windows-specific cwait()).
2007-11-16 22:54:27 +01:00
Johannes Sixt
ff1c27fb4e Revert "Protect {tree} from being expanded by the shell."
This reverts commit bff909b882.
git-tag is now a builtin and does not need the extra escaping anymore.
2007-11-16 08:59:41 +01:00
Johannes Sixt
157737a3d9 stat.exe is available from GNUWin32 (CoreUtils). 2007-11-16 08:59:39 +01:00
Johannes Sixt
efe7309073 sum.exe is available from GNUWin32 (CoreUtils). 2007-11-16 08:59:37 +01:00
Johannes Sixt
a8cf9a4ac1 Remove unnecessary dd function.
The test now uses test-genrandom instead of dd if=/dev/random.
2007-11-16 08:59:29 +01:00
Steffen Prohaska
16df3f7e4c Merge commit 'mingw/master' into work/merge-mingw-master
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>
2007-11-16 07:33:14 +01:00
Nicolas Pitre
5f9ffff308 rehabilitate some t5302 tests on 32-bit off_t machines
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>
2007-11-15 21:18:07 -08:00
Johannes Sixt
e8586bac15 Revert "Work around missing EISDIR errno values."
This reverts the remaining part of commit
ff61d9fc99.
2007-11-15 22:27:14 +01:00
Johannes Sixt
fab21181f4 Implement a wrapper of the open() function.
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>
2007-11-15 22:27:09 +01:00
Johannes Sixt
a5ac001acc upload-pack: rely on finish_command() and finish_async()
We don't need explicitly handle the processes anymore.
2007-11-15 21:30:08 +01:00
Johannes Sixt
6ee8b07d4c Merge branch 'master' of git://repo.or.cz/alt-git 2007-11-15 21:03:07 +01:00
Johannes Sixt
7f0e39faa2 Allow ETC_GITCONFIG to be a relative path.
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>
2007-11-14 15:18:39 -08:00
Johannes Sixt
506b17b136 Introduce git_etc_gitconfig() that encapsulates access of ETC_GITCONFIG.
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>
2007-11-14 15:18:39 -08:00
Johannes Sixt
a47d181380 Allow a relative builtin template directory.
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>
2007-11-14 15:18:39 -08:00
Johannes Schindelin
4723ee992c Close files opened by lock_file() before unlinking.
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>
2007-11-14 15:18:39 -08:00
Johannes Sixt
2488df84a2 builtin run_command: do not exit with -1.
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>
2007-11-14 15:18:39 -08:00