Commit Graph

6487 Commits

Author SHA1 Message Date
Markus Keller 8420c729a0 Make PrePushHook properly terminate ref lines
All of the input lines passed to pre-push hook scripts must be properly
terminated by '\n', so that normal shell scripts like the git-supplied
pre-push.sample work properly, even when pushing just a single branch.

With the old code, hook scripts that use the following pattern didn't
process the last line, because 'read' has a non-zero exit status when
EOF is encountered:
  while read local_ref local_sha remote_ref remote_sha; do ... done

Change-Id: Id899662ed3fedef6c314fc4b2ddf91a6dcb98cbb
Signed-off-by: Markus Keller <markus.kell.r@gmail.com>
2018-10-21 17:07:58 -04:00
David Pursehouse e4fdc571c9 RemoteRefUpdate#toString: Fix indentation
Change-Id: Ide2a7e914ab0ff50cf34ff5bc6df3219efe4ba96
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-21 20:05:56 +09:00
Michael Keppler f2db2a1f65 [releng] Fix boxing warning
Use Integer.valueOf() to avoid the warning by implicit conversion due to
usage as argument object in String.format().

Change-Id: Ib314f629d54ae1ce9729c3837d66ce8982a1898a
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-10-20 15:20:51 +02:00
Ned Twigg d056a54384 CheckoutCommand: force flag now allows overwrite
Before this commit, a force checkout would fail if there
were any conflicting files. After this commit, a force
checkout will overwrite the conflicting files, as expected.

Making this work required fixing a bug in DirCacheCheckout.
Before this commit, when DirCacheCheckout had
failOnConflict=false, it would delete all conflicting files
from the working copy and just leave them missing. After
this commit, DirCacheCheckout overwrites conflicting files
with the merge tree.

This change in DirCacheCheckout causes "reset --hard" and
"revert --abort" to behave as expected (previously they
would simply delete conflicting files, now they will be
overwritten from the merge tree).

Change-Id: If7e328ee792ef6511ab7d9c26d8d77c39210ec9f
Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
2018-10-20 06:53:23 -04:00
David Pursehouse 36432ac4e3 Merge branch 'stable-5.1'
* stable-5.1:
  Prepare 5.1.4-SNAPSHOT builds
  JGit v5.1.3.201810200350-r
  Prepare 4.11.6-SNAPSHOT builds
  JGit v4.11.5.201810191925-r
  Prepare 4.9.8-SNAPSHOT builds
  JGit v4.9.7.201810191756-r
  Update API problem filter
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: Ic8b2189fdd8403294327a17cc0c1f6a6e2f78cb8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-20 18:06:27 +09:00
Matthias Sohn b65e247568 Prepare 5.1.4-SNAPSHOT builds
Change-Id: Iee86860f3b4eb9f4af818c60342fd29465c0474c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 10:39:16 +02:00
Matthias Sohn cf24983b23 JGit v5.1.3.201810200350-r
Change-Id: Ib2c5a79d4fdf77680b7b65652fc3659527df27ad
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 09:50:16 +02:00
David Pursehouse 8fc3903989 Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:

All commits from stable-5.0 are already in stable-5.1 due to an
accidental merge of stable-4.11 into stable-5.1 by I3ec3c9af4.

Change-Id: I8a89d103be2b2cb7657e82a124e7db41239a2447
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-20 14:47:49 +09:00
David Pursehouse 4728a32699 Merge "Merge branch 'stable-4.11' into stable-5.0" into stable-5.1 2018-10-20 01:39:43 -04:00
David Pursehouse f40a5a12e4 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Prepare 4.11.6-SNAPSHOT builds
  JGit v4.11.5.201810191925-r
  Prepare 4.9.8-SNAPSHOT builds
  JGit v4.9.7.201810191756-r
  Update API problem filter
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: Ib6493d2b6270fe4f237ea52d97848239c16c1d9d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-20 14:29:12 +09:00
Matthias Sohn 647ad2f0f2 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Prepare 4.11.6-SNAPSHOT builds
  JGit v4.11.5.201810191925-r
  Prepare 4.9.8-SNAPSHOT builds
  JGit v4.9.7.201810191756-r
  Update API problem filter
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I3ec3c9af49b11979a551a9749d5a8ba5ef2ef726
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 02:12:24 +02:00
Matthias Sohn 9b6d30f2c1 Prepare 4.11.6-SNAPSHOT builds
Change-Id: Ic823775aad59530f516602e7e848474d65763314
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 02:08:35 +02:00
Ivan Frade 8d4f8d55d3 UploadPack: Return correct peer user agent on v2 requests
UploadPack.getPeerUserAgent() doesn't produce the expected results for
protocol v2 requests. In v2, the agent reported in the request (in an
"agent=" line) is not in the clientCapabilities but in a field on its
own. This makes getPeerUserAgent default to the transport user agent.

