summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4397f01)
raw | patch | inline | side by side (parent: 4397f01)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Tue, 28 Jun 2005 18:10:48 +0000 (11:10 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Tue, 28 Jun 2005 18:10:48 +0000 (11:10 -0700) |
This also suppresses creation of the index file.
pack-objects.c | patch | blob | history |
diff --git a/pack-objects.c b/pack-objects.c
index 90b27c60c3a889d7534e17af51b3e8b79b1d2b24..e9764604f6f17f4eb018b4fd7247550e90583f8c 100644 (file)
--- a/pack-objects.c
+++ b/pack-objects.c
#include "delta.h"
#include "csum-file.h"
-static const char pack_usage[] = "git-pack-objects [--window=N] [--depth=N] base-name < object-list";
+static const char pack_usage[] = "git-pack-objects [--window=N] [--depth=N] {--stdout | base-name} < object-list";
/*
* The object type is a single-character shorthand:
@@ -87,10 +87,14 @@ static unsigned long write_object(struct sha1file *f, struct object_entry *entry
static void write_pack_file(void)
{
int i;
- struct sha1file *f = sha1create("%s.%s", base_name, "pack");
+ struct sha1file *f;
unsigned long offset = 0;
unsigned long mb;
+ if (!base_name)
+ f = sha1fd(1, "<stdout>");
+ else
+ f = sha1create("%s.%s", base_name, "pack");
for (i = 0; i < nr_objects; i++) {
struct object_entry *entry = objects + i;
entry->offset = offset;
int main(int argc, char **argv)
{
char line[PATH_MAX + 20];
- int window = 10, depth = 10;
+ int window = 10, depth = 10, pack_to_stdout = 0;
int i;
for (i = 1; i < argc; i++) {
usage(pack_usage);
continue;
}
+ if (!strcmp("--stdout", arg)) {
+ pack_to_stdout = 1;
+ continue;
+ }
usage(pack_usage);
}
if (base_name)
base_name = arg;
}
- if (!base_name)
+ if (pack_to_stdout != !base_name)
usage(pack_usage);
while (fgets(line, sizeof(line), stdin) != NULL) {
}
get_object_details();
- printf("Packing %d objects\n", nr_objects);
+ fprintf(stderr, "Packing %d objects\n", nr_objects);
sorted_by_sha = create_sorted_list(sha1_sort);
sorted_by_type = create_sorted_list(type_size_sort);
find_deltas(sorted_by_type, window+1, depth);
write_pack_file();
- write_index_file();
+ if (!pack_to_stdout)
+ write_index_file();
return 0;
}