Commit 8373037
verify-commit: simplify parameters to run_gpg_verify()
The buf/len parameters of run_gpg_verify() have never been used since
the function was added in d07b00b (verify-commit: scriptable commit
signature verification, 2014-06-23). Instead, check_commit_signature()
accesses the commit struct directly.
Worse, we read the whole object just to check its type and do not attach
it to the "struct commit". Meaning we end up loading the object from
disk twice for no good reason.
And to further confuse matters, our type check is comes from what we
read from disk, but we later assume that lookup_commit() will return
non-NULL. This might not be true if some other object previously
referenced the same oid as a non-commit (though this may be impossible
to trigger in practice since we don't generally parse any other objects
in this command).
Instead, let's do our type check by loading the object via
parse_object(). That will attach the buffer to the struct so it can be
used later by check_commit_signature(). And it ensures that
lookup_commit() will return something sane.
And then we can just drop the unused "buf" and "len" parameters
entirely.
Signed-off-by: Jeff King <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent d713e88 commit 8373037
1 file changed
+8
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| |||
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | | - | |
42 | 40 | | |
43 | | - | |
44 | | - | |
45 | | - | |
| 41 | + | |
46 | 42 | | |
47 | 43 | | |
48 | 44 | | |
49 | 45 | | |
50 | | - | |
51 | | - | |
| 46 | + | |
| 47 | + | |
52 | 48 | | |
53 | | - | |
| 49 | + | |
54 | 50 | | |
55 | | - | |
56 | | - | |
57 | | - | |
| 51 | + | |
58 | 52 | | |
59 | | - | |
60 | | - | |
| 53 | + | |
61 | 54 | | |
62 | 55 | | |
63 | 56 | | |
| |||
0 commit comments