From: Junio C Hamano Date: Sat, 18 Feb 2006 01:34:31 +0000 (-0800) Subject: Merge branch 'fix' X-Git-Tag: v1.3.0-rc1~54^2~65 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/0f4aa3993de5fc7252e43ebd872fd9e4b615873d?hp=-c Merge branch 'fix' * fix: Document --short and --git-dir in git-rev-parse(1) git-rev-parse: Fix --short= option parsing Prevent git-upload-pack segfault if object cannot be found Abstract test_create_repo out for use in tests. Trap exit to clean up created directory if clone fails. --- 0f4aa3993de5fc7252e43ebd872fd9e4b615873d diff --combined rev-parse.c index 9161faed1e,70a82714ca..a5fb93c3ca --- a/rev-parse.c +++ b/rev-parse.c @@@ -48,7 -48,6 +48,7 @@@ static int is_rev_argument(const char * "--show-breaks", "--sparse", "--topo-order", + "--date-order", "--unpacked", NULL }; @@@ -226,12 -225,12 +226,12 @@@ int main(int argc, char **argv continue; } if (!strcmp(arg, "--short") || - !strncmp(arg, "--short=", 9)) { + !strncmp(arg, "--short=", 8)) { filter &= ~(DO_FLAGS|DO_NOREV); verify = 1; abbrev = DEFAULT_ABBREV; - if (arg[8] == '=') - abbrev = strtoul(arg + 9, NULL, 10); + if (arg[7] == '=') + abbrev = strtoul(arg + 8, NULL, 10); if (abbrev < MINIMUM_ABBREV) abbrev = MINIMUM_ABBREV; else if (40 <= abbrev) diff --combined sha1_file.c index 0a3a721e97,f08b1d6ee8..9cab99ae7c --- a/sha1_file.c +++ b/sha1_file.c @@@ -551,8 -551,10 +551,10 @@@ static void prepare_packed_git_one(cha sprintf(path, "%s/pack", objdir); len = strlen(path); dir = opendir(path); - if (!dir) + if (!dir) { + fprintf(stderr, "unable to open object pack directory: %s: %s\n", path, strerror(errno)); return; + } path[len++] = '/'; while ((de = readdir(dir)) != NULL) { int namelen = strlen(de->d_name); @@@ -826,30 -828,11 +828,30 @@@ static unsigned long unpack_object_head return offset; } +int check_reuse_pack_delta(struct packed_git *p, unsigned long offset, + unsigned char *base, unsigned long *sizep, + enum object_type *kindp) +{ + unsigned long ptr; + int status = -1; + + use_packed_git(p); + ptr = offset; + ptr = unpack_object_header(p, ptr, kindp, sizep); + if (*kindp != OBJ_DELTA) + goto done; + memcpy(base, p->pack_base + ptr, 20); + status = 0; + done: + unuse_packed_git(p); + return status; +} + void packed_object_info_detail(struct pack_entry *e, char *type, unsigned long *size, unsigned long *store_size, - int *delta_chain_length, + unsigned int *delta_chain_length, unsigned char *base_sha1) { struct packed_git *p = e->p; @@@ -863,7 -846,7 +865,7 @@@ if (kind != OBJ_DELTA) *delta_chain_length = 0; else { - int chain_length = 0; + unsigned int chain_length = 0; memcpy(base_sha1, pack, 20); do { struct pack_entry base_ent;