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

[PATCH 4/5] Export some more functions to enable resetting the git state

From
CTChristian Thaeter <ct@pipapo.org>
Date
Jan 7, 2008, 05:47 UTC
Message-ID
<1199684855-14246-4-git-send-email-ct@pipapo.org>
In-Reply-To
<1199684855-14246-3-git-send-email-ct@pipapo.org>
This declares the functions added by the former 2 commits as 'extern'.

Further invalidate_cached_refs() got renamed to git_invalidate_cached_refs() and is exported too.

Signed-off-by: Christian Thaeter <ct@pipapo.org>
---
 cache.h |    3 +++
 refs.c  |    6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/cache.h b/cache.h
index 39331c2..4352d08 100644
--- a/cache.h
+++ b/cache.h
@@ -224,7 +224,9 @@ extern char *get_refs_directory(void);
 extern char *get_index_file(void);
 extern char *get_graft_file(void);
 extern int set_git_dir(const char *path);
+extern void reset_git_work_tree(void);
 extern const char *get_git_work_tree(void);
+extern void git_invalidate_cached_refs(void);
 
 #define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
 
@@ -553,6 +555,7 @@ extern struct packed_git *parse_pack_index_file(const unsigned char *sha1,
 
 extern void prepare_packed_git(void);
 extern void reprepare_packed_git(void);
+extern void reset_packed_git(void);
 extern void install_packed_git(struct packed_git *pack);
 
 extern struct packed_git *find_sha1_pack(const unsigned char *sha1,
diff --git a/refs.c b/refs.c
index 58f6d17..900cc5d 100644
--- a/refs.c
+++ b/refs.c
@@ -167,7 +167,7 @@ static void free_ref_list(struct ref_list *list)
 	}
 }
 
-static void invalidate_cached_refs(void)
+void git_invalidate_cached_refs(void)
 {
 	struct cached_refs *ca = &cached_refs;
 
@@ -898,7 +898,7 @@ int delete_ref(const char *refname, const unsigned char *sha1)
 	if (err && errno != ENOENT)
 		fprintf(stderr, "warning: unlink(%s) failed: %s",
 			git_path("logs/%s", lock->ref_name), strerror(errno));
-	invalidate_cached_refs();
+	git_invalidate_cached_refs();
 	unlock_ref(lock);
 	return ret;
 }
@@ -1137,7 +1137,7 @@ int write_ref_sha1(struct ref_lock *lock,
 		unlock_ref(lock);
 		return -1;
 	}
-	invalidate_cached_refs();
+	git_invalidate_cached_refs();
 	if (log_ref_write(lock->ref_name, lock->old_sha1, sha1, logmsg) < 0 ||
 	    (strcmp(lock->ref_name, lock->orig_ref_name) &&
 	     log_ref_write(lock->orig_ref_name, lock->old_sha1, sha1, logmsg) < 0)) {
-- 
1.5.3.7
Previous: Christian ThaeterNext: Christian Thaeter
Message 4 of 8 in “Add streq() to compat-util”
  1. 1/5 Add streq() to compat-utilChristian Thaeter, Jan 7, 2008
  2. 2/5 First step, making setup (somewhat) reentrantChristian Thaeter, Jan 7, 2008
  3. 3/5 provide a reset_packed_git() functionChristian Thaeter, Jan 7, 2008
  4. 4/5 Export some more functions to enable resetting the git stateChristian Thaeter, Jan 7, 2008
  5. 5/5 Make setup_git_directory reentrantChristian Thaeter, Jan 7, 2008
  6. Johannes SchindelinJan 7, 2008
  7. Junio C HamanoJan 7, 2008
  8. Johannes SchindelinJan 7, 2008

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.