Commit Graph

8274 Commits

Author SHA1 Message Date
Johannes Sixt
daabe66f18 MinGW: Change the name of hook scripts to make them not executable by default.
Since on Windows there is no 'executable' bit whose absence would deny
execution of a script, we must change the hook scripts' names entirely
to inhibit that they can be invoked by the tools.
2007-01-25 09:17:06 +01:00
Johannes Sixt
10c1047e09 Fix path_lookup() when the program to invoke contains a slash.
In this case, no path lookup actually takes place, and the returned
program name is equal to the passed in program name. But this code
path contained a thinko that crashed.
2007-01-24 18:48:59 +01:00
Johannes Sixt
2033ba137a Use spawn*_pipe() instead of fork()/exec() in send-pack and receive-pack. 2007-01-24 17:06:21 +01:00
Johannes Sixt
fbb1c508a2 Merge with for-junio. 2007-01-24 16:04:11 +01:00
Johannes Sixt
46580d2192 Add a missing fork() error check. 2007-01-24 16:03:42 +01:00
Johannes Sixt
8c5c2ae8fc Update the status part of README.MinGW.
pull, fetch, clone work to a large extent. Hurray!
2007-01-24 13:13:14 +01:00
Johannes Sixt
c0de283360 Merge with for-junio 2007-01-24 10:46:33 +01:00
Johannes Sixt
18bf4a4bea Cpio emulator: do not copy files repeatedly in pass-through mode.
Files were stored each time when they were mentioned in the file list
as well as for each of its directories and parent directories.
Now we filter out directory names because they are implied for the files
that they contain, but we do list empty directories.

The only case where this is relevant is the pass-through mode that
git clone of a local directory uses.
2007-01-24 10:46:24 +01:00
Johannes Sixt
4feaf032d3 Do not complain if no committer identifier can be written to the reflog.
git clone leaves a half-baked clone without the HEAD ref and no working
tree, but with the full repository, if it cannot find the committer
information in the GECOS field. For a first-time user this may be
puzzling since git clone may be the very first git command to be tried.

The reflog is entirely local information, and the warning about the
missing information is printed anyway, so there is a hint for the user
how to fill it in.
2007-01-24 09:37:48 +01:00
Johannes Sixt
28b06b3aab Simplify the cpio look-alike.
We don't need to write the file list into a temporary file, because
GNU tar can take --files-from stdin in --create mode. Furthermore,
it understands --null, so that we don't need to translate the zero byte
termination to newlines (which incorrectly had been translated to space).
2007-01-24 09:08:11 +01:00
Johannes Sixt
1a39364676 Merge with js/unlink. 2007-01-23 14:45:35 +01:00
Johannes Sixt
5835281874 Clean up another instance of unlink that was explicitly chmod(, 0666)ed. 2007-01-23 14:45:09 +01:00
Johannes Sixt
45c0d8773d Remove the unused strptime() stub.
strptime() is only used in convert-objects.c, but we do not build that one
(for reasons I do not recall anymore). That tool should be unnecessary
anyway.
2007-01-23 14:19:48 +01:00
Johannes Schindelin
e40c594146 mingw: always chmod(, 0666) before unlink()
On Windows, a read-only file cannot be deleted. To make sure that
deletion does not fail because of this, always call chmod() before
unlink().

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
2007-01-23 13:39:09 +01:00
Johannes Sixt
5bc08ee66f Strip \r from the input.
Sometimes CRLF ends up in FETCH_HEAD. As a consequence, the fetch source
'.' is not recognized as a special case.
2007-01-23 13:20:18 +01:00
Johannes Sixt
6397c3119e Expect absolute paths with a drive letter.
This allows the alternates database to refer to other object databases
via a DOS-like path with a drive letter.

Furthermore, update-ref sometimes operates on absolute paths.
2007-01-23 11:11:00 +01:00
Johannes Sixt
d576539c92 Do not skip the initialization of the date string.
Due to some rebasing in the past, new functions that have been introduced
upstream moved into the MinGW portion of the #ifdefs just by coincidend,
but the initialization of the date string remained in the original spot.
The consequence was that all commits that did not use GIT_*_DATE were
created with an empty date part.

This removes the second instance of setup_ident(), which was lacking
the initialization.
2007-01-22 17:06:51 +01:00
Johannes Sixt
562cd8385d In the host:/path notation require 'host' to be at least 2 chars long.
This is necessary to distinguish the notation from the DOS-style
C:/path notation with a drive letter.
2007-01-22 14:19:23 +01:00
Johannes Sixt
306e27d8ee Recommend msysDTK for perl and ssh. 2007-01-22 14:18:14 +01:00
Johannes Sixt
cedb5fd680 Work around CF-LF mismatches introduced by non-MinGW tools. 2007-01-19 16:36:31 +01:00
Johannes Sixt
32713b4612 Work around missing tools on MinGW.
egrep cannot be called from the Windows command line.
dd and sum are not available.
2007-01-19 16:36:31 +01:00
Johannes Sixt
f603a1c562 Use the git wrapper to invoke git commit. 2007-01-19 16:36:31 +01:00
Johannes Sixt
6e5bd6187c Even more tests to skip due to missing symbolic link support. 2007-01-19 16:36:31 +01:00
Johannes Schindelin
8e128cd8c1 fix more tests for lacking symlinks 2007-01-19 16:36:31 +01:00
Johannes Schindelin
3e70ecba72 prepare more tests for lacking symlinks 2007-01-19 16:36:31 +01:00
Johannes Schindelin
cb0ad0c0af fix t0000 for absence of symlinks 2007-01-19 16:36:31 +01:00
Johannes Sixt
b61aae484e Add a README.MinGW with instructions. 2007-01-19 16:36:08 +01:00
Johannes Sixt
2d6dacec88 Make upload-pack.c work under MinGW.
The forked rev-list process is turned into a thread. This should be OK
since the rest of upload-pack does not access the revision machinery.

