Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-10-12 17:30:49 +0300
committerJunio C Hamano <gitster@pobox.com>2021-10-12 21:16:59 +0300
commit4ef91a2d795c424eda2bec1bfbbd0c813bcc978a (patch)
tree964cf0dbd008401d8e9a265da7556608ac14ec6f /object-store.h
parent119b26d6b9a98fd22bbd340da39cf15d4712fb97 (diff)
commit: fix duplication regression in permission error output
Fix a regression in the error output emitted when .git/objects can't be written to. Before 9c4d6c0297b (cache-tree: Write updated cache-tree after commit, 2014-07-13) we'd emit only one "insufficient permission" error, now we'll do so again. The cause is rather straightforward, we've got WRITE_TREE_SILENT for the use-case of wanting to prepare an index silently, quieting any permission etc. error output. Then when we attempt to update to that (possibly broken) index we'll run into the same errors again. But with 9c4d6c0297b the gap between the cache-tree API and the object store wasn't closed in terms of asking write_object_file() to be silent. I.e. post-9c4d6c0297b the first call is to prepare_index(), and after that we'll call prepare_to_commit(). We only want verbose error output from the latter. So let's add and use that facility with a corresponding HASH_SILENT flag, its only user is cache-tree.c's update_one(), which will set it if its "WRITE_TREE_SILENT" flag is set. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-store.h')
-rw-r--r--object-store.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/object-store.h b/object-store.h
index d24915ced1..8bd4c788a7 100644
--- a/object-store.h
+++ b/object-store.h
@@ -222,8 +222,14 @@ int hash_object_file(const struct git_hash_algo *algo, const void *buf,
unsigned long len, const char *type,
struct object_id *oid);
-int write_object_file(const void *buf, unsigned long len,
- const char *type, struct object_id *oid);
+int write_object_file_flags(const void *buf, unsigned long len,
+ const char *type, struct object_id *oid,
+ unsigned flags);
+static inline int write_object_file(const void *buf, unsigned long len,
+ const char *type, struct object_id *oid)
+{
+ return write_object_file_flags(buf, len, type, oid, 0);
+}
int hash_object_file_literally(const void *buf, unsigned long len,
const char *type, struct object_id *oid,