X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=archive.c;h=96b62d4309a3bd4198bb035f266a1326fed61d10;hb=98e1a4186acd4b71da1daae5c522cb6ac6d1d904;hp=9ac455d889b72deba8c949da1d9efe2be3a50244;hpb=8c4c286c394cc383577bf884f37a708bba98549e;p=git.git diff --git a/archive.c b/archive.c index 9ac455d88..96b62d430 100644 --- a/archive.c +++ b/archive.c @@ -132,7 +132,7 @@ static int write_archive_entry(const unsigned char *sha1, const char *base, err = write_entry(args, sha1, path.buf, path.len, mode, NULL, 0); if (err) return err; - return READ_TREE_RECURSIVE; + return (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0); } buffer = sha1_file_to_archive(path_without_prefix, sha1, mode, @@ -253,6 +253,7 @@ static int parse_archive_args(int argc, const char **argv, const char *base = NULL; const char *remote = NULL; const char *exec = NULL; + const char *output = NULL; int compression_level = -1; int verbose = 0; int i; @@ -262,6 +263,8 @@ static int parse_archive_args(int argc, const char **argv, OPT_STRING(0, "format", &format, "fmt", "archive format"), OPT_STRING(0, "prefix", &base, "prefix", "prepend prefix to each pathname in the archive"), + OPT_STRING(0, "output", &output, "file", + "write the archive to this file"), OPT__VERBOSE(&verbose), OPT__COMPR('0', &compression_level, "store only", 0), OPT__COMPR('1', &compression_level, "compress faster", 1), @@ -290,6 +293,8 @@ static int parse_archive_args(int argc, const char **argv, die("Unexpected option --remote"); if (exec) die("Option --exec can only be used together with --remote"); + if (output) + die("Unexpected option --output"); if (!base) base = "";