environment: drop redundant NULL checks in config getters
These repository config getters require a valid repository pointer. While an uninitialized repository is a valid state and is handled by returning default values, passing NULL is a programming error. Drop the NULL checks so that invalid callers are not silently accepted. Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Ayush Chandekar <ayu.chandekar@gmail.com> Mentored-by: Olamide Caleb Bello <belkid98@gmail.com> Signed-off-by: Tian Yuchen <cat@malon.dev> Signed-off-by: Junio C Hamano <gitster@pobox.com>seen
parent
2c78326f81
commit
862564c961
|
|
@ -119,23 +119,23 @@ int is_bare_repository(struct repository *repo)
|
|||
|
||||
int repo_protect_ntfs(struct repository *repo)
|
||||
{
|
||||
return (repo && repo->initialized) ?
|
||||
repo_config_values(repo)->protect_ntfs :
|
||||
PROTECT_NTFS_DEFAULT;
|
||||
return repo->initialized
|
||||
? repo_config_values(repo)->protect_ntfs
|
||||
: PROTECT_NTFS_DEFAULT;
|
||||
}
|
||||
|
||||
int repo_protect_hfs(struct repository *repo)
|
||||
{
|
||||
return (repo && repo->initialized) ?
|
||||
repo_config_values(repo)->protect_hfs :
|
||||
PROTECT_HFS_DEFAULT;
|
||||
return repo->initialized
|
||||
? repo_config_values(repo)->protect_hfs
|
||||
: PROTECT_HFS_DEFAULT;
|
||||
}
|
||||
|
||||
int repo_ignore_case(struct repository *repo)
|
||||
{
|
||||
return (repo && repo->initialized) ?
|
||||
repo_config_values(repo)->ignore_case :
|
||||
0;
|
||||
return repo->initialized
|
||||
? repo_config_values(repo)->ignore_case
|
||||
: 0;
|
||||
}
|
||||
|
||||
int repo_trust_executable_bit(struct repository *repo)
|
||||
|
|
|
|||
Loading…
Reference in New Issue