struct cache_entry *ce;
ce = index_file_exists(state->repo->index, name->buf,
- name->len, ignore_case);
+ name->len, repo_ignore_case(the_repository));
if (ce && S_ISLNK(ce->ce_mode))
return 1;
} else {
{
struct ref_rejection_data *data = cb_data;
- if (err == REF_TRANSACTION_ERROR_CASE_CONFLICT && ignore_case &&
+ if (err == REF_TRANSACTION_ERROR_CASE_CONFLICT && repo_ignore_case(the_repository) &&
!data->case_sensitive_msg_shown) {
error(_("You're on a case-insensitive filesystem, and the remote you are\n"
"trying to fetch from has references that only differ in casing. It\n"
goto act_on_entry;
}
if (lstat(dst, &st) == 0 &&
- (!ignore_case || strcasecmp(src, dst))) {
+ (!repo_ignore_case(the_repository) || strcasecmp(src, dst))) {
bad = _("destination exists");
if (force) {
/*
#include "../../git-compat-util.h"
#include "../../environment.h"
+#include "../../repository.h"
int win32_has_dos_drive_prefix(const char *path)
{
} else if (is_dir_sep(*b))
return +1;
- diff = ignore_case ?
+ diff = repo_ignore_case(the_repository) ?
(unsigned char)tolower(*a) - (int)(unsigned char)tolower(*b) :
(unsigned char)*a - (int)(unsigned char)*b;
if (diff)
int git_fspathcmp(const char *a, const char *b)
{
- return ignore_case ? strcasecmp(a, b) : strcmp(a, b);
+ return repo_ignore_case(the_repository) ? strcasecmp(a, b) : strcmp(a, b);
}
int fspatheq(const char *a, const char *b)
int git_fspathncmp(const char *a, const char *b, size_t count)
{
- return ignore_case ? strncasecmp(a, b, count) : strncmp(a, b, count);
+ return repo_ignore_case(the_repository) ? strncasecmp(a, b, count) : strncmp(a, b, count);
}
int paths_collide(const char *a, const char *b)
unsigned int fspathhash(const char *str)
{
- return ignore_case ? strihash(str) : strhash(str);
+ return repo_ignore_case(the_repository) ? strihash(str) : strhash(str);
}
int git_fnmatch(const struct pathspec_item *item,
use_str = str_buf.buf;
}
- if (ignore_case)
+ if (repo_ignore_case(the_repository))
flags |= WM_CASEFOLD;
match_status = wildmatch(use_pat, use_str, flags);
struct index_state *istate,
const char *pathname, int len)
{
- if (index_file_exists(istate, pathname, len, ignore_case))
+ if (index_file_exists(istate, pathname, len, repo_ignore_case(the_repository)))
return NULL;
ALLOC_GROW(dir->entries, dir->nr+1, dir->internal.alloc);
if (index_dir_exists(istate, dirname, len))
return index_directory;
- ce = index_file_exists(istate, dirname, len, ignore_case);
+ ce = index_file_exists(istate, dirname, len, repo_ignore_case(the_repository));
if (ce && S_ISGITLINK(ce->ce_mode))
return index_gitdir;
{
int pos;
- if (ignore_case)
+ if (repo_ignore_case(the_repository))
return directory_exists_in_index_icase(istate, dirname, len);
pos = index_name_pos(istate, dirname, len);
/* Always exclude indexed files */
has_path_in_index = !!index_file_exists(istate, path->buf, path->len,
- ignore_case);
+ repo_ignore_case(the_repository));
if (dtype != DT_DIR && has_path_in_index)
return path_none;
{
if (a == b)
return 0;
- if (ignore_case)
+ if (repo_ignore_case(the_repository))
return toupper(a) - toupper(b);
return a - b;
}
int check_stat = 1;
int has_symlinks = 1;
int minimum_abbrev = 4, default_abbrev = -1;
-int ignore_case;
int assume_unchanged;
int is_bare_repository_cfg = -1; /* unspecified */
int warn_on_object_refname_ambiguity = 1;
}
if (!strcmp(var, "core.ignorecase")) {
- ignore_case = git_config_bool(var, value);
+ cfg->ignore_case = git_config_bool(var, value);
return 0;
}
extern int check_stat;
extern int has_symlinks;
extern int minimum_abbrev, default_abbrev;
-extern int ignore_case;
extern int assume_unchanged;
extern int warn_on_object_refname_ambiguity;
extern char *apply_default_whitespace;
* case-insensitive file system, try again using the name-hash
* and dir-name-hash.
*/
- if (!nr_in_cone && ignore_case) {
+ if (!nr_in_cone && repo_ignore_case(the_repository)) {
nr_in_cone = handle_using_name_hash_icase(istate, name);
if (!nr_in_cone)
nr_in_cone = handle_using_dir_name_hash_icase(
hashmap_add(&istate->name_hash, &ce->ent);
}
- if (ignore_case)
+ if (repo_ignore_case(the_repository))
add_dir_entry(istate, ce);
}
* code to build the "istate->name_hash". We don't
* need the complexity here.
*/
- if (!ignore_case)
+ if (!repo_ignore_case(the_repository))
return 0;
nr_cpus = online_cpus();
ce->ce_flags &= ~CE_HASHED;
hashmap_remove(&istate->name_hash, &ce->ent, ce);
- if (ignore_case)
+ if (repo_ignore_case(the_repository))
remove_dir_entry(istate, ce);
}
* case of the file being added to the repository matches (is folded into) the existing
* entry's directory case.
*/
- if (ignore_case) {
+ if (repo_ignore_case(the_repository)) {
adjust_dirname_case(istate, ce->name);
}
if (!(flags & ADD_CACHE_RENORMALIZE)) {
alias = index_file_exists(istate, ce->name,
- ce_namelen(ce), ignore_case);
+ ce_namelen(ce), repo_ignore_case(the_repository));
if (alias &&
!ce_stage(alias) &&
!ie_match_stat(istate, alias, st, ce_option)) {
} else
set_object_name_for_intent_to_add_entry(ce);
- if (ignore_case && alias && different_name(ce, alias))
+ if (repo_ignore_case(the_repository) && alias && different_name(ce, alias))
ce = create_alias_ce(istate, ce, alias);
ce->ce_flags |= CE_ADDED;
} else {
unable_to_lock_message(ref_file.buf, myerr, err);
if (myerr == EEXIST) {
- if (ignore_case &&
+ if (repo_ignore_case(the_repository) &&
transaction_has_case_conflicting_update(transaction, update)) {
/*
* In case-insensitive filesystems, ensure that conflicts within a
* conflicts between 'foo' and 'Foo/bar'. So let's lowercase
* the refname.
*/
- if (ignore_case) {
+ if (repo_ignore_case(the_repository)) {
struct strbuf lower = STRBUF_INIT;
strbuf_addstr(&lower, refname);
/* Prevent conflicts on case-folding filesystems */
repo_config_get_bool(the_repository, "core.ignorecase", &config_ignorecase);
- if (ignore_case || config_ignorecase) {
+ if (repo_ignore_case(the_repository) || config_ignorecase) {
bool suffixes_match = !strcmp(last_submodule_name, submodule_name);
return check_casefolding_conflict(git_dir, submodule_name,
suffixes_match);
/*
* istate->dir_hash is only created when ignore_case is set.
*/
- ignore_case = 1;
+ repo_config_values(the_repository)->ignore_case = 1;
if (dump) {
if (perf || analyze > 0)
*
* Ignore that lstat() if it matches.
*/
- if (ignore_case && icase_exists(o, name, len, st))
+ if (repo_ignore_case(the_repository) && icase_exists(o, name, len, st))
return 0;
if (o->internal.dir &&