[PATCH 14/14] lockfile: make 'unable_to_lock_message' private

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The old external callers now use the message passed back by
hold_lock_file_for_update / hold_lock_file_for_append instead of
trying to interpret errno.

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
That's the end of the series.  Thanks for reading.

Thoughts?

 lockfile.c | 42 +++++++++++++++++++++---------------------
 lockfile.h |  2 --
 2 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/lockfile.c b/lockfile.c
index 8d8d5ed..7121370 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -98,6 +98,27 @@ static void resolve_symlink(struct strbuf *path)
 	strbuf_reset(&link);
 }
 
+static void unable_to_lock_message(const char *path, int flags, int err,
+			    struct strbuf *buf)
+{
+	if (err != EEXIST) {
+		strbuf_addf(buf, "Unable to create '%s.lock': %s",
+			    absolute_path(path), strerror(err));
+	} else if (flags & LOCK_OUTSIDE_REPOSITORY) {
+		strbuf_addf(buf, "Unable to create '%s.lock': %s.\n\n"
+		    "If no other git process is currently running, this probably means\n"
+		    "another git process crashed earlier. Make sure no other git process\n"
+		    "is running and remove the file manually to continue.",
+			    absolute_path(path), strerror(err));
+	} else {
+		strbuf_addf(buf, "Unable to create '%s.lock': %s.\n\n"
+		    "If no other git process is currently running, this probably means a\n"
+		    "git process crashed in this repository earlier. Make sure no other git\n"
+		    "process is running and remove the file manually to continue.",
+			    absolute_path(path), strerror(err));
+	}
+}
+
 static int lock_file(struct lock_file *lk, const char *path,
 		     int flags, struct strbuf *err)
 {
@@ -149,27 +170,6 @@ static int lock_file(struct lock_file *lk, const char *path,
 	return lk->fd;
 }
 
-void unable_to_lock_message(const char *path, int flags, int err,
-			    struct strbuf *buf)
-{
-	if (err != EEXIST) {
-		strbuf_addf(buf, "Unable to create '%s.lock': %s",
-			    absolute_path(path), strerror(err));
-	} else if (flags & LOCK_OUTSIDE_REPOSITORY) {
-		strbuf_addf(buf, "Unable to create '%s.lock': %s.\n\n"
-		    "If no other git process is currently running, this probably means\n"
-		    "another git process crashed earlier. Make sure no other git process\n"
-		    "is running and remove the file manually to continue.",
-			    absolute_path(path), strerror(err));
-	} else {
-		strbuf_addf(buf, "Unable to create '%s.lock': %s.\n\n"
-		    "If no other git process is currently running, this probably means a\n"
-		    "git process crashed in this repository earlier. Make sure no other git\n"
-		    "process is running and remove the file manually to continue.",
-			    absolute_path(path), strerror(err));
-	}
-}
-
 int hold_lock_file_for_update(struct lock_file *lk, const char *path,
 			      int flags, struct strbuf *err)
 {
diff --git a/lockfile.h b/lockfile.h
index b4d29a3..02e26fe 100644
--- a/lockfile.h
+++ b/lockfile.h
@@ -71,8 +71,6 @@ struct lock_file {
 #define LOCK_NO_DEREF 1
 #define LOCK_OUTSIDE_REPOSITORY 2
 
-extern void unable_to_lock_message(const char *path, int, int err,
-				   struct strbuf *buf);
 extern int hold_lock_file_for_update(struct lock_file *, const char *path,
 				     int, struct strbuf *err);
 extern int hold_lock_file_for_append(struct lock_file *, const char *path,
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]