summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cc46a74)
raw | patch | inline | side by side (parent: cc46a74)
author | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 12 Feb 2007 00:45:56 +0000 (19:45 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 12 Feb 2007 00:45:56 +0000 (19:45 -0500) |
Most users don't need the pack boundary information that fast-import
was printing to standard output, especially if they were calling
it with --quiet.
Those users who do want this information probably want it captured
so they can go back and use it to repack the imported repository.
So dumping the boundary commits to a log file makes more sense then
printing them to standard output.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
was printing to standard output, especially if they were calling
it with --quiet.
Those users who do want this information probably want it captured
so they can go back and use it to repack the imported repository.
So dumping the boundary commits to a log file makes more sense then
printing them to standard output.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Documentation/git-fast-import.txt | patch | blob | history | |
fast-import.c | patch | blob | history | |
t/t9300-fast-import.sh | patch | blob | history |
index 2a5052072a740ba8830f2be61a2486fd84d8ec43..843faf79c679344d0120853a258ca7e35358fdca 100644 (file)
Frontends can use this file to validate imports after they
have been completed.
+--export-pack-edges=<file>::
+ After creating a packfile, print a line of data to
+ <file> listing the filename of the packfile and the last
+ commit on each branch that was written to that packfile.
+ This information may be useful after importing projects
+ whose total object set exceeds the 4 GiB packfile limit,
+ as these commits can be used as edge points during calls
+ to gitlink:git-pack-objects[1].
+
--quiet::
Disable all non-fatal output, making fast-import silent when it
is successful. This option disables the output shown by
diff --git a/fast-import.c b/fast-import.c
index 3f4e73f82162f555324667cb32fb4daced0e3482..f9cfc726371c34a175eecb6cbc218dcb300164b7 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
static unsigned long branch_count;
static unsigned long branch_load_count;
static int failure;
+static FILE *pack_edges;
/* Memory pools */
static size_t mem_pool_alloc = 2*1024*1024 - sizeof(struct mem_pool);
install_packed_git(new_p);
/* Print the boundary */
- fprintf(stdout, "%s:", new_p->pack_name);
- for (i = 0; i < branch_table_sz; i++) {
- for (b = branch_table[i]; b; b = b->table_next_branch) {
- if (b->pack_id == pack_id)
- fprintf(stdout, " %s", sha1_to_hex(b->sha1));
+ if (pack_edges) {
+ fprintf(pack_edges, "%s:", new_p->pack_name);
+ for (i = 0; i < branch_table_sz; i++) {
+ for (b = branch_table[i]; b; b = b->table_next_branch) {
+ if (b->pack_id == pack_id)
+ fprintf(pack_edges, " %s", sha1_to_hex(b->sha1));
+ }
}
+ for (t = first_tag; t; t = t->next_tag) {
+ if (t->pack_id == pack_id)
+ fprintf(pack_edges, " %s", sha1_to_hex(t->sha1));
+ }
+ fputc('\n', pack_edges);
+ fflush(pack_edges);
}
- for (t = first_tag; t; t = t->next_tag) {
- if (t->pack_id == pack_id)
- fprintf(stdout, " %s", sha1_to_hex(t->sha1));
- }
- fputc('\n', stdout);
pack_id++;
}
max_active_branches = strtoul(a + 18, NULL, 0);
else if (!strncmp(a, "--export-marks=", 15))
mark_file = a + 15;
- else if (!strcmp(a, "--force"))
+ else if (!strncmp(a, "--export-pack-edges=", 20)) {
+ if (pack_edges)
+ fclose(pack_edges);
+ pack_edges = fopen(a + 20, "a");
+ if (!pack_edges)
+ die("Cannot open %s: %s", a + 20, strerror(errno));
+ } else if (!strcmp(a, "--force"))
force_update = 1;
else if (!strcmp(a, "--quiet"))
show_stats = 0;
unkeep_all_packs();
dump_marks();
+ if (pack_edges)
+ fclose(pack_edges);
+
if (show_stats) {
uintmax_t total_count = 0, duplicate_count = 0;
for (i = 0; i < ARRAY_SIZE(object_count_by_type); i++)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 357a8724dd718fb44ecf7fdde391b2d0e5b62199..8d28211294af7e2c7e6de501d4f54f124b869fc2 100755 (executable)
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
'git-cat-file blob H:h/e/l/lo >actual &&
diff -u expect actual'
+###
+### series I
+###
+
+cat >input <<INPUT_END
+commit refs/heads/export-boundary
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+data <<COMMIT
+we have a border. its only 40 characters wide.
+COMMIT
+
+from refs/heads/branch
+
+INPUT_END
+test_expect_success \
+ 'I: export-pack-edges' \
+ 'git-fast-import --export-pack-edges=edges.list <input'
+
+cat >expect <<EOF
+.git/objects/pack/pack-.pack: `git-rev-parse --verify export-boundary`
+EOF
+test_expect_success \
+ 'I: verify edge list' \
+ 'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
+ diff -u expect actual'
+
test_done