send-email: check for repo before invoking hook
[gitweb.git] / read-cache.c
index d8c657d6a7faa717be8459cf88de83acc51ddde1..0d0081a11b858227d3f55ebbc21f04bd49875f68 100644 (file)
@@ -1824,9 +1824,10 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
  */
 static void freshen_shared_index(char *base_sha1_hex, int warn)
 {
-       const char *shared_index = git_path("sharedindex.%s", base_sha1_hex);
+       char *shared_index = git_pathdup("sharedindex.%s", base_sha1_hex);
        if (!check_and_freshen_file(shared_index, 1) && warn)
                warning("could not freshen shared index '%s'", shared_index);
+       free(shared_index);
 }
 
 int read_index_from(struct index_state *istate, const char *path)
@@ -2371,7 +2372,7 @@ static int should_delete_shared_index(const char *shared_index_path)
        if (!expiration)
                return 0;
        if (stat(shared_index_path, &st))
-               return error_errno(_("could not stat '%s"), shared_index_path);
+               return error_errno(_("could not stat '%s'"), shared_index_path);
        if (st.st_mtime > expiration)
                return 0;