My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions

Issue 2025 attachment: 0001-Fix-push-to-repo-with-non-fetched-refs.patch (1.3 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From f3df30dc716655993bbd6f21140c9e3d2e28595d Mon Sep 17 00:00:00 2001
From: Jean-Jacques Lafay <jean-jacques.lafay@sgcib.com>
Date: Mon, 14 Oct 2013 17:21:43 +0200
Subject: [PATCH] Fix push to repo with non-fetched refs

---
.../src/org/eclipse/jgit/transport/BasePackPushConnection.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
index 22b458c..429f016 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
@@ -283,8 +283,12 @@ private void writePack(final Map<String, RemoteRefUpdate> refUpdates,
local.newObjectReader());
try {

- for (final Ref r : getRefs())
- remoteObjects.add(r.getObjectId());
+ for (final Ref r : getRefs()) {
+ // only add objects that we actually have
+ ObjectId oid = r.getObjectId();
+ if (local.hasObject(oid))
+ remoteObjects.add(oid);
+ }
remoteObjects.addAll(additionalHaves);
for (final RemoteRefUpdate r : refUpdates.values()) {
if (!ObjectId.zeroId().equals(r.getNewObjectId()))
--
1.8.1.msysgit.1.dirty

Powered by Google Project Hosting