run-command: add hint when a hook is ignored
[gitweb.git] / diff-lib.c
index c82b07dc1eb47b439bd56f50fb4d07cc8218d22a..4e0980caa80fb980938f68c8d350ec00cc24398b 100644 (file)
@@ -29,7 +29,7 @@
 static int check_removed(const struct cache_entry *ce, struct stat *st)
 {
        if (lstat(ce->name, st) < 0) {
-               if (errno != ENOENT && errno != ENOTDIR)
+               if (!is_missing_file_error(errno))
                        return -1;
                return 1;
        }
@@ -179,8 +179,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                                free(dpath);
                                continue;
                        }
-                       free(dpath);
-                       dpath = NULL;
+                       FREE_AND_NULL(dpath);
 
                        /*
                         * Show the diff for the 'ce' if we found the one
@@ -236,7 +235,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                old_oid = &ce->oid;
                new_oid = changed ? &null_oid : &ce->oid;
                diff_change(&revs->diffopt, oldmode, newmode,
-                           old_oid->hash, new_oid->hash,
+                           old_oid, new_oid,
                            !is_null_oid(old_oid),
                            !is_null_oid(new_oid),
                            ce->name, 0, dirty_submodule);
@@ -367,7 +366,7 @@ static int show_modified(struct rev_info *revs,
                return 0;
 
        diff_change(&revs->diffopt, oldmode, mode,
-                   old->oid.hash, oid->hash, 1, !is_null_oid(oid),
+                   &old->oid, oid, 1, !is_null_oid(oid),
                    old->name, 0, dirty_submodule);
        return 0;
 }
@@ -409,7 +408,7 @@ static void do_oneway_diff(struct unpack_trees_options *o,
                struct diff_filepair *pair;
                pair = diff_unmerge(&revs->diffopt, idx->name);
                if (tree)
-                       fill_filespec(pair->one, tree->oid.hash, 1,
+                       fill_filespec(pair->one, &tree->oid, 1,
                                      tree->ce_mode);
                return;
        }
@@ -550,7 +549,6 @@ int index_differs_from(const char *def, int diff_flags,
        rev.diffopt.flags |= diff_flags;
        rev.diffopt.ita_invisible_in_index = ita_invisible_in_index;
        run_diff_index(&rev, 1);
-       if (rev.pending.alloc)
-               free(rev.pending.objects);
+       object_array_clear(&rev.pending);
        return (DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES) != 0);
 }