summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8142f60)
raw | patch | inline | side by side (parent: 8142f60)
author | Junio C Hamano <junkio@cox.net> | |
Sun, 10 Sep 2006 05:42:02 +0000 (22:42 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 10 Sep 2006 20:39:25 +0000 (13:39 -0700) |
And teach backends about it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from 9e2c44a2893ae90944a0b7c9f40a9d22b759b5c0 commit)
Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from 9e2c44a2893ae90944a0b7c9f40a9d22b759b5c0 commit)
archive.h | patch | blob | history | |
builtin-archive.c | patch | blob | history | |
builtin-tar-tree.c | patch | blob | history | |
builtin-zip-tree.c | patch | blob | history |
diff --git a/archive.h b/archive.h
index e0782b9dcfe1c87c1851d29cd9c9083bfabdd6b3..16dcdb875c3715556ce8561e9ee9f7ae8b3766da 100644 (file)
--- a/archive.h
+++ b/archive.h
const unsigned char *commit_sha1;
time_t time;
const char **pathspec;
+ unsigned int verbose : 1;
void *extra;
};
diff --git a/builtin-archive.c b/builtin-archive.c
index 3a8be57e15f3d528d618e39d0c131ca7fac7a638..7544ad3ca1a69b7bd0a9026e03405003d002cf43 100644 (file)
--- a/builtin-archive.c
+++ b/builtin-archive.c
#include "pkt-line.h"
static const char archive_usage[] = \
-"git-archive --format=<fmt> [--prefix=<prefix>/] [<extra>] <tree-ish> [path...]";
+"git-archive --format=<fmt> [--prefix=<prefix>/] [--verbose] [<extra>] <tree-ish> [path...]";
struct archiver archivers[] = {
{
int extra_argc = 0;
const char *format = NULL; /* might want to default to "tar" */
const char *base = "";
+ int verbose = 0;
int i;
for (i = 1; i < argc; i++) {
printf("%s\n", archivers[i].name);
exit(0);
}
+ if (!strcmp(arg, "--verbose") || !strcmp(arg, "-v")) {
+ verbose = 1;
+ continue;
+ }
if (!strncmp(arg, "--format=", 9)) {
format = arg + 9;
continue;
die("%s", default_parse_extra(ar, extra_argv));
ar->args.extra = ar->parse_extra(extra_argc, extra_argv);
}
+ ar->args.verbose = verbose;
ar->args.base = base;
return i;
diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
index e8e492fa0f9e1efc440c8cd4a429930e0446f62d..f2679a86378371293aca257d4e839e87f759ae18 100644 (file)
--- a/builtin-tar-tree.c
+++ b/builtin-tar-tree.c
static time_t archive_time;
static int tar_umask;
+static int verbose;
/* writes out the whole block, but only if it is full */
static void write_if_needed(void)
mode = 0100666;
sprintf(header.name, "%s.paxheader", sha1_to_hex(sha1));
} else {
+ if (verbose)
+ fprintf(stderr, "%.*s\n", path->len, path->buf);
if (S_ISDIR(mode)) {
*header.typeflag = TYPEFLAG_DIR;
mode = (mode | 0777) & ~tar_umask;
git_config(git_tar_config);
archive_time = args->time;
+ verbose = args->verbose;
if (args->commit_sha1)
write_global_extended_header(args->commit_sha1);
diff --git a/builtin-zip-tree.c b/builtin-zip-tree.c
index fdac2bdd706748c6dbf9541558328bc118e267fe..52d4b7a17e39831964fe7c9c9c0cb374d0d61a62 100644 (file)
--- a/builtin-zip-tree.c
+++ b/builtin-zip-tree.c
static const char zip_tree_usage[] =
"git-zip-tree [-0|...|-9] <tree-ish> [ <base> ]";
+static int verbose;
static int zip_date;
static int zip_time;
crc = crc32(0, Z_NULL, 0);
path = construct_path(base, baselen, filename, S_ISDIR(mode), &pathlen);
+ if (verbose)
+ fprintf(stderr, "%s\n", path);
if (pathlen > 0xffff) {
error("path too long (%d chars, SHA1: %s): %s", pathlen,
sha1_to_hex(sha1), path);
zip_dir = xmalloc(ZIP_DIRECTORY_MIN_SIZE);
zip_dir_size = ZIP_DIRECTORY_MIN_SIZE;
+ verbose = args->verbose;
if (args->base && plen > 0 && args->base[plen - 1] == '/') {
char *base = xstrdup(args->base);