Merge branch 'nd/clone-case-smashing-warning'
[gitweb.git] / dir.c
diff --git a/dir.c b/dir.c
index 995b8e32616055cdb228d30e3e82e9d70d24512e..ab6477d777e96cb9789f1c6b3220af349731a701 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -281,8 +281,15 @@ static int match_attrs(const struct index_state *istate,
                       const struct pathspec_item *item)
 {
        int i;
+       char *to_free = NULL;
+
+       if (name[namelen])
+               name = to_free = xmemdupz(name, namelen);
 
        git_check_attr(istate, name, item->attr_check);
+
+       free(to_free);
+
        for (i = 0; i < item->attr_match_nr; i++) {
                const char *value;
                int matched;
@@ -1282,7 +1289,7 @@ static void prep_exclude(struct dir_struct *dir,
                 * order, though, if you do that.
                 */
                if (untracked &&
-                   oidcmp(&oid_stat.oid, &untracked->exclude_oid)) {
+                   !oideq(&oid_stat.oid, &untracked->exclude_oid)) {
                        invalidate_gitignore(dir->untracked, untracked);
                        oidcpy(&untracked->exclude_oid, &oid_stat.oid);
                }
@@ -2248,12 +2255,12 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
 
        /* Validate $GIT_DIR/info/exclude and core.excludesfile */
        root = dir->untracked->root;
-       if (oidcmp(&dir->ss_info_exclude.oid,
+       if (!oideq(&dir->ss_info_exclude.oid,
                   &dir->untracked->ss_info_exclude.oid)) {
                invalidate_gitignore(dir->untracked, root);
                dir->untracked->ss_info_exclude = dir->ss_info_exclude;
        }
-       if (oidcmp(&dir->ss_excludes_file.oid,
+       if (!oideq(&dir->ss_excludes_file.oid,
                   &dir->untracked->ss_excludes_file.oid)) {
                invalidate_gitignore(dir->untracked, root);
                dir->untracked->ss_excludes_file = dir->ss_excludes_file;