summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 16cee38)
raw | patch | inline | side by side (parent: 16cee38)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 6 Jun 2006 15:46:23 +0000 (08:46 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 6 Jun 2006 21:16:43 +0000 (14:16 -0700) |
Additionally notices and complains to an -o option without
directory or a duplicated -o option, -o and --stdout given
together. Also delays the creation of directory until all
arguments are parsed, so that the command does not leave an
empty directory behind when it exits after seeing an unrelated
invalid option.
[jc: originally from Dennis Stosberg but with minor fixes, and
documentation updates from Dennis.]
Signed-off-by: Junio C Hamano <junkio@cox.net>
directory or a duplicated -o option, -o and --stdout given
together. Also delays the creation of directory until all
arguments are parsed, so that the command does not leave an
empty directory behind when it exits after seeing an unrelated
invalid option.
[jc: originally from Dennis Stosberg but with minor fixes, and
documentation updates from Dennis.]
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git-format-patch.txt | patch | blob | history | |
builtin-log.c | patch | blob | history |
index 493cac22dbe16dd5bdb9eed8f91f93ea184fa622..4ca0014dac64729bee11b6a37bd730b538b2e5ee 100644 (file)
-------
-o|--output-directory <dir>::
Use <dir> to store the resulting files, instead of the
- current working directory. This option is ignored if
- --stdout is specified.
+ current working directory.
-n|--numbered::
Name output in '[PATCH n/m]' format.
diff --git a/builtin-log.c b/builtin-log.c
index 6612f4c2a803451a6769d26345089e36b4bc221e..29a885121dd81f1e6288835d12374acc19a751f4 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
static FILE *realstdout = NULL;
-static char *output_directory = NULL;
+static const char *output_directory = NULL;
static void reopen_stdout(struct commit *commit, int nr, int keep_subject)
{
keep_subject = 1;
rev.total = -1;
}
- else if (!strcmp(argv[i], "-o")) {
- if (argc < 3)
- die ("Which directory?");
- if (mkdir(argv[i + 1], 0777) < 0 && errno != EEXIST)
- die("Could not create directory %s",
- argv[i + 1]);
- output_directory = strdup(argv[i + 1]);
+ else if (!strcmp(argv[i], "--output-directory") ||
+ !strcmp(argv[i], "-o")) {
i++;
+ if (argc <= i)
+ die("Which directory?");
+ if (output_directory)
+ die("Two output directories?");
+ output_directory = argv[i];
}
else if (!strcmp(argv[i], "--signoff") ||
!strcmp(argv[i], "-s")) {
if (argc > 1)
die ("unrecognized argument: %s", argv[1]);
+ if (output_directory) {
+ if (use_stdout)
+ die("standard output, or directory, which one?");
+ if (mkdir(output_directory, 0777) < 0 && errno != EEXIST)
+ die("Could not create directory %s",
+ output_directory);
+ }
+
if (rev.pending_objects && rev.pending_objects->next == NULL) {
rev.pending_objects->item->flags |= UNINTERESTING;
add_head(&rev);
if (!use_stdout)
fclose(stdout);
}
- if (output_directory)
- free(output_directory);
free(list);
return 0;
}