Revert "commit-graph.c: introduce '--[no-]check-oids'"
This reverts commit 7a9ce0269bc0f4ef230f930b3910b70ac3142552, which has not yet gained consensus.
Junio C Hamano committed
Apr 29, 2020 at 12:44 UTC
dbd5e0a1861c5bb1446e5518173aa1760c6617b0
4 files changed
+4
-42
Documentation/git-commit-graph.txt
-5
@@ -82,11 +82,6 @@ tip with the previous tip.
82
Finally, if `--expire-time=<datetime>` is not specified, let `datetime`
83
be the current time. After writing the split commit-graph, delete all
84
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.
85
86
'verify'::
87
builtin/commit-graph.c
+3
-8
@@ -11,7 +11,7 @@ static char const * const builtin_commit_graph_usage[] = {
11
N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"),
12
N_("git commit-graph write [--object-dir <objdir>] [--append] "
13
"[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] "
14
- "[--[no-]progress] [--[no-]check-oids] <split options>"),
14
+ "[--[no-]progress] <split options>"),
15
NULL
16
};
17
@@ -23,7 +23,7 @@ static const char * const builtin_commit_graph_verify_usage[] = {
23
static const char * const builtin_commit_graph_write_usage[] = {
24
N_("git commit-graph write [--object-dir <objdir>] [--append] "
25
"[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] "
26
- "[--[no-]progress] [--[no-]check-oids] <split options>"),
26
+ "[--[no-]progress] <split options>"),
27
NULL
28
};
29
@@ -36,7 +36,6 @@ static struct opts_commit_graph {
36
int split;
37
int shallow;
38
int progress;
39
- int check_oids;
39
} opts;
40
41
static struct object_directory *find_odb(struct repository *r,
@@ -161,8 +160,6 @@ static int graph_write(int argc, const char **argv)
160
N_("allow writing an incremental commit-graph file"),
161
PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
162
write_option_parse_split),
164
- OPT_BOOL(0, "check-oids", &opts.check_oids,
165
- N_("require OIDs to be commits")),
163
OPT_INTEGER(0, "max-commits", &split_opts.max_commits,
164
N_("maximum number of commits in a non-base split commit-graph")),
165
OPT_INTEGER(0, "size-multiple", &split_opts.size_multiple,
@@ -173,7 +170,6 @@ static int graph_write(int argc, const char **argv)
170
};
171
172
opts.progress = isatty(2);
176
- opts.check_oids = 1;
173
split_opts.size_multiple = 2;
174
split_opts.max_commits = 0;
175
split_opts.expire_time = 0;
@@ -228,8 +224,7 @@ static int graph_write(int argc, const char **argv)
224
225
oidset_insert(&commits, &oid);
226
}
231
- if (opts.check_oids)
232
- flags |= COMMIT_GRAPH_WRITE_CHECK_OIDS;
227
+ flags |= COMMIT_GRAPH_WRITE_CHECK_OIDS;
228
}
229
230
UNLEAK(buf);
commit-graph.c
+1
-1
@@ -145,7 +145,7 @@ static int verify_commit_graph_lite(struct commit_graph *g)
145
*
146
* There should only be very basic checks here to ensure that
147
* 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
149
* over g->num_commits, or runs a checksum on the commit-graph
150
* itself.
151
*/
t/t5318-commit-graph.sh
-28
@@ -49,34 +49,6 @@ test_expect_success 'exit with correct error on bad input to --stdin-commits' '
49
test_i18ngrep "invalid commit object id" stderr
50
'
51
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
-
52
graph_git_two_modes() {
53
git -c core.commitGraph=true $1 >output
54
git -c core.commitGraph=false $1 >expect