git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/6] odb: rename `odb_write_object()` flags

From
Patrick Steinhardt <ps@pks.im>
Date
Mar 31, 2026, 23:57 UTC
Message-ID
<20260401-pks-odb-cleanups-v1-3-89adba9ada68@pks.im>
In-Reply-To
<20260401-pks-odb-cleanups-v1-0-89adba9ada68@pks.im>

Rename `odb_write_object()` flags to be properly prefixed with the function name.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 cache-tree.c  | 2 +-
 object-file.c | 4 ++--
 odb.h         | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/cache-tree.c b/cache-tree.c
index 60bcc07c3b..60059edfb0 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -456,7 +456,7 @@ static int update_one(struct cache_tree *it,
 		hash_object_file(the_hash_algo, buffer.buf, buffer.len,
 				 OBJ_TREE, &it->oid);
 	} else if (odb_write_object_ext(the_repository->objects, buffer.buf, buffer.len, OBJ_TREE,
-					&it->oid, NULL, flags & WRITE_TREE_SILENT ? WRITE_OBJECT_SILENT : 0)) {
+					&it->oid, NULL, flags & WRITE_TREE_SILENT ? ODB_WRITE_OBJECT_SILENT : 0)) {
 		strbuf_release(&buffer);
 		return -1;
 	}
diff --git a/object-file.c b/object-file.c
index 4f77ce0982..db1a420ab6 100644
--- a/object-file.c
+++ b/object-file.c
@@ -909,7 +909,7 @@ static int start_loose_object_common(struct odb_source *source,
 
 	fd = create_tmpfile(source->odb->repo, tmp_file, filename);
 	if (fd < 0) {
-		if (flags & WRITE_OBJECT_SILENT)
+		if (flags & ODB_WRITE_OBJECT_SILENT)
 			return -1;
 		else if (errno == EACCES)
 			return error(_("insufficient permission for adding "
@@ -1042,7 +1042,7 @@ static int write_loose_object(struct odb_source *source,
 		utb.actime = mtime;
 		utb.modtime = mtime;
 		if (utime(tmp_file.buf, &utb) < 0 &&
-		    !(flags & WRITE_OBJECT_SILENT))
+		    !(flags & ODB_WRITE_OBJECT_SILENT))
 			warning_errno(_("failed utime() on %s"), tmp_file.buf);
 	}
 
diff --git a/odb.h b/odb.h
index 09affaf6a5..083c25609e 100644
--- a/odb.h
+++ b/odb.h
@@ -568,12 +568,12 @@ enum {
 	 * changes that so that the object will be written as a loose object
 	 * and persisted.
 	 */
-	WRITE_OBJECT_PERSIST = (1 << 0),
+	ODB_WRITE_OBJECT_PERSIST = (1 << 0),
 
 	/*
 	 * Do not print an error in case something goes wrong.
 	 */
-	WRITE_OBJECT_SILENT = (1 << 1),
+	ODB_WRITE_OBJECT_SILENT = (1 << 1),
 };
 
 /*
-- 
2.53.0.1185.g05d4b7b318.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 4 of 7 in “odb: small set of cleanups”
  1. 0/6 odb: small set of cleanupsPatrick Steinhardt, Mar 31, 2026
  2. 1/6 CodingGuidelines: document our style for flagsPatrick Steinhardt, Mar 31, 2026
  3. 2/6 treewide: use enum for `odb_for_each_object()` flagsPatrick Steinhardt, Mar 31, 2026
  4. 3/6 odb: rename `odb_write_object()` flagsPatrick Steinhardt, Mar 31, 2026
  5. 4/6 odb: use enum for `odb_write_object` flagsPatrick Steinhardt, Mar 31, 2026
  6. 5/6 odb: rename `odb_has_object()` flagsPatrick Steinhardt, Mar 31, 2026
  7. 6/6 odb: drop unneeded headers and forward declsPatrick Steinhardt, Mar 31, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.