Skip to content

Commit a470bee

Browse files
pcloudsgitster
authored andcommitted
blame.c: rename "repo" argument to "r"
The current naming convention for 'struct repository *' is 'r' for temporary variables or arguments. I did not notice this. Since we're updating blame.c again in the next patch, let's fix this. Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0734f20 commit a470bee

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

blame.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static struct blame_origin *get_origin(struct commit *commit, const char *path)
9090

9191

9292

93-
static void verify_working_tree_path(struct repository *repo,
93+
static void verify_working_tree_path(struct repository *r,
9494
struct commit *work_tree, const char *path)
9595
{
9696
struct commit_list *parents;
@@ -102,15 +102,15 @@ static void verify_working_tree_path(struct repository *repo,
102102
unsigned mode;
103103

104104
if (!get_tree_entry(commit_oid, path, &blob_oid, &mode) &&
105-
oid_object_info(repo, &blob_oid, NULL) == OBJ_BLOB)
105+
oid_object_info(r, &blob_oid, NULL) == OBJ_BLOB)
106106
return;
107107
}
108108

109-
pos = index_name_pos(repo->index, path, strlen(path));
109+
pos = index_name_pos(r->index, path, strlen(path));
110110
if (pos >= 0)
111111
; /* path is in the index */
112-
else if (-1 - pos < repo->index->cache_nr &&
113-
!strcmp(repo->index->cache[-1 - pos]->name, path))
112+
else if (-1 - pos < r->index->cache_nr &&
113+
!strcmp(r->index->cache[-1 - pos]->name, path))
114114
; /* path is in the index, unmerged */
115115
else
116116
die("no such path '%s' in HEAD", path);
@@ -166,7 +166,7 @@ static void set_commit_buffer_from_strbuf(struct commit *c, struct strbuf *sb)
166166
* Prepare a dummy commit that represents the work tree (or staged) item.
167167
* Note that annotating work tree item never works in the reverse.
168168
*/
169-
static struct commit *fake_working_tree_commit(struct repository *repo,
169+
static struct commit *fake_working_tree_commit(struct repository *r,
170170
struct diff_options *opt,
171171
const char *path,
172172
const char *contents_from)
@@ -183,7 +183,7 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
183183
unsigned mode;
184184
struct strbuf msg = STRBUF_INIT;
185185

186-
read_index(repo->index);
186+
read_index(r->index);
187187
time(&now);
188188
commit = alloc_commit_node(the_repository);
189189
commit->object.parsed = 1;
@@ -195,7 +195,7 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
195195

196196
parent_tail = append_parent(parent_tail, &head_oid);
197197
append_merge_parents(parent_tail);
198-
verify_working_tree_path(repo, commit, path);
198+
verify_working_tree_path(r, commit, path);
199199

200200
origin = make_origin(commit, path);
201201

@@ -253,7 +253,7 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
253253
if (strbuf_read(&buf, 0, 0) < 0)
254254
die_errno("failed to read from stdin");
255255
}
256-
convert_to_git(repo->index, path, buf.buf, buf.len, &buf, 0);
256+
convert_to_git(r->index, path, buf.buf, buf.len, &buf, 0);
257257
origin->file.ptr = buf.buf;
258258
origin->file.size = buf.len;
259259
pretend_object_file(buf.buf, buf.len, OBJ_BLOB, &origin->blob_oid);
@@ -264,28 +264,28 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
264264
* bits; we are not going to write this index out -- we just
265265
* want to run "diff-index --cached".
266266
*/
267-
discard_index(repo->index);
268-
read_index(repo->index);
267+
discard_index(r->index);
268+
read_index(r->index);
269269

270270
len = strlen(path);
271271
if (!mode) {
272-
int pos = index_name_pos(repo->index, path, len);
272+
int pos = index_name_pos(r->index, path, len);
273273
if (0 <= pos)
274-
mode = repo->index->cache[pos]->ce_mode;
274+
mode = r->index->cache[pos]->ce_mode;
275275
else
276276
/* Let's not bother reading from HEAD tree */
277277
mode = S_IFREG | 0644;
278278
}
279-
ce = make_empty_cache_entry(repo->index, len);
279+
ce = make_empty_cache_entry(r->index, len);
280280
oidcpy(&ce->oid, &origin->blob_oid);
281281
memcpy(ce->name, path, len);
282282
ce->ce_flags = create_ce_flags(0);
283283
ce->ce_namelen = len;
284284
ce->ce_mode = create_ce_mode(mode);
285-
add_index_entry(repo->index, ce,
285+
add_index_entry(r->index, ce,
286286
ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE);
287287

288-
cache_tree_invalidate_path(repo->index, path);
288+
cache_tree_invalidate_path(r->index, path);
289289

290290
return commit;
291291
}
@@ -520,14 +520,14 @@ static void queue_blames(struct blame_scoreboard *sb, struct blame_origin *porig
520520
*
521521
* This also fills origin->mode for corresponding tree path.
522522
*/
523-
static int fill_blob_sha1_and_mode(struct repository *repo,
523+
static int fill_blob_sha1_and_mode(struct repository *r,
524524
struct blame_origin *origin)
525525
{
526526
if (!is_null_oid(&origin->blob_oid))
527527
return 0;
528528
if (get_tree_entry(&origin->commit->object.oid, origin->path, &origin->blob_oid, &origin->mode))
529529
goto error_out;
530-
if (oid_object_info(repo, &origin->blob_oid, NULL) != OBJ_BLOB)
530+
if (oid_object_info(r, &origin->blob_oid, NULL) != OBJ_BLOB)
531531
goto error_out;
532532
return 0;
533533
error_out:

0 commit comments

Comments
 (0)