Making "agent" a shared property between protocol v0/v1 and v2 fixes the
problem, simplifies the function and harmonizes the implementation
between protocol versions.

In a follow up commit the "agent" will be identified on parsing time,
instead of taking it from the client capabilities.

Change-Id: Idf9825ec4e0b81a1458c8e3701f3e28aafd8a32a
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-19 16:55:56 -07:00
Matthias Sohn 92aca6195d JGit v4.11.5.201810191925-r
Change-Id: I9d11536062de74775ca545c26f341610d0ddaeb2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 01:27:52 +02:00
Matthias Sohn 976a8e369d Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Prepare 4.9.8-SNAPSHOT builds
  JGit v4.9.7.201810191756-r
  Update API problem filter
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I5698fde41417c4ce9e813c683c84978f303b76fe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 01:23:27 +02:00
Matthias Sohn 019f1b2d4c Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Prepare 4.9.8-SNAPSHOT builds
  JGit v4.9.7.201810191756-r
  Update API problem filter
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I6f07ea02491ba3a32f30ee2408e1153241cc8a07
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 00:16:21 +02:00
Matthias Sohn 7ae004509c Prepare 4.9.8-SNAPSHOT builds
Change-Id: Iab7b0f2a21a76f801a83fbeb54f09d1525878f4d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 00:10:02 +02:00
Matthias Sohn 97534056fc JGit v4.9.7.201810191756-r
Change-Id: Ib980731eb9ec7f4c92deac9b4cf2f7a994d670c2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 23:58:47 +02:00
Matthias Sohn 97b62cf9dd Update API problem filter
Change-Id: Iba8650900d3936edccbe30de9d3eafd4f9e0dba6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 23:54:38 +02:00
Matthias Sohn cee3ef1a0e Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: Ic18af2ddcba8f7a53eb27a33ea9f637adb941993
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 23:30:20 +02:00
Ivan Frade 40f5b28545 Accept protocol v2 server options on fetch and ls-refs requests
In protocol v2, a command request can be followed by server options
(lines like "agent=<>" and "server-option=<>"), but current code
doesn't accept those lines.

Advertise the "server-option" capability, parse the lines and add
them to the request objects.

Other code in JGit can see this options and act accordingly via the
protocol v2 hooks.

This should not require any change in the client side.

Change-Id: If3946390f9cc02d29644b6ca52534b6f757bda9f
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-19 14:04:02 -07:00
Matthias Sohn 566a5dcc21 Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I783a083c0092a400f28f7977fbc4e556af88c8de
2018-10-19 22:36:31 +02:00
Matthias Sohn d6c587faef Prepare 4.7.7-SNAPSHOT builds
Change-Id: I131e40cbbf32bc75d2ed24ca31ba3613a3bbca25
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 22:27:47 +02:00
Matthias Sohn b811e4fc51 JGit v4.7.6.201810191618-r
Change-Id: Iaee27d5e2de016240f1a0940653fef82c6044a1d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 22:18:38 +02:00
Matthias Sohn 2674bec32b Update API problem filter
Change-Id: I66c0c490bb66adafac5d670d2d9571f1674a281e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 22:15:39 +02:00
Ivan Frade 0691c4b94b UploadPack: Use request instead of field for client capabilities
Change-Id: Idc21e2b3fd145d2a4b15c1cea5ec1956541e3b40
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-19 11:01:28 -07:00
David Pursehouse ffaada75e4 Merge branch 'stable-4.6' into stable-4.7
* stable-4.6:
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I3e1a870a225447e761368298ce9b65dbec2c2a82
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 18:43:49 +09:00
David Pursehouse 926a126f72 Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I9c925a65d42559443ade9ac8291ffe00f4a1dda1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 18:43:09 +09:00
David Pursehouse c31108bcc5 Merge branch 'stable-4.4' into stable-4.5
* stable-4.4:
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: Icd66a796b0cce93c75a52cc77fec8f9df3eeccb4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 10:46:01 +09:00
David Pursehouse 0de9ca38f4 Merge branch 'stable-4.3' into stable-4.4
* stable-4.3:
  JGit v4.0.3.201509231615-r

