diff options
| author | Christian Hesse | 2016-10-11 08:55:34 +0200 |
|---|---|---|
| committer | Jason A. Donenfeld | 2016-10-12 14:13:10 +0200 |
| commit | c330a2e5f86e1f77d3b724877935e11014cefa21 (patch) | |
| tree | 3d59a0bb69c7a65c537abbafe23c7afa9d78746e /ui-blob.c | |
| parent | 2d59e6a64e9869cc8420cb532af29a9eba867004 (diff) | |
| download | cgit-c330a2e5f86e1f77d3b724877935e11014cefa21.tar.gz cgit-c330a2e5f86e1f77d3b724877935e11014cefa21.tar.bz2 cgit-c330a2e5f86e1f77d3b724877935e11014cefa21.zip | |
ui-blog: fix oid handling
We have to use a pointer for walk_tree_ctx->matched_oid.
This fixes faulty commit 6e4b7b6776eb994e795fa38b2619db6c55e10ecc
(ui-blob: replace 'unsigned char sha1[20]' with 'struct object_id oid').
Diffstat (limited to 'ui-blob.c')
| -rw-r--r-- | ui-blob.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -13,7 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | struct walk_tree_context { | 14 | struct walk_tree_context { |
| 15 | const char *match_path; | 15 | const char *match_path; |
| 16 | struct object_id matched_oid; | 16 | struct object_id *matched_oid; |
| 17 | unsigned int found_path:1; | 17 | unsigned int found_path:1; |
| 18 | unsigned int file_only:1; | 18 | unsigned int file_only:1; |
| 19 | }; | 19 | }; |
| @@ -28,7 +28,7 @@ static int walk_tree(const unsigned char *sha1, struct strbuf *base, | |||
| 28 | if (strncmp(base->buf, walk_tree_ctx->match_path, base->len) | 28 | if (strncmp(base->buf, walk_tree_ctx->match_path, base->len) |
| 29 | || strcmp(walk_tree_ctx->match_path + base->len, pathname)) | 29 | || strcmp(walk_tree_ctx->match_path + base->len, pathname)) |
| 30 | return READ_TREE_RECURSIVE; | 30 | return READ_TREE_RECURSIVE; |
| 31 | hashcpy(walk_tree_ctx->matched_oid.hash, sha1); | 31 | hashcpy(walk_tree_ctx->matched_oid->hash, sha1); |
| 32 | walk_tree_ctx->found_path = 1; | 32 | walk_tree_ctx->found_path = 1; |
| 33 | return 0; | 33 | return 0; |
| 34 | } | 34 | } |
| @@ -47,7 +47,7 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only) | |||
| 47 | }; | 47 | }; |
| 48 | struct walk_tree_context walk_tree_ctx = { | 48 | struct walk_tree_context walk_tree_ctx = { |
| 49 | .match_path = path, | 49 | .match_path = path, |
| 50 | .matched_oid = oid, | 50 | .matched_oid = &oid, |
| 51 | .found_path = 0, | 51 | .found_path = 0, |
| 52 | .file_only = file_only | 52 | .file_only = file_only |
| 53 | }; | 53 | }; |
| @@ -77,7 +77,7 @@ int cgit_print_file(char *path, const char *head, int file_only) | |||
| 77 | }; | 77 | }; |
| 78 | struct walk_tree_context walk_tree_ctx = { | 78 | struct walk_tree_context walk_tree_ctx = { |
| 79 | .match_path = path, | 79 | .match_path = path, |
| 80 | .matched_oid = oid, | 80 | .matched_oid = &oid, |
| 81 | .found_path = 0, | 81 | .found_path = 0, |
| 82 | .file_only = file_only | 82 | .file_only = file_only |
| 83 | }; | 83 | }; |
| @@ -120,7 +120,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl | |||
| 120 | }; | 120 | }; |
| 121 | struct walk_tree_context walk_tree_ctx = { | 121 | struct walk_tree_context walk_tree_ctx = { |
| 122 | .match_path = path, | 122 | .match_path = path, |
| 123 | .matched_oid = oid, | 123 | .matched_oid = &oid, |
| 124 | .found_path = 0, | 124 | .found_path = 0, |
| 125 | .file_only = file_only | 125 | .file_only = file_only |
| 126 | }; | 126 | }; |
