From: Junio C Hamano Date: Sun, 29 Apr 2007 08:52:43 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.5.2-rc1~14 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/39231b1c32caee10c7ac3397341ea0c6cf56e7f9?hp=-c Merge branch 'maint' * maint: http.c: Fix problem with repeated calls of http_init Add missing reference to GIT_COMMITTER_DATE in git-commit-tree documentation Fix import-tars fix. Update .mailmap with "Michael" Do not barf on too long action description Catch empty pathnames in trees during fsck Don't allow empty pathnames in fast-import import-tars: be nice to wrong directory modes git-svn: Added 'find-rev' command git shortlog documentation: add long options and fix a typo --- 39231b1c32caee10c7ac3397341ea0c6cf56e7f9 diff --combined Documentation/git.txt index ca1f78f790,c81162eba5..08ba53ae01 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@@ -37,11 -37,7 +37,11 @@@ Documentation for older releases are av * link:RelNotes-1.5.1.txt[release notes for 1.5.1] -* link:v1.5.0.7/git.html[documentation for release 1.5.0.7] +* link:v1.5.1.2/git.html[documentation for release 1.5.1.2] + +* link:RelNotes-1.5.1.2.txt[release notes for 1.5.1.2] + +* link:RelNotes-1.5.1.1.txt[release notes for 1.5.1.1] * link:RelNotes-1.5.0.7.txt[release notes for 1.5.0.7] @@@ -344,6 -340,7 +344,7 @@@ git Commit 'GIT_AUTHOR_DATE':: 'GIT_COMMITTER_NAME':: 'GIT_COMMITTER_EMAIL':: + 'GIT_COMMITTER_DATE':: see gitlink:git-commit-tree[1] git Diffs diff --combined builtin-fetch--tool.c index 3145c01f7e,2ad45dcd44..2065466f27 --- a/builtin-fetch--tool.c +++ b/builtin-fetch--tool.c @@@ -35,16 -35,13 +35,13 @@@ static int update_ref(const char *actio unsigned char *sha1, unsigned char *oldval) { - int len; char msg[1024]; char *rla = getenv("GIT_REFLOG_ACTION"); static struct ref_lock *lock; if (!rla) rla = "(reflog update)"; - len = snprintf(msg, sizeof(msg), "%s: %s", rla, action); - if (sizeof(msg) <= len) - die("insanely long action"); + snprintf(msg, sizeof(msg), "%s: %s", rla, action); lock = lock_any_ref_for_update(refname, oldval); if (!lock) return 1; @@@ -436,87 -433,10 +433,87 @@@ static int expand_refs_wildcard(const c return 0; } +static int pick_rref(int sha1_only, const char *rref, const char *ls_remote_result) +{ + int err = 0; + int lrr_count = lrr_count, i, pass; + const char *cp; + struct lrr { + const char *line; + const char *name; + int namelen; + int shown; + } *lrr_list = lrr_list; + + for (pass = 0; pass < 2; pass++) { + /* pass 0 counts and allocates, pass 1 fills... */ + cp = ls_remote_result; + i = 0; + while (1) { + const char *np; + while (*cp && isspace(*cp)) + cp++; + if (!*cp) + break; + np = strchr(cp, '\n'); + if (!np) + np = cp + strlen(cp); + if (pass) { + lrr_list[i].line = cp; + lrr_list[i].name = cp + 41; + lrr_list[i].namelen = np - (cp + 41); + } + i++; + cp = np; + } + if (!pass) { + lrr_count = i; + lrr_list = xcalloc(lrr_count, sizeof(*lrr_list)); + } + } + + while (1) { + const char *next; + int rreflen; + int i; + + while (*rref && isspace(*rref)) + rref++; + if (!*rref) + break; + next = strchr(rref, '\n'); + if (!next) + next = rref + strlen(rref); + rreflen = next - rref; + + for (i = 0; i < lrr_count; i++) { + struct lrr *lrr = &(lrr_list[i]); + + if (rreflen == lrr->namelen && + !memcmp(lrr->name, rref, rreflen)) { + if (!lrr->shown) + printf("%.*s\n", + sha1_only ? 40 : lrr->namelen + 41, + lrr->line); + lrr->shown = 1; + break; + } + } + if (lrr_count <= i) { + error("pick-rref: %.*s not found", rreflen, rref); + err = 1; + } + rref = next; + } + free(lrr_list); + return err; +} + int cmd_fetch__tool(int argc, const char **argv, const char *prefix) { int verbose = 0; int force = 0; + int sopt = 0; while (1 < argc) { const char *arg = argv[1]; @@@ -524,8 -444,6 +521,8 @@@ verbose = 1; else if (!strcmp("-f", arg)) force = 1; + else if (!strcmp("-s", arg)) + sopt = 1; else break; argc--; @@@ -570,15 -488,6 +567,15 @@@ reflist = get_stdin(); return parse_reflist(reflist); } + if (!strcmp("pick-rref", argv[1])) { + const char *ls_remote_result; + if (argc != 4) + return error("pick-rref takes 2 args"); + ls_remote_result = argv[3]; + if (!strcmp(ls_remote_result, "-")) + ls_remote_result = get_stdin(); + return pick_rref(sopt, argv[2], ls_remote_result); + } if (!strcmp("expand-refs-wildcard", argv[1])) { const char *reflist; if (argc < 4) diff --combined builtin-fsck.c index fcb8ed5af1,75e10e25ec..44ce629a49 --- a/builtin-fsck.c +++ b/builtin-fsck.c @@@ -14,7 -14,6 +14,7 @@@ static int show_root; static int show_tags; static int show_unreachable; +static int include_reflogs = 1; static int check_full; static int check_strict; static int keep_cache_objects; @@@ -219,6 -218,7 +219,7 @@@ static int fsck_tree(struct tree *item { int retval; int has_full_path = 0; + int has_empty_name = 0; int has_zero_pad = 0; int has_bad_modes = 0; int has_dup_entries = 0; @@@ -242,6 -242,8 +243,8 @@@ if (strchr(name, '/')) has_full_path = 1; + if (!*name) + has_empty_name = 1; has_zero_pad |= *(char *)desc.buffer == '0'; update_tree_entry(&desc); @@@ -253,7 -255,6 +256,7 @@@ case S_IFREG | 0644: case S_IFLNK: case S_IFDIR: + case S_IFDIRLNK: break; /* * This is nonstandard, but we had a few of these @@@ -291,6 -292,9 +294,9 @@@ if (has_full_path) { objwarning(&item->object, "contains full pathnames"); } + if (has_empty_name) { + objwarning(&item->object, "contains empty pathname"); + } if (has_zero_pad) { objwarning(&item->object, "contains zero-padded file modes"); } @@@ -350,7 -354,7 +356,7 @@@ static int fsck_tag(struct tag *tag return 0; } -static int fsck_sha1(unsigned char *sha1) +static int fsck_sha1(const unsigned char *sha1) { struct object *obj = parse_object(sha1); if (!obj) { @@@ -519,8 -523,7 +525,8 @@@ static int fsck_handle_ref(const char * static void get_default_heads(void) { for_each_ref(fsck_handle_ref, NULL); - for_each_reflog(fsck_handle_reflog, NULL); + if (include_reflogs) + for_each_reflog(fsck_handle_reflog, NULL); /* * Not having any default heads isn't really fatal, but @@@ -627,10 -630,6 +633,10 @@@ int cmd_fsck(int argc, char **argv, con keep_cache_objects = 1; continue; } + if (!strcmp(arg, "--no-reflogs")) { + include_reflogs = 0; + continue; + } if (!strcmp(arg, "--full")) { check_full = 1; continue; @@@ -662,9 -661,12 +668,9 @@@ verify_pack(p, 0); for (p = packed_git; p; p = p->next) { - uint32_t i, num = num_packed_objects(p); - for (i = 0; i < num; i++) { - unsigned char sha1[20]; - nth_packed_object_sha1(p, i, sha1); - fsck_sha1(sha1); - } + uint32_t i, num = p->num_objects; + for (i = 0; i < num; i++) + fsck_sha1(nth_packed_object_sha1(p, i)); } } @@@ -704,14 -706,8 +710,14 @@@ int i; read_cache(); for (i = 0; i < active_nr; i++) { - struct blob *blob = lookup_blob(active_cache[i]->sha1); + unsigned int mode; + struct blob *blob; struct object *obj; + + mode = ntohl(active_cache[i]->ce_mode); + if (S_ISDIRLNK(mode)) + continue; + blob = lookup_blob(active_cache[i]->sha1); if (!blob) continue; obj = &blob->object; diff --combined contrib/fast-import/import-tars.perl index 184214689d,82a90429c8..d2363a415d --- a/contrib/fast-import/import-tars.perl +++ b/contrib/fast-import/import-tars.perl @@@ -52,6 -52,7 +52,7 @@@ foreach my $tar_file (@ARGV Z8 Z1 Z100 Z6 Z2 Z32 Z32 Z8 Z8 Z*', $_; last unless $name; + next if $name =~ m{/\z}; $mode = oct $mode; $size = oct $size; $mtime = oct $mtime; @@@ -64,12 -65,7 +65,12 @@@ } print FI "\n"; - my $path = "$prefix$name"; + my $path; + if ($prefix) { + $path = "$prefix/$name"; + } else { + $path = "$name"; + } $files{$path} = [$next_mark++, $mode]; $commit_time = $mtime if $mtime > $commit_time; diff --combined fast-import.c index c4c8cb905e,6c43a0d37f..b4cbcd9011 --- a/fast-import.c +++ b/fast-import.c @@@ -673,7 -673,7 +673,7 @@@ static void fixup_header_footer(void buf = xmalloc(buf_sz); for (;;) { - size_t n = xread(pack_fd, buf, buf_sz); + ssize_t n = xread(pack_fd, buf, buf_sz); if (!n) break; if (n < 0) @@@ -904,12 -904,6 +904,12 @@@ static int store_object if (e->offset) { duplicate_count_by_type[type]++; return 1; + } else if (find_sha1_pack(sha1, packed_git)) { + e->type = type; + e->pack_id = MAX_PACK_ID; + e->offset = 1; /* just not zero! */ + duplicate_count_by_type[type]++; + return 1; } if (last && last->data && last->depth < max_depth) { @@@ -1199,6 -1193,8 +1199,8 @@@ static int tree_content_set n = slash1 - p; else n = strlen(p); + if (!n) + die("Empty path component found in input"); for (i = 0; i < t->entry_count; i++) { e = t->entries[i]; @@@ -2027,7 -2023,6 +2029,7 @@@ static void import_marks(const char *in e = insert_object(sha1); e->type = type; e->pack_id = MAX_PACK_ID; + e->offset = 1; /* just not zero! */ } insert_mark(mark, e); } @@@ -2093,7 -2088,6 +2095,7 @@@ int main(int argc, const char **argv if (i != argc) usage(fast_import_usage); + prepare_packed_git(); start_packfile(); for (;;) { read_next_command();