зеркало из https://github.com/microsoft/git.git
unpack-objects -r: call it "recover".
The code called this operation "desperate" but the option flag is -r and the word "recover" describes what it does better. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Родитель
f986f2c830
Коммит
3b67d2917a
|
@ -37,7 +37,7 @@ OPTIONS
|
||||||
-r::
|
-r::
|
||||||
When unpacking a corrupt packfile, the command dies at
|
When unpacking a corrupt packfile, the command dies at
|
||||||
the first corruption. This flag tells it to keep going
|
the first corruption. This flag tells it to keep going
|
||||||
and make the best effort to salvage as many objects as
|
and make the best effort to recover as many objects as
|
||||||
possible.
|
possible.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
static int dry_run, quiet, desperate, has_errors;
|
static int dry_run, quiet, recover, has_errors;
|
||||||
static const char unpack_usage[] = "git-unpack-objects [-n] [-q] < pack-file";
|
static const char unpack_usage[] = "git-unpack-objects [-n] [-q] [-r] < pack-file";
|
||||||
|
|
||||||
/* We always read in 4kB chunks. */
|
/* We always read in 4kB chunks. */
|
||||||
static unsigned char buffer[4096];
|
static unsigned char buffer[4096];
|
||||||
|
@ -75,7 +75,7 @@ static void *get_data(unsigned long size)
|
||||||
error("inflate returned %d\n", ret);
|
error("inflate returned %d\n", ret);
|
||||||
free(buf);
|
free(buf);
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
if (!desperate)
|
if (!recover)
|
||||||
exit(1);
|
exit(1);
|
||||||
has_errors = 1;
|
has_errors = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -192,7 +192,7 @@ static void unpack_delta_entry(unsigned long delta_size)
|
||||||
if (!base) {
|
if (!base) {
|
||||||
error("failed to read delta-pack base object %s",
|
error("failed to read delta-pack base object %s",
|
||||||
sha1_to_hex(base_sha1));
|
sha1_to_hex(base_sha1));
|
||||||
if (!desperate)
|
if (!recover)
|
||||||
exit(1);
|
exit(1);
|
||||||
has_errors = 1;
|
has_errors = 1;
|
||||||
return;
|
return;
|
||||||
|
@ -247,7 +247,7 @@ static void unpack_one(unsigned nr, unsigned total)
|
||||||
default:
|
default:
|
||||||
error("bad object type %d", type);
|
error("bad object type %d", type);
|
||||||
has_errors = 1;
|
has_errors = 1;
|
||||||
if (desperate)
|
if (recover)
|
||||||
return;
|
return;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,7 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(arg, "-r")) {
|
if (!strcmp(arg, "-r")) {
|
||||||
desperate = 1;
|
recover = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
usage(unpack_usage);
|
usage(unpack_usage);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче