Skip to content

Commit 5f2e994

Browse files
pks-tgitster
authored andcommitted
object-file: get rid of the_repository in index-related functions
Both `index_fd()` and `index_path()` still use `the_repository` even though they have a repository available via `struct index_state`. Adapt them so that they use the index' repository instead to get rid of this global dependency. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c2b5d14 commit 5f2e994

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

object-file.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ int index_fd(struct index_state *istate, struct object_id *oid,
12571257
ret = index_stream_convert_blob(istate, oid, fd, path, flags);
12581258
else if (!S_ISREG(st->st_mode))
12591259
ret = index_pipe(istate, oid, fd, type, path, flags);
1260-
else if ((st->st_size >= 0 && (size_t) st->st_size <= repo_settings_get_big_file_threshold(the_repository)) ||
1260+
else if ((st->st_size >= 0 && (size_t) st->st_size <= repo_settings_get_big_file_threshold(istate->repo)) ||
12611261
type != OBJ_BLOB ||
12621262
(path && would_convert_to_git(istate, path)))
12631263
ret = index_core(istate, oid, fd, xsize_t(st->st_size),
@@ -1291,12 +1291,12 @@ int index_path(struct index_state *istate, struct object_id *oid,
12911291
if (!(flags & INDEX_WRITE_OBJECT))
12921292
hash_object_file(istate->repo->hash_algo, sb.buf, sb.len,
12931293
OBJ_BLOB, oid);
1294-
else if (odb_write_object(the_repository->objects, sb.buf, sb.len, OBJ_BLOB, oid))
1294+
else if (odb_write_object(istate->repo->objects, sb.buf, sb.len, OBJ_BLOB, oid))
12951295
rc = error(_("%s: failed to insert into database"), path);
12961296
strbuf_release(&sb);
12971297
break;
12981298
case S_IFDIR:
1299-
return repo_resolve_gitlink_ref(the_repository, path, "HEAD", oid);
1299+
return repo_resolve_gitlink_ref(istate->repo, path, "HEAD", oid);
13001300
default:
13011301
return error(_("%s: unsupported file type"), path);
13021302
}

0 commit comments

Comments
 (0)