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.
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.
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.
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.
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).
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.
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>
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.