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

[PATCH v2 1/4] commit: make 'commit_graft_pos' non-static

From
Taylor Blau <me@ttaylorr.com>
Date
Apr 30, 2020, 19:48 UTC
Message-ID
<cb8dde2ae2e78d0bcfb61382fe7769c12804336b.1588275891.git.me@ttaylorr.com>
In-Reply-To
<cover.1588275891.git.me@ttaylorr.com>

In the next patch, some functions will be moved from 'commit.c' to have prototypes in a new 'shallow.h' and their implementations in 'shallow.c'.

Three functions in 'commit.c' use 'commit_graft_pos()' (they are 'register_commit_graft()', 'lookup_commit_graft()', and 'unregister_shallow()'). The first two of these will stay in 'commit.c', but the latter will move to 'shallow.c', and thus needs 'commit_graft_pos' to be non-static.

Prepare for that by making 'commit_graft_pos' non-static so that it can be called from both 'commit.c' and 'shallow.c'.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 commit.c | 2 +-
 commit.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/commit.c b/commit.c
index c7099daeac..b76f7d72be 100644
--- a/commit.c
+++ b/commit.c
@@ -110,7 +110,7 @@ static const unsigned char *commit_graft_sha1_access(size_t index, void *table)
 	return commit_graft_table[index]->oid.hash;
 }
 
-static int commit_graft_pos(struct repository *r, const unsigned char *sha1)
+int commit_graft_pos(struct repository *r, const unsigned char *sha1)
 {
 	return sha1_pos(sha1, r->parsed_objects->grafts,
 			r->parsed_objects->grafts_nr,
diff --git a/commit.h b/commit.h
index ab91d21131..eb42e8b6d2 100644
--- a/commit.h
+++ b/commit.h
@@ -236,6 +236,7 @@ struct commit_graft {
 typedef int (*each_commit_graft_fn)(const struct commit_graft *, void *);
 
 struct commit_graft *read_graft_line(struct strbuf *line);
+int commit_graft_pos(struct repository *r, const unsigned char *sha1);
 int register_commit_graft(struct repository *r, struct commit_graft *, int);
 void prepare_commit_graft(struct repository *r);
 struct commit_graft *lookup_commit_graft(struct repository *r, const struct object_id *oid);
-- 
2.26.0.113.ge9739cdccc
Previous: Taylor BlauNext: Junio C Hamano
Message 2 of 8 in “shallow: extract a header file”
  1. 0/4 shallow: extract a header fileTaylor Blau, Apr 30, 2020
  2. 1/4 commit: make 'commit_graft_pos' non-staticTaylor Blau, Apr 30, 2020
  3. Junio C HamanoApr 30, 2020
  4. Taylor BlauApr 30, 2020
  5. 2/4 shallow: extract a header file for shallow-related functionsTaylor Blau, Apr 30, 2020
  6. 3/4 shallow.h: document '{commit,rollback}_shallow_file'Taylor Blau, Apr 30, 2020
  7. 4/4 shallow: use struct 'shallow_lock' for additional safetyTaylor Blau, Apr 30, 2020
  8. Taylor BlauApr 30, 2020

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.