Merge branch 'stable-7.7'

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

Change-Id: I93980e0beae0f0ff383e4bac4d72556d4dccb796
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 dca75e2..4b6d086 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
@@ -261,6 +261,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 4251f4c..5bab353 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
@@ -291,6 +291,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 4db14e2..1b43f27 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
@@ -740,7 +740,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();
@@ -873,6 +877,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) {