Change-Id: I147d81a9cc9c0f9e66084897df9c88c369539db7
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 10:43:07 +09:00
David Pursehouse 2a21b330d6 Merge branch 'stable-4.2' into stable-4.3
* stable-4.2:
  JGit v4.0.3.201509231615-r

Change-Id: Ic90ef74497afee9da4b49dcb53302b4efa5b9f26
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 10:42:26 +09:00
David Pursehouse 27acb4ab25 Merge branch 'stable-4.1' into stable-4.2
* stable-4.1:
  JGit v4.0.3.201509231615-r

Change-Id: I6cc5bcefad2e8dee3394770d36608f981bfc9a9e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 10:41:31 +09:00
David Pursehouse aebc8a41b8 Merge branch 'stable-4.0' into stable-4.1
* stable-4.0:
  JGit v4.0.3.201509231615-r

Change-Id: Ie74b0392ef145ffd27dc903c45f7fec2d4492a17
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 10:38:55 +09:00
David Pursehouse 95579e6af3 Merge branch 'stable-5.1'
* stable-5.1:
  ssh: Prefer algorithms of the known host keys

Change-Id: I4868359c9df75cb2c51331789cb9f34473801569
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 08:06:45 +09:00
Ivan Frade 7fde9ab8d2 UploadPack.FirstLine: Revert renaming of getOptions into getCapabilities
This is public facing, stable API.

Fortunately, this class is deprecated and will be removed in the next
major version bump.

Change-Id: I91193964732e9d1943e9dc613256196e9c9d1274
Signed-off-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-18 15:54:46 -07:00
Saša Živkov b6e2800560 ssh: Prefer algorithms of the known host keys
JSch prefers ssh-rsa key type. When the remote server supports ssh-rsa
key type then this key type will be used even if the known_hosts file
contains a host key for that host, but with different key type.
This caused an unexpected UnknownHostKey error.

To fix the issue first scan the known_hosts, the HostKeyRepository in
JSch API, for any already existing host keys for the target host and
modify the default session settings to prefer their algorithms. However,
do this only if there is no HostKeyAlgorithms setting active.

Change-Id: I236df2a860ddd9289a0a820ddf09c2dea3673d36
2018-10-18 11:59:16 +02:00
Michael Keppler 91021cb66f Configure classpath for separate test sources in Eclipse
Eclipse Photon supports separating sources and test sources.

There are no functional changes in the IDE, except for test source
folders having a different icon color.

Users of different IDEs than Eclipse are not affected, since the
attribute on the classpath entries will be ignored by their IDE.

Bug: 539933
Change-Id: Iac6dcdf0c0730ca775bae90df6a685303dc95380
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-17 11:08:24 +09:00
David Pursehouse 7ebd434e91 Disable Eclipse warning about unrecognized @SuppressWarnings value
The code base has several @SuppressWarnings annotations to suppress
warnings raised by Error Prone, but those are not recognized by
Eclipse and there is currently no way to tell it about them [1].

Suppress them for now.

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=392045

Change-Id: I3de7cfa8ad4370ca5be71e1303879c73ab6829c1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-17 10:40:36 +09:00
David Pursehouse abefc00ac5 UnionInputStreamTest: Suppress ErrorProne warning about missing synchronized
Error Prone reports that the unsynchronized method skip overrides the
synchronized method in ByteArrayInputStream [1].

This is a test class, so we can just suppress the warning as recommended
in [1].

