Merge branch 'stable-7.5' into stable-7.6

* stable-7.5:
  Log loose ref deletion during ref cleanup

Change-Id: I95e03400a75dec4afd2829abdb8532773d5e19bd
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
index 8889d75..31d065e 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
@@ -260,6 +260,7 @@
 deepenSinceWithDeepen=Cannot combine deepen with deepen-since
 deleteBranchUnexpectedResult=Delete branch returned unexpected result {0}
 deleteFileFailed=Could not delete file {0}
+deleteLooseRef=Deleted loose ref {}, object Id {}
 deletedOrphanInPackDir=Deleted orphaned file {}
 deleteRequiresZeroNewId=Delete requires new ID to be zero
 deleteTagUnexpectedResult=Delete tag returned unexpected result {0}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
index 1f49629..9365db2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
@@ -290,6 +290,7 @@ public static JGitText get() {
 	/***/ public String deepenSinceWithDeepen;
 	/***/ public String deleteBranchUnexpectedResult;
 	/***/ public String deleteFileFailed;
+	/***/ public String deleteLooseRef;
 	/***/ public String deletedOrphanInPackDir;
 	/***/ public String deleteRequiresZeroNewId;
 	/***/ public String deleteTagUnexpectedResult;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
index cbf3566..bacc1ec 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
@@ -743,7 +743,11 @@ void delete(RefDirectoryUpdate update) throws IOException {
 				int levels = levelsIn(name) - 2;
 				delete(logFor(name), levels);
 				if (dst.getStorage().isLoose()) {
-					deleteAndUnlock(fileFor(name), levels, update);
+					File refFile = fileFor(name);
+					ObjectId refObjectId = dst.getObjectId();
+					deleteAndUnlock(refFile, levels, update);
+					LOG.debug(JGitText.get().deleteLooseRef,
+							refFile, refObjectId);
 				}
 			} finally {
 				lck.unlock();
@@ -869,6 +873,7 @@ private void pack(Collection<String> refs,
 							} while (!looseRefs.compareAndSet(curLoose, newLoose));
 							int levels = levelsIn(refName) - 2;
 							deleteAndUnlock(refFile, levels, rLck);
+							LOG.debug(JGitText.get().deleteLooseRef, refFile, clr_oid);
 						}
 					} finally {
 						if (shouldUnlock) {