Fix treatment of symbolic refs in PushOp
We need to use the symbolic ref name when mirroring, as we flatten
it out to a normal ref on the remote site. This prevents cases
where we needed to push both "HEAD" and "refs/heads/master" as the
former was a symbolic-ref to the latter.
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/src/main/java/com/google/gerrit/git/PushOp.java b/src/main/java/com/google/gerrit/git/PushOp.java
index c57c4d0..7695f22 100644
--- a/src/main/java/com/google/gerrit/git/PushOp.java
+++ b/src/main/java/com/google/gerrit/git/PushOp.java
@@ -198,7 +198,7 @@
final Map<String, Ref> remote = listRemote(tn);
for (final Ref src : local.values()) {
- final RefSpec spec = matchSrc(src.getName());
+ final RefSpec spec = matchSrc(src.getOrigName());
if (spec != null) {
final Ref dst = remote.get(spec.getDestination());
if (dst == null || !src.getObjectId().equals(dst.getObjectId())) {
@@ -282,6 +282,6 @@
}
private static boolean isHEAD(final Ref ref) {
- return Constants.HEAD.equals(ref.getName());
+ return Constants.HEAD.equals(ref.getOrigName());
}
}