Note that the suppression causes a warning in Eclipse, because it doesn't
recognize the "UnsynchronizedOverridesSynchronized" as a valid value for
the @SuppressWarnings annotation [2].

[1] https://errorprone.info/bugpattern/UnsynchronizedOverridesSynchronized
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=392045

Change-Id: I3e798b448211f1363729091f72fb0ef6a873e599
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-17 10:29:33 +09:00
David Pursehouse 9bfd31fd44 Merge "Upgrade spotbugs to 3.1.7" 2018-10-16 19:34:04 -04:00
Ivan Frade 13b3881b3e UploadPack: Use request instead of field for clientShallowCommits
Yet another member to field transition.

Change-Id: Ic801f4ac3a270b287591ef3cf722c399126ccdd4
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 16:13:04 -07:00
Ivan Frade 9694d89ea1 UploadPack: Use request instead of field for depth
One more step in removing state from UploadPack, using the request
object instead.

Unfortunately, hooks get from UploadPack information about the current
request. Changing the hooks to receive the request is a public API
change, so at the moment lets keep a reference to the current request.

This kills half the benefit of using a request object vs fields, but
at least we still get better modularity.

Change-Id: I86803d876a621b727c66ee73f2880c93190629e9
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 16:13:04 -07:00
Ivan Frade 81a752bef7 UploadPack: Use request instead of field for shallowSince
Change-Id: I1b9fdb6c58c574f66dbd152c1049ddcd52cc1683
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 16:13:04 -07:00
Ivan Frade 3c974d0251 UploadPack: Use request in computeShallowUnshallow
All data required in this function is available in the request object.
Use that object instead of class members. This reduces class state and
is more readable.

Make the function use a request object and remove the now unnecessary
field "deepenNotRefs".

Change-Id: If861e44c2860a78cf19f456d1b3feb7ddc314cce
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 16:13:04 -07:00
Ivan Frade b41d7624b8 Move deepenSince and deepenNotRefs up to FetchRequest
These properties are protocol v2 specific, but they have clear default
no-op values and having them in the common superclass simplifies client
code.

Move properties deepenSince and deepenNotRefs up to FetchRequest. In
FetchV0Request, they are initialized with their no-op values (0 for
deepenSince and empty list for deepenNotRefs)

Change-Id: I9d46a6dfbe29ebd794b5a6482033cdc70d411a23
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 16:12:59 -07:00
Ivan Frade 2bedc6e08b UploadPack: Use request instead of field for filterBlobLimt
filterBlobLimit is not part of the UploadPack state, and as field
of the class is difficult to see where it is set or accessed.

Use the request object instead of a field. This reduces
UploadPack state and makes clearer how the value is used.

Change-Id: I96a04a5a8b31bf2243de701e1fd7ebb4080b49e2
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 11:17:42 -07:00
Ivan Frade ec838fee0c Mark fetch requests fields as final and @NonNull when possible
Mark reference fields as final, annotate constructor parameters and
getters as @NonNull when appropiate and assert the incoming references
are non-null.

Change-Id: I0ef9a513a99313bf461fe9629ce6cc8b409bdedb
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 11:11:26 -07:00
David Pursehouse f894066f6c Upgrade spotbugs to 3.1.7
Change-Id: I2bfeccafe01cf249ac536ded16be734e28cf4ff0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-16 18:38:34 +09:00
Ivan Frade 1a0b48fecd Create FetchRequest superclass with common elements
Some code apply to both, v1 and v2 requests, so it should receive
just a request instance.

Move all common fields to an abstract superclass that can be passed
to "version neutral" functions.

Change-Id: I47c22fb12065bc93767f78175e2b36cc43ccb5c5
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-15 16:37:22 -07:00
Ivan Frade 8460ab8e87 Rename Fetch V2 request wantsIds and options
In FetchV0Request, the fields "wantsIds" and "options" are called
"wantIds" and "clientCapabilities". Those names describe them better.

Rename FetchV2Request fields to follow fetch v0. This will make easier
to extract a superclass later.

Take also the chance to polish the javadoc.

Change-Id: Ia17dbbab8084f39cc529fef9ca5c65e189073767
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-15 16:27:58 -07:00