git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] refs: remove unused function invalidate_ref_cache
@ 2013-10-26 17:03 Stefan Beller
  2013-10-26 17:03 ` [PATCH 2/2] cache: remove unused function 'have_git_dir' Stefan Beller
  2013-10-27  4:26 ` [PATCH 1/2] refs: remove unused function invalidate_ref_cache Michael Haggerty
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Beller @ 2013-10-26 17:03 UTC (permalink / raw)
  To: git, gitster; +Cc: Stefan Beller

The function 'invalidate_ref_cache' was introduced in 79c7ca5 (2011-10-17,
invalidate_ref_cache(): rename function from invalidate_cached_refs())
by a rename and elevated to be publicly usable in 8be8bde (2011-10-17,
invalidate_ref_cache(): expose this function in the refs API)

However it is not used anymore, as 8bf90dc (2011-10-17, write_ref_sha1():
only invalidate the loose ref cache) and (much) later 506a760 (2013-04-22,
refs: change how packed refs are deleted) removed any calls to this
function. So it seems as if we don't need that function any more,
good bye!

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
---
 refs.c | 7 -------
 refs.h | 8 --------
 2 files changed, 15 deletions(-)

diff --git a/refs.c b/refs.c
index 3710748..f9c1957 100644
--- a/refs.c
+++ b/refs.c
@@ -947,13 +947,6 @@ static struct ref_cache *get_ref_cache(const char *submodule)
 	return refs;
 }
 
-void invalidate_ref_cache(const char *submodule)
-{
-	struct ref_cache *refs = get_ref_cache(submodule);
-	clear_packed_ref_cache(refs);
-	clear_loose_ref_cache(refs);
-}
-
 /* The length of a peeled reference line in packed-refs, including EOL: */
 #define PEELED_LINE_LENGTH 42
 
diff --git a/refs.h b/refs.h
index b113377..87a1a79 100644
--- a/refs.h
+++ b/refs.h
@@ -165,14 +165,6 @@ extern void unlock_ref(struct ref_lock *lock);
 /** Writes sha1 into the ref specified by the lock. **/
 extern int write_ref_sha1(struct ref_lock *lock, const unsigned char *sha1, const char *msg);
 
-/*
- * Invalidate the reference cache for the specified submodule.  Use
- * submodule=NULL to invalidate the cache for the main module.  This
- * function must be called if references are changed via a mechanism
- * other than the refs API.
- */
-extern void invalidate_ref_cache(const char *submodule);
-
 /** Setup reflog before using. **/
 int log_ref_setup(const char *ref_name, char *logfile, int bufsize);
 
-- 
1.8.4.1.605.g23c6912

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] cache: remove unused function 'have_git_dir'
  2013-10-26 17:03 [PATCH 1/2] refs: remove unused function invalidate_ref_cache Stefan Beller
@ 2013-10-26 17:03 ` Stefan Beller
  2013-10-27  4:26 ` [PATCH 1/2] refs: remove unused function invalidate_ref_cache Michael Haggerty
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Beller @ 2013-10-26 17:03 UTC (permalink / raw)
  To: git, gitster; +Cc: Stefan Beller

This function was added in d2b0708 (2008-09-27, add have_git_dir()
function) as a preparation for adbc0b6 (2008-09-30, cygwin: Use native
Win32 API for stat).

However the second referenced commit was reverted in f66450a (2013-06-22,
cygwin: Remove the Win32 l/stat() implementation), so we don't need to
expose this wrapper function any more as a public API.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
---
 cache.h       | 1 -
 environment.c | 5 -----
 2 files changed, 6 deletions(-)

diff --git a/cache.h b/cache.h
index 464c8fb..7e98f9e 100644
--- a/cache.h
+++ b/cache.h
@@ -398,7 +398,6 @@ extern int is_bare_repository(void);
 extern int is_inside_git_dir(void);
 extern char *git_work_tree_cfg;
 extern int is_inside_work_tree(void);
-extern int have_git_dir(void);
 extern const char *get_git_dir(void);
 extern int is_git_directory(const char *path);
 extern char *get_object_directory(void);
diff --git a/environment.c b/environment.c
index 378254c..0a15349 100644
--- a/environment.c
+++ b/environment.c
@@ -155,11 +155,6 @@ int is_bare_repository(void)
 	return is_bare_repository_cfg && !get_git_work_tree();
 }
 
-int have_git_dir(void)
-{
-	return !!git_dir;
-}
-
 const char *get_git_dir(void)
 {
 	if (!git_dir)
-- 
1.8.4.1.605.g23c6912

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] refs: remove unused function invalidate_ref_cache
  2013-10-26 17:03 [PATCH 1/2] refs: remove unused function invalidate_ref_cache Stefan Beller
  2013-10-26 17:03 ` [PATCH 2/2] cache: remove unused function 'have_git_dir' Stefan Beller
@ 2013-10-27  4:26 ` Michael Haggerty
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Haggerty @ 2013-10-27  4:26 UTC (permalink / raw)
  To: Stefan Beller, git, gitster

On 10/26/2013 07:03 PM, Stefan Beller wrote:
> The function 'invalidate_ref_cache' was introduced in 79c7ca5 (2011-10-17,
> invalidate_ref_cache(): rename function from invalidate_cached_refs())
> by a rename and elevated to be publicly usable in 8be8bde (2011-10-17,
> invalidate_ref_cache(): expose this function in the refs API)
> 
> However it is not used anymore, as 8bf90dc (2011-10-17, write_ref_sha1():
> only invalidate the loose ref cache) and (much) later 506a760 (2013-04-22,
> refs: change how packed refs are deleted) removed any calls to this
> function. So it seems as if we don't need that function any more,
> good bye!

Looks good.  Stefan, thanks for cleaning up after me!

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-27  4:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-26 17:03 [PATCH 1/2] refs: remove unused function invalidate_ref_cache Stefan Beller
2013-10-26 17:03 ` [PATCH 2/2] cache: remove unused function 'have_git_dir' Stefan Beller
2013-10-27  4:26 ` [PATCH 1/2] refs: remove unused function invalidate_ref_cache Michael Haggerty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).