Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-24 03:42:21 +0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-24 03:42:21 +0400
commit4dfdbe10dc8ca02fff2d5f0ce181b45d39394d56 (patch)
treebe8b3460cd26dc9a0fb13bd0899175ffa6e976b4 /apply.c
parent9ab55bd29a9f110810b72d82be912380f74051b3 (diff)
git-apply: if no input files specified, apply stdin
This makes it act more like a traditional UNIX thing (eg "cat").
Diffstat (limited to 'apply.c')
-rw-r--r--apply.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/apply.c b/apply.c
index dbcc07d398..f3b686541c 100644
--- a/apply.c
+++ b/apply.c
@@ -509,6 +509,7 @@ static int apply_patch(int fd)
int main(int argc, char **argv)
{
int i;
+ int read_stdin = 1;
if (read_cache() < 0)
die("unable to read index file");
@@ -519,6 +520,7 @@ int main(int argc, char **argv)
if (!strcmp(arg, "-")) {
apply_patch(0);
+ read_stdin = 0;
continue;
}
if (!strcmp(arg, "--no-merge")) {
@@ -528,8 +530,11 @@ int main(int argc, char **argv)
fd = open(arg, O_RDONLY);
if (fd < 0)
usage(apply_usage);
+ read_stdin = 0;
apply_patch(fd);
close(fd);
}
+ if (read_stdin)
+ apply_patch(0);
return 0;
}