summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-06-08 21:23:35 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-06-08 21:23:35 -0700
commit55becd7b5fdbd93a2928a659a670d004d30d7c37 (patch)
tree18e1ad1c22d8b90da241761b0061bf68e0745457
parentMerge branch 'master' into next (diff)
parentdate.c: improve guess between timezone offset and year. (diff)
downloadtgif-55becd7b5fdbd93a2928a659a670d004d30d7c37.tar.xz
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
-rw-r--r--Documentation/git-clone.txt11
-rw-r--r--builtin-rm.c17
-rw-r--r--connect.c2
-rw-r--r--date.c2
-rwxr-xr-xgit-clone.sh15
-rw-r--r--imap-send.c6
-rw-r--r--rsh.c6
7 files changed, 41 insertions, 18 deletions
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 94d9393372..7572e4b80d 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -11,7 +11,7 @@ SYNOPSIS
[verse]
'git-clone' [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare]
[-o <name>] [-u <upload-pack>] [--reference <repository>]
- <repository> [<directory>]
+ [--use-separate-remote] <repository> [<directory>]
DESCRIPTION
-----------
@@ -73,7 +73,7 @@ OPTIONS
files in `<directory>/.git`, make the `<directory>`
itself the `$GIT_DIR`. This implies `-n` option. When
this option is used, neither the `origin` branch nor the
- default `remotes/origin` file is created.
+ default `remotes/origin` file is created.
-o <name>::
Instead of using the branch name 'origin' to keep track
@@ -94,12 +94,17 @@ OPTIONS
if unset the templates are taken from the installation
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>::
The (possibly remote) repository to clone from. It can
be any URL git-fetch supports.
<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
explicitly given ("repo" for "/path/to/repo.git" and "foo"
for "host.xz:foo/.git"). Cloning into an existing directory
diff --git a/builtin-rm.c b/builtin-rm.c
index ef2f8b5d09..4d56a1f070 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -83,15 +83,15 @@ int cmd_rm(int argc, const char **argv, char **envp)
}
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;
- if (pathspec) {
- for (i = 0; pathspec[i] ; i++)
- /* nothing */;
- seen = xmalloc(i);
- memset(seen, 0, i);
- }
+ for (i = 0; pathspec[i] ; i++)
+ /* nothing */;
+ seen = xmalloc(i);
+ memset(seen, 0, i);
for (i = 0; i < active_nr; 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);
}
+ if (show_only)
+ return 0;
+
/*
* Then, if we used "-f", remove the filenames from the
* workspace. If we fail to remove the first one, we
diff --git a/connect.c b/connect.c
index eca94f7548..52d709e58d 100644
--- a/connect.c
+++ b/connect.c
@@ -657,6 +657,8 @@ int git_connect(int fd[2], char *url, const char *prog)
if (pipe(pipefd[0]) < 0 || pipe(pipefd[1]) < 0)
die("unable to create pipe pair for communication");
pid = fork();
+ if (pid < 0)
+ die("unable to fork");
if (!pid) {
snprintf(command, sizeof(command), "%s %s", prog,
sq_quote(path));
diff --git a/date.c b/date.c
index 365dc3b14e..66be23ab21 100644
--- a/date.c
+++ b/date.c
@@ -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? */
if (n == 4) {
- if (num <= 1200 && *offset == -1) {
+ if (num <= 1400 && *offset == -1) {
unsigned int minutes = num % 100;
unsigned int hours = num / 100;
*offset = hours*60 + minutes;
diff --git a/git-clone.sh b/git-clone.sh
index de59904d56..64318b4dd3 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -391,11 +391,16 @@ Pull: refs/heads/$head_points_at:$origin_track" &&
(cd "$GIT_DIR/$remote_top" && find . -type f -print) |
while read dotslref
do
- name=`expr "$dotslref" : './\(.*\)'` &&
- test "$use_separate_remote" = '' && {
- test "$head_points_at" = "$name" ||
- test "$origin" = "$name"
- } ||
+ name=`expr "$dotslref" : './\(.*\)'`
+ if test "z$head_points_at" = "z$name"
+ then
+ continue
+ fi
+ if test "$use_separate_remote" = '' &&
+ test "z$origin" = "z$name"
+ then
+ continue
+ fi
echo "Pull: refs/heads/${name}:$remote_top/${name}"
done >>"$GIT_DIR/remotes/$origin" &&
case "$use_separate_remote" in
diff --git a/imap-send.c b/imap-send.c
index 52e2400b57..285ad29afb 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -924,6 +924,7 @@ imap_open_store( imap_server_conf_t *srvc )
struct hostent *he;
struct sockaddr_in addr;
int s, a[2], preauth;
+ pid_t pid;
ctx = xcalloc( sizeof(*ctx), 1 );
@@ -941,7 +942,10 @@ imap_open_store( imap_server_conf_t *srvc )
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)
_exit( 127 );
close( a[0] );
diff --git a/rsh.c b/rsh.c
index d66526941f..07166addd9 100644
--- a/rsh.c
+++ b/rsh.c
@@ -48,6 +48,7 @@ int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
int sizen;
int of;
int i;
+ pid_t pid;
if (!strcmp(url, "-")) {
*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))
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;
ssh = getenv("GIT_SSH");
if (!ssh) ssh = "ssh";