mirror of
https://github.com/git/git.git
synced 2024-11-19 01:54:03 +01:00
Revert "commit-graph.c: introduce '--[no-]check-oids'"
This reverts commit 7a9ce0269bc0f4ef230f930b3910b70ac3142552, which has not yet gained consensus.
This commit is contained in:
parent
7a9ce0269b
commit
dbd5e0a186
@ -82,11 +82,6 @@ tip with the previous tip.
|
|||||||
Finally, if `--expire-time=<datetime>` is not specified, let `datetime`
|
Finally, if `--expire-time=<datetime>` is not specified, let `datetime`
|
||||||
be the current time. After writing the split commit-graph, delete all
|
be the current time. After writing the split commit-graph, delete all
|
||||||
unused commit-graph whose modified times are older than `datetime`.
|
unused commit-graph whose modified times are older than `datetime`.
|
||||||
+
|
|
||||||
The `--[no-]check-oids` option decides whether or not OIDs are required
|
|
||||||
to be commits. By default, `--check-oids` is implied, generating an
|
|
||||||
error on non-commit objects. If `--no-check-oids` is given, non-commits
|
|
||||||
are silently discarded.
|
|
||||||
|
|
||||||
'verify'::
|
'verify'::
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ static char const * const builtin_commit_graph_usage[] = {
|
|||||||
N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"),
|
N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"),
|
||||||
N_("git commit-graph write [--object-dir <objdir>] [--append] "
|
N_("git commit-graph write [--object-dir <objdir>] [--append] "
|
||||||
"[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] "
|
"[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] "
|
||||||
"[--[no-]progress] [--[no-]check-oids] <split options>"),
|
"[--[no-]progress] <split options>"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ static const char * const builtin_commit_graph_verify_usage[] = {
|
|||||||
static const char * const builtin_commit_graph_write_usage[] = {
|
static const char * const builtin_commit_graph_write_usage[] = {
|
||||||
N_("git commit-graph write [--object-dir <objdir>] [--append] "
|
N_("git commit-graph write [--object-dir <objdir>] [--append] "
|
||||||
"[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] "
|
"[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] "
|
||||||
"[--[no-]progress] [--[no-]check-oids] <split options>"),
|
"[--[no-]progress] <split options>"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -36,7 +36,6 @@ static struct opts_commit_graph {
|
|||||||
int split;
|
int split;
|
||||||
int shallow;
|
int shallow;
|
||||||
int progress;
|
int progress;
|
||||||
int check_oids;
|
|
||||||
} opts;
|
} opts;
|
||||||
|
|
||||||
static struct object_directory *find_odb(struct repository *r,
|
static struct object_directory *find_odb(struct repository *r,
|
||||||
@ -161,8 +160,6 @@ static int graph_write(int argc, const char **argv)
|
|||||||
N_("allow writing an incremental commit-graph file"),
|
N_("allow writing an incremental commit-graph file"),
|
||||||
PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
|
PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
|
||||||
write_option_parse_split),
|
write_option_parse_split),
|
||||||
OPT_BOOL(0, "check-oids", &opts.check_oids,
|
|
||||||
N_("require OIDs to be commits")),
|
|
||||||
OPT_INTEGER(0, "max-commits", &split_opts.max_commits,
|
OPT_INTEGER(0, "max-commits", &split_opts.max_commits,
|
||||||
N_("maximum number of commits in a non-base split commit-graph")),
|
N_("maximum number of commits in a non-base split commit-graph")),
|
||||||
OPT_INTEGER(0, "size-multiple", &split_opts.size_multiple,
|
OPT_INTEGER(0, "size-multiple", &split_opts.size_multiple,
|
||||||
@ -173,7 +170,6 @@ static int graph_write(int argc, const char **argv)
|
|||||||
};
|
};
|
||||||
|
|
||||||
opts.progress = isatty(2);
|
opts.progress = isatty(2);
|
||||||
opts.check_oids = 1;
|
|
||||||
split_opts.size_multiple = 2;
|
split_opts.size_multiple = 2;
|
||||||
split_opts.max_commits = 0;
|
split_opts.max_commits = 0;
|
||||||
split_opts.expire_time = 0;
|
split_opts.expire_time = 0;
|
||||||
@ -228,8 +224,7 @@ static int graph_write(int argc, const char **argv)
|
|||||||
|
|
||||||
oidset_insert(&commits, &oid);
|
oidset_insert(&commits, &oid);
|
||||||
}
|
}
|
||||||
if (opts.check_oids)
|
flags |= COMMIT_GRAPH_WRITE_CHECK_OIDS;
|
||||||
flags |= COMMIT_GRAPH_WRITE_CHECK_OIDS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNLEAK(buf);
|
UNLEAK(buf);
|
||||||
|
@ -145,7 +145,7 @@ static int verify_commit_graph_lite(struct commit_graph *g)
|
|||||||
*
|
*
|
||||||
* There should only be very basic checks here to ensure that
|
* There should only be very basic checks here to ensure that
|
||||||
* we don't e.g. segfault in fill_commit_in_graph(), but
|
* we don't e.g. segfault in fill_commit_in_graph(), but
|
||||||
e because this is a very hot codepath nothing that e.g. loops
|
* because this is a very hot codepath nothing that e.g. loops
|
||||||
* over g->num_commits, or runs a checksum on the commit-graph
|
* over g->num_commits, or runs a checksum on the commit-graph
|
||||||
* itself.
|
* itself.
|
||||||
*/
|
*/
|
||||||
|
@ -49,34 +49,6 @@ test_expect_success 'exit with correct error on bad input to --stdin-commits' '
|
|||||||
test_i18ngrep "invalid commit object id" stderr
|
test_i18ngrep "invalid commit object id" stderr
|
||||||
'
|
'
|
||||||
|
|
||||||
graph_expect_commits() {
|
|
||||||
test-tool read-graph >got
|
|
||||||
if ! grep "num_commits: $1" got
|
|
||||||
then
|
|
||||||
echo "graph_expect_commits: expected $1 commit(s), got:"
|
|
||||||
cat got
|
|
||||||
false
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
test_expect_success 'ignores non-commit OIDs to --input=stdin-commits with --no-check-oids' '
|
|
||||||
test_when_finished rm -rf "$objdir/info/commit-graph" &&
|
|
||||||
cd "$TRASH_DIRECTORY/full" &&
|
|
||||||
# write a graph to ensure layers are/are not added appropriately
|
|
||||||
git rev-parse HEAD~1 >base &&
|
|
||||||
git commit-graph write --stdin-commits <base &&
|
|
||||||
graph_expect_commits 2 &&
|
|
||||||
# bad input is rejected
|
|
||||||
echo HEAD >bad &&
|
|
||||||
test_expect_code 1 git commit-graph write --stdin-commits <bad 2>err &&
|
|
||||||
test_i18ngrep "unexpected non-hex object ID: HEAD" err &&
|
|
||||||
graph_expect_commits 2 &&
|
|
||||||
# update with valid commit OID, ignore tree OID
|
|
||||||
git rev-parse HEAD HEAD^{tree} >in &&
|
|
||||||
git commit-graph write --stdin-commits --no-check-oids <in &&
|
|
||||||
graph_expect_commits 3
|
|
||||||
'
|
|
||||||
|
|
||||||
graph_git_two_modes() {
|
graph_git_two_modes() {
|
||||||
git -c core.commitGraph=true $1 >output
|
git -c core.commitGraph=true $1 >output
|
||||||
git -c core.commitGraph=false $1 >expect
|
git -c core.commitGraph=false $1 >expect
|
||||||
|
Loading…
Reference in New Issue
Block a user