Skip to content

Commit dbd5e0a

Browse files
committed
Revert "commit-graph.c: introduce '--[no-]check-oids'"
This reverts commit 7a9ce02, which has not yet gained consensus.
1 parent 7a9ce02 commit dbd5e0a

File tree

4 files changed

+4
-42
lines changed

4 files changed

+4
-42
lines changed

Documentation/git-commit-graph.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ tip with the previous tip.
8282
Finally, if `--expire-time=<datetime>` is not specified, let `datetime`
8383
be the current time. After writing the split commit-graph, delete all
8484
unused commit-graph whose modified times are older than `datetime`.
85-
+
86-
The `--[no-]check-oids` option decides whether or not OIDs are required
87-
to be commits. By default, `--check-oids` is implied, generating an
88-
error on non-commit objects. If `--no-check-oids` is given, non-commits
89-
are silently discarded.
9085

9186
'verify'::
9287

builtin/commit-graph.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static char const * const builtin_commit_graph_usage[] = {
1111
N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"),
1212
N_("git commit-graph write [--object-dir <objdir>] [--append] "
1313
"[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] "
14-
"[--[no-]progress] [--[no-]check-oids] <split options>"),
14+
"[--[no-]progress] <split options>"),
1515
NULL
1616
};
1717

@@ -23,7 +23,7 @@ static const char * const builtin_commit_graph_verify_usage[] = {
2323
static const char * const builtin_commit_graph_write_usage[] = {
2424
N_("git commit-graph write [--object-dir <objdir>] [--append] "
2525
"[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] "
26-
"[--[no-]progress] [--[no-]check-oids] <split options>"),
26+
"[--[no-]progress] <split options>"),
2727
NULL
2828
};
2929

@@ -36,7 +36,6 @@ static struct opts_commit_graph {
3636
int split;
3737
int shallow;
3838
int progress;
39-
int check_oids;
4039
} opts;
4140

4241
static struct object_directory *find_odb(struct repository *r,
@@ -161,8 +160,6 @@ static int graph_write(int argc, const char **argv)
161160
N_("allow writing an incremental commit-graph file"),
162161
PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
163162
write_option_parse_split),
164-
OPT_BOOL(0, "check-oids", &opts.check_oids,
165-
N_("require OIDs to be commits")),
166163
OPT_INTEGER(0, "max-commits", &split_opts.max_commits,
167164
N_("maximum number of commits in a non-base split commit-graph")),
168165
OPT_INTEGER(0, "size-multiple", &split_opts.size_multiple,
@@ -173,7 +170,6 @@ static int graph_write(int argc, const char **argv)
173170
};
174171

175172
opts.progress = isatty(2);
176-
opts.check_oids = 1;
177173
split_opts.size_multiple = 2;
178174
split_opts.max_commits = 0;
179175
split_opts.expire_time = 0;
@@ -228,8 +224,7 @@ static int graph_write(int argc, const char **argv)
228224

229225
oidset_insert(&commits, &oid);
230226
}
231-
if (opts.check_oids)
232-
flags |= COMMIT_GRAPH_WRITE_CHECK_OIDS;
227+
flags |= COMMIT_GRAPH_WRITE_CHECK_OIDS;
233228
}
234229

235230
UNLEAK(buf);

commit-graph.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static int verify_commit_graph_lite(struct commit_graph *g)
145145
*
146146
* There should only be very basic checks here to ensure that
147147
* we don't e.g. segfault in fill_commit_in_graph(), but
148-
e because this is a very hot codepath nothing that e.g. loops
148+
* because this is a very hot codepath nothing that e.g. loops
149149
* over g->num_commits, or runs a checksum on the commit-graph
150150
* itself.
151151
*/

t/t5318-commit-graph.sh

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,34 +49,6 @@ test_expect_success 'exit with correct error on bad input to --stdin-commits' '
4949
test_i18ngrep "invalid commit object id" stderr
5050
'
5151

52-
graph_expect_commits() {
53-
test-tool read-graph >got
54-
if ! grep "num_commits: $1" got
55-
then
56-
echo "graph_expect_commits: expected $1 commit(s), got:"
57-
cat got
58-
false
59-
fi
60-
}
61-
62-
test_expect_success 'ignores non-commit OIDs to --input=stdin-commits with --no-check-oids' '
63-
test_when_finished rm -rf "$objdir/info/commit-graph" &&
64-
cd "$TRASH_DIRECTORY/full" &&
65-
# write a graph to ensure layers are/are not added appropriately
66-
git rev-parse HEAD~1 >base &&
67-
git commit-graph write --stdin-commits <base &&
68-
graph_expect_commits 2 &&
69-
# bad input is rejected
70-
echo HEAD >bad &&
71-
test_expect_code 1 git commit-graph write --stdin-commits <bad 2>err &&
72-
test_i18ngrep "unexpected non-hex object ID: HEAD" err &&
73-
graph_expect_commits 2 &&
74-
# update with valid commit OID, ignore tree OID
75-
git rev-parse HEAD HEAD^{tree} >in &&
76-
git commit-graph write --stdin-commits --no-check-oids <in &&
77-
graph_expect_commits 3
78-
'
79-
8052
graph_git_two_modes() {
8153
git -c core.commitGraph=true $1 >output
8254
git -c core.commitGraph=false $1 >expect

0 commit comments

Comments
 (0)