1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-17 14:34:49 +01:00

Merge branch 'pe/date' into next

* pe/date:
  date.c: improve guess between timezone offset and year.
  git-rm: honor -n flag.
  git-clone: fix duplicated "master" in $GIT_DIR/remotes/origin
  check for error return from fork()
  Document git-clone --use-separate-remote
This commit is contained in:
Junio C Hamano 2006-06-08 21:23:35 -07:00
commit 55becd7b5f
7 changed files with 41 additions and 18 deletions

View file

@ -11,7 +11,7 @@ SYNOPSIS
[verse] [verse]
'git-clone' [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare] 'git-clone' [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare]
[-o <name>] [-u <upload-pack>] [--reference <repository>] [-o <name>] [-u <upload-pack>] [--reference <repository>]
<repository> [<directory>] [--use-separate-remote] <repository> [<directory>]
DESCRIPTION DESCRIPTION
----------- -----------
@ -73,7 +73,7 @@ OPTIONS
files in `<directory>/.git`, make the `<directory>` files in `<directory>/.git`, make the `<directory>`
itself the `$GIT_DIR`. This implies `-n` option. When itself the `$GIT_DIR`. This implies `-n` option. When
this option is used, neither the `origin` branch nor the this option is used, neither the `origin` branch nor the
default `remotes/origin` file is created. default `remotes/origin` file is created.
-o <name>:: -o <name>::
Instead of using the branch name 'origin' to keep track Instead of using the branch name 'origin' to keep track
@ -94,12 +94,17 @@ OPTIONS
if unset the templates are taken from the installation if unset the templates are taken from the installation
defined default, typically `/usr/share/git-core/templates`. defined default, typically `/usr/share/git-core/templates`.
--use-separate-remote::
Save remotes heads under `$GIT_DIR/remotes/origin/' instead
of `$GIT_DIR/refs/heads/'. Only the master branch is saved
in the latter.
<repository>:: <repository>::
The (possibly remote) repository to clone from. It can The (possibly remote) repository to clone from. It can
be any URL git-fetch supports. be any URL git-fetch supports.
<directory>:: <directory>::
The name of a new directory to clone into. The "humanish" The name of a new directory to clone into. The "humanish"
part of the source repository is used if no directory is part of the source repository is used if no directory is
explicitly given ("repo" for "/path/to/repo.git" and "foo" explicitly given ("repo" for "/path/to/repo.git" and "foo"
for "host.xz:foo/.git"). Cloning into an existing directory for "host.xz:foo/.git"). Cloning into an existing directory

View file

@ -83,15 +83,15 @@ int cmd_rm(int argc, const char **argv, char **envp)
} }
die(builtin_rm_usage); die(builtin_rm_usage);
} }
pathspec = get_pathspec(prefix, argv + i); if (argc <= i)
usage(builtin_rm_usage);
pathspec = get_pathspec(prefix, argv + i);
seen = NULL; seen = NULL;
if (pathspec) { for (i = 0; pathspec[i] ; i++)
for (i = 0; pathspec[i] ; i++) /* nothing */;
/* nothing */; seen = xmalloc(i);
seen = xmalloc(i); memset(seen, 0, i);
memset(seen, 0, i);
}
for (i = 0; i < active_nr; i++) { for (i = 0; i < active_nr; i++) {
struct cache_entry *ce = active_cache[i]; struct cache_entry *ce = active_cache[i];
@ -121,6 +121,9 @@ int cmd_rm(int argc, const char **argv, char **envp)
cache_tree_invalidate_path(active_cache_tree, path); cache_tree_invalidate_path(active_cache_tree, path);
} }
if (show_only)
return 0;
/* /*
* Then, if we used "-f", remove the filenames from the * Then, if we used "-f", remove the filenames from the
* workspace. If we fail to remove the first one, we * workspace. If we fail to remove the first one, we

View file

@ -657,6 +657,8 @@ int git_connect(int fd[2], char *url, const char *prog)
if (pipe(pipefd[0]) < 0 || pipe(pipefd[1]) < 0) if (pipe(pipefd[0]) < 0 || pipe(pipefd[1]) < 0)
die("unable to create pipe pair for communication"); die("unable to create pipe pair for communication");
pid = fork(); pid = fork();
if (pid < 0)
die("unable to fork");
if (!pid) { if (!pid) {
snprintf(command, sizeof(command), "%s %s", prog, snprintf(command, sizeof(command), "%s %s", prog,
sq_quote(path)); sq_quote(path));

2
date.c
View file

@ -369,7 +369,7 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
/* Four-digit year or a timezone? */ /* Four-digit year or a timezone? */
if (n == 4) { if (n == 4) {
if (num <= 1200 && *offset == -1) { if (num <= 1400 && *offset == -1) {
unsigned int minutes = num % 100; unsigned int minutes = num % 100;
unsigned int hours = num / 100; unsigned int hours = num / 100;
*offset = hours*60 + minutes; *offset = hours*60 + minutes;

View file

@ -391,11 +391,16 @@ Pull: refs/heads/$head_points_at:$origin_track" &&
(cd "$GIT_DIR/$remote_top" && find . -type f -print) | (cd "$GIT_DIR/$remote_top" && find . -type f -print) |
while read dotslref while read dotslref
do do
name=`expr "$dotslref" : './\(.*\)'` && name=`expr "$dotslref" : './\(.*\)'`
test "$use_separate_remote" = '' && { if test "z$head_points_at" = "z$name"
test "$head_points_at" = "$name" || then
test "$origin" = "$name" continue
} || fi
if test "$use_separate_remote" = '' &&
test "z$origin" = "z$name"
then
continue
fi
echo "Pull: refs/heads/${name}:$remote_top/${name}" echo "Pull: refs/heads/${name}:$remote_top/${name}"
done >>"$GIT_DIR/remotes/$origin" && done >>"$GIT_DIR/remotes/$origin" &&
case "$use_separate_remote" in case "$use_separate_remote" in

View file

@ -924,6 +924,7 @@ imap_open_store( imap_server_conf_t *srvc )
struct hostent *he; struct hostent *he;
struct sockaddr_in addr; struct sockaddr_in addr;
int s, a[2], preauth; int s, a[2], preauth;
pid_t pid;
ctx = xcalloc( sizeof(*ctx), 1 ); ctx = xcalloc( sizeof(*ctx), 1 );
@ -941,7 +942,10 @@ imap_open_store( imap_server_conf_t *srvc )
exit( 1 ); exit( 1 );
} }
if (fork() == 0) { pid = fork();
if (pid < 0)
_exit( 127 );
if (!pid) {
if (dup2( a[0], 0 ) == -1 || dup2( a[0], 1 ) == -1) if (dup2( a[0], 0 ) == -1 || dup2( a[0], 1 ) == -1)
_exit( 127 ); _exit( 127 );
close( a[0] ); close( a[0] );

6
rsh.c
View file

@ -48,6 +48,7 @@ int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
int sizen; int sizen;
int of; int of;
int i; int i;
pid_t pid;
if (!strcmp(url, "-")) { if (!strcmp(url, "-")) {
*fd_in = 0; *fd_in = 0;
@ -91,7 +92,10 @@ int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv)) if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv))
return error("Couldn't create socket"); return error("Couldn't create socket");
if (!fork()) { pid = fork();
if (pid < 0)
return error("Couldn't fork");
if (!pid) {
const char *ssh, *ssh_basename; const char *ssh, *ssh_basename;
ssh = getenv("GIT_SSH"); ssh = getenv("GIT_SSH");
if (!ssh) ssh = "ssh"; if (!ssh) ssh = "ssh";