In order to avoid the poll() call that waits for two file descriptors,
it was necessary to remove sideband support. Then only one file descriptor
needs to be monitored, which can be done in a simple while loop.
2007-01-19 16:36:03 +01:00
Johannes Sixt
c84f02153b Add a spawnv_git_cmd() function and use it in fetch-pack.c.
This function is intended to be used in place of exec[vl]_git_cmd() that
follows a fork.  It constructs the (at most) 3 paths that execv_git_cmd()
searches manually for the git command and hands them over to
spawnvppe_pipe().

The use case in get_pack() is one of the simplest possible.
2007-01-19 16:35:55 +01:00
Johannes Sixt
c823cea00e Implement sleep(). 2007-01-19 16:35:40 +01:00
Johannes Sixt
16ea9c7aa3 Make sure that the pager terminates before the process that feeds it.
Since the pager was spawned as child process, it does not notice when
the parent (which feeds its stdin) terminates. If the pager is 'less'
it so looses control over the terminal and cannot be controled by
the user anymore. For this reason, we register a function atexit()
that explicitly waits for the pager to terminate.
2007-01-19 16:35:32 +01:00
Johannes Sixt
85e94b981e Do not leak pipe file handles into the child processes.
Windows's _pipe() by default allocates inheritable pipes. However,
when a spawn happens, we do not have a possiblility to close the unused
pipe ends in the child process. This is a problem.

Consider the following situation: The child process only reads from the
pipe and the parent process uses only the writable end; the parent even
closes the writable end. As it happens, the child at this time usually
still waits for input in a read(). But since the child has inherited
an open writable end, it does not get EOF and hangs ad infinitum.

For this reason, pipe handles must not be inheritable. At the first
glance, this is curious, since after all it is the purpose of pipes to be
inherited by child processes.  However, in all cases where this
inheritance is needed for a file descriptor, it is dup2()'d to stdin or
stdout anyway, and, lo and behold, Windows's dup2() creates inheritable
duplicates.
2007-01-19 16:35:16 +01:00
Johannes Sixt
ec1fcbb0a9 Make the pager work. 2007-01-19 16:35:11 +01:00
Johannes Sixt
5f38ff014e Split PATH into parts in advance, and pass the result to the new spawnvppe_pipe. 2007-01-19 16:34:59 +01:00
Johannes Sixt
23960ed3c3 Enable the spawn workhorse function to spawn shell scripts.
For this purpose the path lookup is done manually, and the found file
is inspected for the interpreter. If one is found, the script is spawned
under the interpreter; otherwise, the program is spawned normally.
2007-01-19 16:32:23 +01:00
Johannes Sixt
09653a29cf Move script detection into a helper function that returns the interpreter.
This will be needed later in the spawn helper functions, too,
where we want to start a shell or perl script from an exe.
2007-01-19 16:32:23 +01:00
Johannes Sixt
4ba0bd54b3 rename() fails on Windows if the destination exists. 2007-01-19 16:32:23 +01:00
Johannes Sixt
2bd27c7c97 Report failure when a process cannot be spawned (MinGW only). 2007-01-19 16:32:23 +01:00
Johannes Sixt
e7a70c5ddf Windows does not have the close-on-exec flag. 2007-01-19 16:32:23 +01:00
Johannes Sixt
8f9e40a396 Use the spawn workhorse instead of a fork()/exec() pair. 2007-01-19 16:32:23 +01:00
Johannes Sixt
0400c502c3 Factor fork()/exec() work into a spawn() like function.
Windows does not have fork(), but something called spawn() that is roughly
equivalent to a fork()/exec() pair, factor out the Unix style code into
a function that does it more similarly to spawn(). Now the Windows style
spawn() can more easily be employed to achieve the same that the Unix style
code does.
2007-01-19 16:32:23 +01:00
Johannes Sixt
aa0dba9443 Add a cpio emulation script based on GNU tar. 2007-01-19 16:32:23 +01:00
Johannes Sixt
4b5821b21b Implement a subset of waitpid() in terms of Windows's _cwait(). 2007-01-19 16:32:23 +01:00
Johannes Sixt
ee4a2fe93d MinGW cannot support sideband communication. 2007-01-19 16:31:58 +01:00
Johannes Sixt
0bb0ca2158 Windows cannot unlink() a file that is read-only. 2007-01-19 16:27:30 +01:00
Johannes Sixt
48f967a161 Make a pipe() wrapper that uses Windows's _pipe(). 2007-01-19 16:27:30 +01:00
Johannes Sixt
ff61d9fc99 Work around missing EISDIR errno values.
Windows does not return EISDIR when a directory is opened as file.
These instances are detected by checking explicitly whether the offending
file is indeed a directory, and then the errno value is adjusted accordingly.
2007-01-19 16:27:30 +01:00
Johannes Sixt
2de27f2cbb Implement a wrapper of execve that can invoke shell scripts.
When an external git command is invoked, it can be a Bourne shell script.
This patch looks into the command file to see whether it is one.
In this case, the command line is rearranged to invoke the shell
with the proper arguments.

Moreover, the arguments are quoted if necessary because Windows'
spawn functions paste the arguments again into a command line that
is disassembled by the invoked process.
2007-01-19 16:27:30 +01:00
Johannes Sixt
90262b5fae Use the Windows style PATH separator. 2007-01-19 16:25:15 +01:00
Johannes Sixt
d9634b14f9 Windows does not support C99 format strings. 2007-01-19 16:25:15 +01:00