]> source.dussan.org Git - jgit.git/log
jgit.git
5 years agoRefDirectory: Refactor getRef and exactRef to share code 08/60108/4
Jonathan Nieder [Wed, 11 Nov 2015 00:56:41 +0000 (16:56 -0800)]
RefDirectory: Refactor getRef and exactRef to share code

Both getRef and exactRef look for a ref or pseudoref in the $GIT_DIR
directory, with careful error handling to handle non-refs like
.git/config.

Avoid the duplication by factoring out a helper that takes care of
this.  This should make the code easier to understand and manipulate.

Change-Id: I2ea67816d2385e84e2d3394b897e23df5826ba50
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoMerge changes from topic 'update-index-ref-decorator'
Jonathan Nieder [Wed, 26 Dec 2018 18:12:14 +0000 (13:12 -0500)]
Merge changes from topic 'update-index-ref-decorator'

* changes:
  RefCursor: Remove unnecessary getUpdateIndex method
  RefDatabase/Ref: Add versioning to reference database

5 years agoRefCursor: Remove unnecessary getUpdateIndex method 01/134301/10
Ivan Frade [Thu, 20 Dec 2018 06:25:55 +0000 (22:25 -0800)]
RefCursor: Remove unnecessary getUpdateIndex method

Now the reference carries its updateIndex, so the cursor doesn't need
to expose it.

Change-Id: Icbfca46f92a13f3d8215ad10b2a166a6f40b0b0f
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoRefDatabase/Ref: Add versioning to reference database 92/133092/20
Ivan Frade [Thu, 20 Dec 2018 00:43:56 +0000 (16:43 -0800)]
RefDatabase/Ref: Add versioning to reference database

In DFS implementations the reference table can fall out of sync, but
it is not possible to check this situation in the current API.

Add a property to the Refs indicating the order of its updates.  This
version is set only by RefDatabase implementations that support
versioning (e.g reftable based).

Caller is responsible to check if the reference db creates versioned
refs before accessing getUpdateIndex(). E.g:

   Ref ref = refdb.exactRef(...);
   if (refdb.hasVersioning()) {
       ref.getUpdateIndex();
   }

Change-Id: I0d5ec8e8df47c730301b2e12851a6bf3dac9d120
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoUpdate org.tukaani.xz to 1.8.0.v20180207-1613 64/134464/1
Matthias Sohn [Sun, 23 Dec 2018 02:18:59 +0000 (03:18 +0100)]
Update org.tukaani.xz to 1.8.0.v20180207-1613

CQ: 18321
Change-Id: I49f47748e7753146c0d696b2bd381d2d3465691e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoSkip some tests when the runtime cannot handle Unicode file paths 60/134460/5
Masaya Suzuki [Mon, 24 Dec 2018 00:43:54 +0000 (16:43 -0800)]
Skip some tests when the runtime cannot handle Unicode file paths

When executing a test with LANG environment variable set to non UTF-8
encoding, it seems that JRE cannot handle Unicode file paths. This
happens when this test is executed in Bazel as it unsets LANG
(https://docs.bazel.build/versions/master/test-encyclopedia.html#initial-conditions).

Skip the test if the runtime cannot handle Unicode file paths.

Change-Id: I16bd3cd959dbaf2335b9c5202873e2f12ed0ba21
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
5 years agoChange RacyGitTests to create a racy git situation in a stable way 61/134461/2
Masaya Suzuki [Mon, 24 Dec 2018 03:31:10 +0000 (19:31 -0800)]
Change RacyGitTests to create a racy git situation in a stable way

By using File#setLastModified, we can create a racy git situation
stably.

Tested with --runs_per_test=100

Bug: 526111
Change-Id: I60b3632d353e19f335668325aa603640be423f58
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
5 years agoCapture test coverage and add an aggregate test coverage report 97/134097/3
Matthias Sohn [Wed, 5 Dec 2018 13:37:59 +0000 (14:37 +0100)]
Capture test coverage and add an aggregate test coverage report

Configure Maven build to capture test coverage using jacoco.

Add new org.eclipse.jgit.coverage Maven module to aggregate
jacoco test coverage results and generate test coverage HTML report at

org.eclipse.jgit.coverage/target/site/jacoco-aggregate/index.html

See https://www.eclemma.org/jacoco/trunk/doc/maven.html

Change-Id: Iaeec4033e448ebc16965c05ab54109c4155a307a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGitInternalException: Fix typo in Javadoc 26/134426/1
David Pursehouse [Fri, 21 Dec 2018 23:06:40 +0000 (08:06 +0900)]
JGitInternalException: Fix typo in Javadoc

Change-Id: I46fabab3cb2d9164234ce04de346826687a3fa35
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoAvoid double words 71/134371/1
Mincong HUANG [Fri, 21 Dec 2018 06:50:54 +0000 (07:50 +0100)]
Avoid double words

Change-Id: I0fdf595cba93f5a5cdd0496cee07ac91db304532
Signed-off-by: Mincong Huang <mincong.h@gmail.com>
5 years agoSilence API error for 3 digit version number in @since tag 67/134367/1
Matthias Sohn [Fri, 21 Dec 2018 00:30:30 +0000 (01:30 +0100)]
Silence API error for 3 digit version number in @since tag

Change-Id: I4943d9338ddf294e2ef67f0d459a3030f528d0c9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRemove unnecessary @since tags from non-API classes 18/134318/1
David Pursehouse [Thu, 20 Dec 2018 11:02:31 +0000 (20:02 +0900)]
Remove unnecessary @since tags from non-API classes

Change-Id: I6bed174c062a0785641dc8ad69151bf7e843cdcf
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge branch 'stable-5.2' 03/134303/1
David Pursehouse [Thu, 20 Dec 2018 06:51:08 +0000 (15:51 +0900)]
Merge branch 'stable-5.2'

* stable-5.2:
  BasePackConnection: Check for expected length of ref advertisement
  TransferConfig: Make constructors public
  Update last JGit version

Change-Id: I4406d4f68136a2ce363701324b9a842ad468bc59
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge branch 'stable-5.1' into stable-5.2 99/134299/1
David Pursehouse [Thu, 20 Dec 2018 05:01:52 +0000 (14:01 +0900)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  BasePackConnection: Check for expected length of ref advertisement
  TransferConfig: Make constructors public

Change-Id: I2480a0455250ee381fae93cac2db30f8305fa6aa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBasePackConnection: Check for expected length of ref advertisement 85/134185/4
David Pursehouse [Tue, 18 Dec 2018 10:53:26 +0000 (19:53 +0900)]
BasePackConnection: Check for expected length of ref advertisement

When a server sends a ref advertisement using protocol v2 it contains
lines other than ref names and sha1s.  Attempting to get the sha1 out
of such a line using the substring method can result in a SIOOB error
when it doesn't actually contain the sha1 and ref name.

Add a check that the line is of the expected length, and subsequently
that the extracted object id is valid, and if not throw an exception.

Change-Id: Id92fe66ff8b6deb2cf987d81929f8d0602c399f4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoTransferConfig: Make constructors public 79/134179/3
David Pursehouse [Tue, 18 Dec 2018 06:44:44 +0000 (15:44 +0900)]
TransferConfig: Make constructors public

UploadPack has a setTransferConfig method which allows to set the
transfer config, however since the constructors of TransferConfig
have the default package visibility it is not possible for any
application using UploadPack, for example Gerrit, to actually set
a transfer config.

Make the constructors public. This is consistent with the public
constructors for example on PackConfig.

Change-Id: I07080255838421871403b2b2bcc294aa8f621c57
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoLfsGson: Remove unnecessary @since tag 92/134292/1
David Pursehouse [Wed, 19 Dec 2018 23:32:47 +0000 (08:32 +0900)]
LfsGson: Remove unnecessary @since tag

The tag is formed inconsistently to tags in the rest of the JGit code
base (i.e. "4.10.0" with a trailing ".0" where all the others don't).

However since this class is not in the public API, the @since tag is
not necessary and can just be removed.

Change-Id: Ifa3f543f819a39453fcf343278e522b5d7b003c3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUploadPack: Rewrite setAdvertiseRefsHook to use ternary operator 74/134174/2
David Pursehouse [Tue, 18 Dec 2018 02:57:20 +0000 (11:57 +0900)]
UploadPack: Rewrite setAdvertiseRefsHook to use ternary operator

This makes the implementation consistent with the other similar
methods in this class.

Change-Id: I007876aad883615d696c8eabc886818ae00b10ee
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUploadPack: Prevent setting null protocolV2Hook 73/134173/2
David Pursehouse [Tue, 18 Dec 2018 02:44:00 +0000 (11:44 +0900)]
UploadPack: Prevent setting null protocolV2Hook

The setProtocolV2Hook sets the protocolV2Hook to whatever value is
passed, which could be null, but the invocations of protocolV2Hook's
methods are not guarded by null-checks.

Annotate the parameter as @Nullable and set ProtocolV2Hook.DEFAULT
when null is passed. This makes the implementation consistent with
other similar methods that set a hook or filter with possible null
value.

Change-Id: I70919a3248d4c2658783941a37c47e437cff0baa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUploadPack: Add @Nullable annotations 72/134172/2
David Pursehouse [Tue, 18 Dec 2018 05:07:53 +0000 (14:07 +0900)]
UploadPack: Add @Nullable annotations

The class has several methods where passing a null parameter is
valid. Annotate those parameters as @Nullable.

Change-Id: Ie08893ee3ab34c1ffb2db875b4ab049ad065c697
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpgrade maven-jar-plugin to 3.1.1 82/133982/2
David Pursehouse [Thu, 13 Dec 2018 11:51:18 +0000 (20:51 +0900)]
Upgrade maven-jar-plugin to 3.1.1

Change-Id: I1b230fb558bc4773594a11292ee12820abe3ebaf
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpgrade Tycho to 1.3 90/134090/2
Michael Keppler [Sat, 15 Dec 2018 15:17:31 +0000 (16:17 +0100)]
Upgrade Tycho to 1.3

With the upcoming Eclipse release 2018-12 a new version of Tycho has
been released. Upgrade the Tycho related build steps to the new version
in the Maven build.

Change-Id: Ifff186a9f97ed9faf70f15b20396724b0c9e801c
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
5 years agoUpdate last JGit version 99/134099/1
Thomas Wolf [Sat, 15 Dec 2018 20:59:32 +0000 (21:59 +0100)]
Update last JGit version

The jgit-last-release-version is used by japicmp as baseline.

Change-Id: If56cc1785b61c92c9a05c8c29c6cb62001e89218
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoEnable japicmp for new SSH bundle; update its baseline 93/134093/2
Thomas Wolf [Sat, 15 Dec 2018 19:27:34 +0000 (20:27 +0100)]
Enable japicmp for new SSH bundle; update its baseline

In the original contribution of this bundle, japicmp was disabled
as no previous version to compare against existed. Enable it now.

Update the version to compare against to 5.2.0.201812061821-r.

Change-Id: I42f812befde2d0d98db5f87e05230b51af244ae6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoMerge branch 'stable-5.2' 44/133744/1
Matthias Sohn [Sat, 8 Dec 2018 23:45:43 +0000 (00:45 +0100)]
Merge branch 'stable-5.2'

* committer:
  Update list of committers
  Add new ssh bundles to Maven central scripts
  Update maven site reports
  Prepare 5.2.1-SNAPSHOT builds
  JGit v5.2.0.201812061821-r
  Update Orbit to R20181128170323 for 2018-12

Change-Id: I97c6ce5f0c963bfab4d45462f555563d9c5bbe8a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate list of committers 43/133743/1
Matthias Sohn [Sat, 8 Dec 2018 23:24:00 +0000 (00:24 +0100)]
Update list of committers

Change-Id: I5bd3dc06103f8f62af1485b92e7b89f8a725be28
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoAdd new ssh bundles to Maven central scripts 42/133742/1
Matthias Sohn [Sat, 8 Dec 2018 23:12:51 +0000 (00:12 +0100)]
Add new ssh bundles to Maven central scripts

Change-Id: I5c41426f59a60af3da808f89be4e498c7ba2196e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate maven site reports 41/133741/1
Matthias Sohn [Sat, 8 Dec 2018 23:12:11 +0000 (00:12 +0100)]
Update maven site reports

- update name of reports which changed name in
  maven-project-info-reports-plugin 3.0.0
- add dependency-covergence report
- add dependency-management report
- add index report
- add summary report

Change-Id: I6d406ecd9e082d96b2bd250704d5ca18e7c8f735
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 5.2.1-SNAPSHOT builds 27/133627/1
Matthias Sohn [Fri, 7 Dec 2018 00:46:38 +0000 (01:46 +0100)]
Prepare 5.2.1-SNAPSHOT builds

Change-Id: I68d9f5b1c8ca8e8eada9143093dc4fa82519edd8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.2.0.201812061821-r 19/133619/1 v5.2.0.201812061821-r
Matthias Sohn [Thu, 6 Dec 2018 23:20:43 +0000 (00:20 +0100)]
JGit v5.2.0.201812061821-r

Change-Id: I8528c913ad1a820ee9a2fa6be1c9125b518caefe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate Orbit to R20181128170323 for 2018-12 34/133534/1
Matthias Sohn [Wed, 5 Dec 2018 14:25:23 +0000 (15:25 +0100)]
Update Orbit to R20181128170323 for 2018-12

Change-Id: Ia3597d2d0609e5a0a67e5f2518f68ce99ab8aa3c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 5.3.0-SNAPSHOT builds 62/133362/1
Matthias Sohn [Mon, 3 Dec 2018 01:32:49 +0000 (02:32 +0100)]
Prepare 5.3.0-SNAPSHOT builds

Change-Id: I8951c2cf650cc3e41d2baa0b330b94468cfed5c2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.2' 61/133361/1
Matthias Sohn [Mon, 3 Dec 2018 01:32:05 +0000 (02:32 +0100)]
Merge branch 'stable-5.2'

* stable-5.2:
  Format lib/BUILD with buildifier
  Update Orbit to S20181128170323 for 2018-12 RC1
  Include id_ed25519 in the known default identity files
  Apache MINA sshd client: enable support for ed25519 keys
  Prepare 5.2.0-SNAPSHOT builds
  Set git environment variables for hooks
  JGit v5.2.0.201811281532-m3

Change-Id: If96adcbf35ccf8d9f4da0f5d97491f502f5a72a9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFormat lib/BUILD with buildifier 48/133348/3
David Pursehouse [Sun, 2 Dec 2018 12:02:22 +0000 (21:02 +0900)]
Format lib/BUILD with buildifier

Change-Id: I63db70e6e6f4da44a211621d8721ede66bce44bd
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpdate Orbit to S20181128170323 for 2018-12 RC1 58/133358/1
Matthias Sohn [Sun, 2 Dec 2018 23:05:14 +0000 (00:05 +0100)]
Update Orbit to S20181128170323 for 2018-12 RC1

Change-Id: I4f66b907d8027cae779f54ef0bdc5d36b4a21f6f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoInclude id_ed25519 in the known default identity files 52/133352/1
Thomas Wolf [Sun, 2 Dec 2018 15:35:12 +0000 (16:35 +0100)]
Include id_ed25519 in the known default identity files

Change-Id: I9fb30c8fbb65536782ee73644c8990eb6661c660
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoApache MINA sshd client: enable support for ed25519 keys 18/132718/4
Thomas Wolf [Mon, 19 Nov 2018 22:11:13 +0000 (23:11 +0100)]
Apache MINA sshd client: enable support for ed25519 keys

Include the net.i2p.crypto.eddsa bundle via a hard dependency.

Add tests for dealing with ed25519 host keys and user key files.

Manual tests: fetching from git.eclipse.org with an ed25519 user key,
and pushing this change itself using the same ed25519 key.

Note that sshd 2.0.0 does not yet support encrypted ed25519 private
keys.

Bug: 541272
Change-Id: I7072f4014d9eca755b4a2412e19c086235e5eae9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoMerge "Set git environment variables for hooks" into stable-5.2
Thomas Wolf [Sun, 2 Dec 2018 10:34:18 +0000 (05:34 -0500)]
Merge "Set git environment variables for hooks" into stable-5.2

5 years agoUpgrade spotbugs-maven-plugin to 3.1.9 44/133344/2
Michael Keppler [Sun, 2 Dec 2018 07:25:09 +0000 (08:25 +0100)]
Upgrade spotbugs-maven-plugin to 3.1.9

Change-Id: Idc447dfbcd165ef0362142bd17434d304c6c7f01
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
5 years agoPrepare 5.2.0-SNAPSHOT builds 32/133332/1
Matthias Sohn [Fri, 30 Nov 2018 21:57:04 +0000 (22:57 +0100)]
Prepare 5.2.0-SNAPSHOT builds

Change-Id: I18646aaeee51047b234b758dcc1c2f89fd01b2f8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoSet git environment variables for hooks 74/133174/2
Thomas Wolf [Wed, 28 Nov 2018 10:06:08 +0000 (11:06 +0100)]
Set git environment variables for hooks

Set GIT_DIR and GIT_WORK_TREE when calling hooks.

Bug: 541622
Change-Id: I6153d8a6a934ec37a3a5e7319c2d0e516f539ab7
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoJGit v5.2.0.201811281532-m3 13/133213/1 v5.2.0.201811281532-m3
Matthias Sohn [Wed, 28 Nov 2018 20:35:26 +0000 (21:35 +0100)]
JGit v5.2.0.201811281532-m3

Change-Id: I79988b473d67e565d8f6bcac40ee9a14b26c9e60
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUpdate Apache commons compress to 1.18.0 04/133204/1
Matthias Sohn [Wed, 28 Nov 2018 18:26:55 +0000 (19:26 +0100)]
Update Apache commons compress to 1.18.0

to consume fix for vulnerability [1] in Apache commons compress which is
fixed in version 1.18.

[1] https://nvd.nist.gov/vuln/detail/CVE-2018-1324

CQ: 18320
Change-Id: I39b1d815e5b8e0208600afafe7a72bb603d04fb8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix running tests from bazel 03/133203/1
Matthias Sohn [Wed, 28 Nov 2018 19:16:23 +0000 (20:16 +0100)]
Fix running tests from bazel

The new dependency to mockito for JDKHttpConnectionTest wasn't added for
bazel test run.

Change-Id: Ie967b7152340a0b3e05cced7eadfd40af78d9995
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUpdate Orbit to I20181128011035 88/133188/1
Matthias Sohn [Wed, 28 Nov 2018 15:43:44 +0000 (16:43 +0100)]
Update Orbit to I20181128011035

to consume fix for vulnerability [1] in Apache commons compress which is
fixed in version 1.18.

[1] CVE-2018-1324

CQ: 18320
Change-Id: I01e435fda834bbb22892a1cfba411d0196d7de17
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUpdate bcprov-jdk15on used in tests to 1.59 55/133155/2
Matthias Sohn [Wed, 28 Nov 2018 00:51:44 +0000 (01:51 +0100)]
Update bcprov-jdk15on used in tests to 1.59

CQ: 15889
Change-Id: I04c9099941dd1929cd9075ad6c89660a63e7de8f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge "Fix IndexDiffs for git links"
Christian Halstrick [Wed, 28 Nov 2018 11:11:05 +0000 (06:11 -0500)]
Merge "Fix IndexDiffs for git links"

6 years agoMerge branch 'stable-5.1' 16/133116/1
David Pursehouse [Tue, 27 Nov 2018 11:01:40 +0000 (20:01 +0900)]
Merge branch 'stable-5.1'

* stable-5.1:
  Fix DescribeCommand with multiple match options
  Fix git-describe tie-breakers

Change-Id: I64d9b0099fc0d8449ec08f0b5653572b5c2f840f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-5.0' into stable-5.1 15/133115/1
David Pursehouse [Tue, 27 Nov 2018 11:01:06 +0000 (20:01 +0900)]
Merge branch 'stable-5.0' into stable-5.1

* stable-5.0:
  Fix DescribeCommand with multiple match options
  Fix git-describe tie-breakers

Change-Id: I63e7a56bb617b5ce8774e1dc7f5efdde25e7cd97
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.11' into stable-5.0 14/133114/1
David Pursehouse [Tue, 27 Nov 2018 10:50:54 +0000 (19:50 +0900)]
Merge branch 'stable-4.11' into stable-5.0

* stable-4.11:
  Fix DescribeCommand with multiple match options
  Fix git-describe tie-breakers

Change-Id: Ibb98f143ee0ce7635beb30ec404b4134a73788f6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRemove unused externalized text "submodulesNotSupported" 38/133038/2
Matthias Sohn [Sun, 25 Nov 2018 21:33:22 +0000 (22:33 +0100)]
Remove unused externalized text "submodulesNotSupported"

This text is unused since d72b9328.

Change-Id: I82e5652e205d7b238ff8adc21994029b828b09f4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix IndexDiffs for git links 57/128057/3
Thomas Wolf [Fri, 24 Aug 2018 23:58:09 +0000 (01:58 +0200)]
Fix IndexDiffs for git links

After cloning a repo with a submodule, non-recursively, JGit would
encounter in its TreeWalk in IndexDiff:

* first, a missing gitlink (in index & HEAD, not in working tree)
* second, the untracked folder (not in index and head, in working tree)

As a result, it would report the submodule as missing. Canonical git
reports a clean workspace.

The root cause of this is that the path of a gitlink "x" did
not compare equal to the path of a tree "x" in JGit.

Correct Paths.compare() to account for that. If two paths are otherwise
equal, then let gitlinks match both trees and files. Matching trees
solves the bug. Matching files is necessary to handle the case where
the gitlink directory was replaced by a file; see the new test case
IndexDiffSubmoduleTest.testSubmoduleReplacedByFile(). Comparisons of
unequal paths are left untouched, so the sort order is unchanged.

After the fix, another bug(?) in WorkingTreeIterator became apparent:
with core.dirNoGitLinks = true, it was no longer possible to overwrite
a gitlink in the index. This is now fixed in WorkingTreeIterator.

Add new test cases for the bug itself and for some related cases
(submodule directory deleted or replaced by a file) in
IndexDiffSubmoduleTest. Add a test for missing files in IndexDiffTest,
and adapt the PathsTest to test matching gitlinks.

Bug: 467631
Change-Id: I0549d10d46b1858e5eec3cc15095aa9f1d5f5280
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoFix DescribeCommand with multiple match options 39/133039/2
Matthias Sohn [Sun, 25 Nov 2018 22:15:11 +0000 (23:15 +0100)]
Fix DescribeCommand with multiple match options

when multiple match options are given in git describe the result must
not depend on the order of the match options. JGit wrongly picked the
first match using the match options in the order they were defined. Fix
this by concatenating the streams of matching tags for all match options
and then choosing the first match on the concatenated stream sorted in
tie break order.

See https://git-scm.com/docs/git-describe#git-describe---matchltpatterngt

Change-Id: Id01433d35fa16fb4c30526605bee041ac1d954b2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoAdd a method to get all values of HTTP header defined as list 22/132722/9
Matthias Sohn [Tue, 20 Nov 2018 00:00:30 +0000 (16:00 -0800)]
Add a method to get all values of HTTP header defined as list

According to RFC 2616 [1] header field names are case insensitive.
Header fields defined as a comma separated list can have multiple header
fields with the same field name. Add a method to HttpConnection which
retrieves all values with a given header field name with the field name
compared case insensitive.

[1] https://tools.ietf.org/html/rfc2616#section-4.2"

Change-Id: I7f601b21cda99e84f43f866c7c7cb4cb0e3cf5c3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUndo treating blobs with NULs as a single line 45/132745/4
Thomas Wolf [Tue, 20 Nov 2018 11:24:38 +0000 (12:24 +0100)]
Undo treating blobs with NULs as a single line

This partially reverts commit a551b646: revert the changes in
RawParseUtils.lineMap(). Forcing all blobs containing a NUL byte
as a single line causes blame to produce useless results as soon
as it hits any version containing a NUL byte.

Doing binary detection at this level also has the problem that the
user cannot control it. Not by setting the text attribute nor in any
other way.

This came up in bug 541036, where a Java source inadvertently
contained NUL bytes in strings. Even fixing this by using escapes
"\000" will not fix JGit's blame for this file because the past
versions will still contain the NUL byte.

Native git can blame that file from bug 541036 fine.

Added new tests verifying that blaming a text file containing a NUL
byte produces sensible results.

Bug: 541036
Change-Id: I8991bec88e9827cc096868c6026ea1890b6d0d32
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoUpdate Ant to 1.10.5 70/132870/1
Matthias Sohn [Thu, 22 Nov 2018 00:15:31 +0000 (01:15 +0100)]
Update Ant to 1.10.5

CQ: 18322
Change-Id: I88982116e02598b0ac658c4d740d7a7c1e37280a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUpdate Orbit to S20181120221132 for 2018-12 68/132868/1
Matthias Sohn [Wed, 21 Nov 2018 23:21:18 +0000 (00:21 +0100)]
Update Orbit to S20181120221132 for 2018-12

Change-Id: Ice169d000e4757732e847ba5e2ea5e59945a09e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUpdate mockito to 2.13.0 34/132834/2
Matthias Sohn [Wed, 21 Nov 2018 14:14:35 +0000 (15:14 +0100)]
Update mockito to 2.13.0

Update mockito and its dependencies to latest version available in
Orbit:
- mockito 2.13.0.v20180426-1843
- net.bytebuddy.byte-buddy 1.7.9.v20180420-1519
- net.bytebuddy.byte-buddy-agent 1.7.9.v20180420-1519
- org.objenesis 2.6.0.v20180420-1519

CQ: 18301
CQ: 18303
CQ: 18319
Change-Id: I3dd01e5b0b5a023fcb6530e8ec76729cfc41d735
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove unnecessary modifiers from interfaces 05/132805/1
Jonathan Nieder [Wed, 21 Nov 2018 00:18:44 +0000 (16:18 -0800)]
Remove unnecessary modifiers from interfaces

This continues what commit d9ac7ddf1026123fee6c4477d172d614522dfc08
(Remove unnecessary modifiers from interfaces, 2018-11-15) started.

Change-Id: I89720985a5a986722a0dcb9b5e9bbc25996bd5b3

6 years agoNew GpgConfig for typed access to GPG settings 42/131642/5
Gunnar Wagenknecht [Tue, 30 Oct 2018 12:44:24 +0000 (13:44 +0100)]
New GpgConfig for typed access to GPG settings

Change-Id: Ifece38132e0390931d33b5678bbbd4a43f9099da
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
6 years agoRevert C Git 1.7.5 bug workaround 56/132256/9
Masaya Suzuki [Sun, 11 Nov 2018 20:31:22 +0000 (12:31 -0800)]
Revert C Git 1.7.5 bug workaround

This reverts the workaround introduced by
1c6c73c5a9b8dd700be45d658f165a464265dba7, which is a patch for dealing
with a buggy C Git client v1.7.5 in 2012. We'll stop supporting very old
C Git clients.

Change-Id: I94999a39101c96f210b5eca3c2f620c15eb1ac1b
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
6 years agoApache MINA sshd client: don't leak HostConfigEntry 15/132615/2
Thomas Wolf [Sat, 17 Nov 2018 17:44:27 +0000 (18:44 +0100)]
Apache MINA sshd client: don't leak HostConfigEntry

ProxyDataFactory had a parameter of type HostConfigEntry, but actually
it wasn't used anywhere. Remove it -- it was the last leaked type from
Apache MINA sshd.

Also use the logger provided by upstream SshClient instead of creating
a new Logger.

Bug: 520927
Change-Id: Iaa78bbb998a5e574fa091664b75c48a3b9cfb897
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoApache MINA sshd client: test & fix password authentication 81/132581/3
Thomas Wolf [Fri, 16 Nov 2018 16:00:25 +0000 (17:00 +0100)]
Apache MINA sshd client: test & fix password authentication

Add tests for password and keyboard-interactive authentication.
Implement password authentication; the default provided by sshd
is non-interactive, which is not useful for JGit.

Make sure the CredentialsProvider gets reset on successive password
retrieval attempts. Otherwise it might always return the same non-
accepted password from a secure storage. (That one was discovered
by actually trying this via EGit; the JGit tests don't catch this.)

Change the default order of authentication mechanisms to prefer
password over keyboard-interactive. This is a mitigation for upstream
bug SSHD-866.[1]

Also include a fix for upstream bug SSHD-867.[2]

[1] https://issues.apache.org/jira/projects/SSHD/issues/SSHD-866
[2] https://issues.apache.org/jira/projects/SSHD/issues/SSHD-867

Bug: 520927
Change-Id: I423e548f06d3b51531016cf08938c8bd7acaa2a9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoMove SshTestGitServer to new bundle org.eclipse.jgit.junit.ssh 81/132181/11
Thomas Wolf [Thu, 8 Nov 2018 15:58:52 +0000 (16:58 +0100)]
Move SshTestGitServer to new bundle org.eclipse.jgit.junit.ssh

Create the bundle and move the SshTestGitServer there. Verified that
the Eclipse build still works and ran JSchSshTest and ApacheSshTest as
junit tests inside Eclipse.

Update maven build and features to account for that. Verified by
running full maven build including packaging.

Update bazel build files to account for that. Verified by a
clean-slate bazel build :all, followed by running the JSchSshTest
and the ApacheSshTest via bazel.

Change-Id: Ia084942f4425b454529de148e00417e7da786a90
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoApache MINA sshd client: proxy support 92/131892/17
Thomas Wolf [Sun, 21 Oct 2018 17:44:34 +0000 (19:44 +0200)]
Apache MINA sshd client: proxy support

This is not about the ssh config ProxyCommand but about programmatic
support for HTTP and SOCKS5 proxies. Eclipse allows the user to
specify such proxies, and JSch at least contains code to connect
through proxies. So our Apache MINA sshd client also should be able
to do this.

Add interfaces and provide two implementations for HTTP and SOCKS5
proxies. Adapt the core code to be able to deal with proxy connections
at all. The built-in client-side support for this in sshd 2.0.0 is
woefully inadequate.

Tested manually by running proxies and then fetching various real-
world repositories via these proxies from different servers. Proxies
tested: ssh -D (SOCKS, anonymous), tinyproxy (HTTP, anonymous), and
3proxy (SOCKS & HTTP, username-password authentication). The GSS-API
authentication is untested since I have no Kerberos setup.

Bug: 520927
Change-Id: I1a5c34687d439b3ef8373c5d58e24004f93e63ae
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoApache MINA sshd client: don't leak upstream classes and interfaces 00/132500/3
Thomas Wolf [Thu, 15 Nov 2018 15:33:04 +0000 (16:33 +0100)]
Apache MINA sshd client: don't leak upstream classes and interfaces

We will get an API evolution problem if we expose as API classes and
interfaces that derive from upstream classes or interfaces. Upstream
interfaces also evolve quite erratically and evolution doesn't seem
to follow semantic versioning.

Introduce a new KeyPasswordProvider interface so that we don't have
to depend on the upstream FilePasswordProvider in our API. (We do
need _some_ abstraction for getting passwords for encrypted keys in
the API; EGit will need to provide its own implementation.)

Move some other upstream dependencies (HostConfigEntry, and various
previously protected methods in SshdSessionFactory) out of the API:
classes moved to internal space, and methods made private.

The only dependencies on upstream interfaces are thus in a few method
parameter types. Those cannot be avoided, but should also not pose
problems.

Bug: 520927
Change-Id: Idc9c6b0f237f29f46343c0fe15179242f2007bec
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoRemove unnecessary modifiers from interfaces 33/132533/1
Ivan Frade [Fri, 16 Nov 2018 05:27:20 +0000 (21:27 -0800)]
Remove unnecessary modifiers from interfaces

From Oracle's "Defining an interface":

"All abstract, default, and static methods in an interface are
implicitly public, so you can omit the public modifier."

(Without any modifier, the interface methods are also abstract, so we
omit also the "abstract")

"In addition, an interface can contain constant declarations. All
constant values defined in an interface are implicitly public, static,
and final. Once again, you can omit these modifiers."

This makes the code more consistent. Now all interfaces under
org.eclipse.jgit follow the guidelines.

Change-Id: I4fe6deb111899ec1b4318ab5a6050f3851fa1fd3
Signed-off-by: Ivan Frade <ifrade@google.com>
6 years agoMerge "Call unlockPack in finally"
David Pursehouse [Thu, 15 Nov 2018 03:11:26 +0000 (22:11 -0500)]
Merge "Call unlockPack in finally"

6 years agoFormat org.eclipse.jgit.pgm/BUILD with buildifier 37/132437/1
David Pursehouse [Wed, 14 Nov 2018 16:06:45 +0000 (08:06 -0800)]
Format org.eclipse.jgit.pgm/BUILD with buildifier

Change-Id: I08de1e262c56ffdd9f4bc9b58f7b43964cce969a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAdd --ssh option to command-line commands 91/131891/10
Thomas Wolf [Thu, 18 Oct 2018 21:34:04 +0000 (23:34 +0200)]
Add --ssh option to command-line commands

Enables using the new ssh client based on Apache MINA sshd instead
of the old JSch client. The default is still JSch, so unless the
command is invoked with --ssh apache, there's no change.

I prefer this over some fiddling with the GIT_SSH environment variable
since that variable is handled in the JGit core bundle, which should
remain free of any dependency to org.eclipse.jgit.ssh.apache to avoid
problems in Gerrit or other JGit users that may use a different Apache
MINA sshd version.

Bug: 520927
Change-Id: I8460759c7113ef7887520fb0d297aa312200c69f
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoApache MINA sshd: use NumberOfPasswordPrompts for encrypted keys 90/131890/10
Thomas Wolf [Wed, 17 Oct 2018 18:22:26 +0000 (20:22 +0200)]
Apache MINA sshd: use NumberOfPasswordPrompts for encrypted keys

sshd only asks exactly once for the password. C.f. upstream issue
SSHD-850.[1] So we have to work around this limitation for now.
Once we move to sshd > 2.1.0, this can be simplified somewhat.

[1] https://issues.apache.org/jira/browse/SSHD-850

Bug: 520927
Change-Id: Id65650228486c5ed30affa9c62eac982e01ae207
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoMerge "Format BUILD files with buildifier"
David Pursehouse [Wed, 14 Nov 2018 05:27:01 +0000 (00:27 -0500)]
Merge "Format BUILD files with buildifier"

6 years agoFormat BUILD files with buildifier 83/132383/2
David Pursehouse [Wed, 14 Nov 2018 02:01:21 +0000 (18:01 -0800)]
Format BUILD files with buildifier

Change-Id: I7eb83e0560b1826c4f8567e9bc5fbdb2ae3fe9d0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoApache MINA sshd client: properly handle HostKeyAlgorithms config 89/131889/9
Thomas Wolf [Fri, 5 Oct 2018 19:35:16 +0000 (21:35 +0200)]
Apache MINA sshd client: properly handle HostKeyAlgorithms config

By default sshd will use its default built-in list, which matches
the one of openssh (as far as the algorithms exist in sshd at all).
But it doesn't handle HostKeyAlgorithms from the ssh config at all.

Implement this as in openssh, including the '+' and '-' modifiers
and reordering the default if there are known host keys for a
server already.

Add tests for the reordering.

Also use a more robust reader for the known hosts file. The default
aborts on the first error.

Bug: 520927
Change-Id: Ib1684440bfe2e96140536aa1a93c4bd4a0d35916
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoApache MINA sshd client: respect NumberOfPasswordPrompts 88/131888/9
Thomas Wolf [Wed, 3 Oct 2018 06:27:40 +0000 (08:27 +0200)]
Apache MINA sshd client: respect NumberOfPasswordPrompts

Set the internal property on the session as defined in the ssh config.

Note that NumberOfPasswordPrompts in openssh applies independently to
both user logins in keyboard-interactive authentication _and_ to
passphrases for identity files (encrypted keys). Apache MINA sshd uses
the setting only for keyboard-interactive authentication, but not for
identity file passphrase prompts. For identity files, it asks exactly
once. This has been reported as issue SSHD-850 upstream.[1]

[1] https://issues.apache.org/jira/browse/SSHD-850

Bug: 520927
Change-Id: I390ffe9e1c52b96d3e8e28fd8edbdc73dde9edb4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoApache MINA sshd client: add gssapi-with-mic authentication 87/131887/9
Thomas Wolf [Tue, 2 Oct 2018 20:39:40 +0000 (22:39 +0200)]
Apache MINA sshd client: add gssapi-with-mic authentication

sshd does support gssapi-with-mic on the server side, but has no
built-in client-side support for this authentication mechanism.

Add our own implementation for it, following RFC 4462.[1] To avoid
needlessly re-trying mechanisms that aren't even configured on the
client, we disable mechanisms that fail on the very first attempt
to use them.

Since we have no real Kerberos5 test setup, this cannot be fully
tested in CI. The disabling of the authentication mechanism and
that it is skipped when not successful _is_ tested.

[1] https://www.ietf.org/rfc/rfc4462.txt

Bug: 520927
Change-Id: I5d0cdb14103588a57c52f927df541b589ab88d88
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoAdd ssh tests for PreferredAuthentications 86/131886/9
Thomas Wolf [Mon, 1 Oct 2018 21:27:10 +0000 (23:27 +0200)]
Add ssh tests for PreferredAuthentications

Tests that it works with unknown authentications in the list, and
fails if there are no common authentications between server and
client. The latter also tests that the ssh config setting is taken
into account at all.

And promptly the JGit sshd client didn't. Add a fix for this. It's
a tiny bit hacky: Apache MINA looks up a custom property set on a
hierarchy of "PropertyResolver"s starting with the session. On the
session itself this property can never be set since it's read
already in the session constructor before anyone had any chance
to set it. The next element in the resolver hierarchy is the sshd
SshClient, and so we set that property there. Since we use one
SshClient and one ClientSession per JGit SshdSession, this is OK.

Bug: 520927
Change-Id: I62446fc1fffde125a8965c030240f0918ae234b7
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoAdd features for the Apache MINA sshd implementation 85/131885/9
Thomas Wolf [Thu, 1 Nov 2018 10:28:15 +0000 (11:28 +0100)]
Add features for the Apache MINA sshd implementation

Bug: 520927
Change-Id: Ida3e218e0552848ef6285de1dc1e41866f7f873e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoApache MINA sshd client 84/131884/9
Thomas Wolf [Sun, 23 Sep 2018 14:45:45 +0000 (16:45 +0200)]
Apache MINA sshd client

Add a new ssh client implementation based on Apach MINA sshd 2.0.0.

This implementation uses JGit's own config file parser and host entry
resolver. Code inspection of the Apache MINA implementation revealed
a few bugs or idiosyncrasies that immediately would re-introduce bugs
already fixed in the past in JGit.

Apache MINA sshd is not without quirks either, and I had to configure
and override more than I had expected. But at least it was all doable
in clean ways.

Apache MINA boasts support for Bouncy Castle, so in theory this should
open the way to using more ssh key algorithms, such as ed25519.

The implementation is in a separate bundle and is still not used in
the core org.eclipse.jgit bundle. The tests re-use the ssh tests from
the core test bundle.

Bug: 520927
Change-Id: Ib35e73c35799140fe050d1ff4fb18d0d3596580e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoAdd more ssh tests: pushing, known_host file handling, etc. 83/131883/8
Thomas Wolf [Sun, 23 Sep 2018 13:44:10 +0000 (15:44 +0200)]
Add more ssh tests: pushing, known_host file handling, etc.

Add support for git-receive-pack to the ssh git server and add two
new tests for pushing.

This actually uncovered an undocumented requirement in TransportSftp:
the FTP rename operation assumes POSIX semantics, i.e., that the
target is removed. This works as written only for servers that
support and advertise the "posix-rename@openssh.com" FTP extension.

Our little Apache MINA server does not advertise this extension.

Fix the FtpChannel implementation for Jsch to handle this case in a
meaningful way so that it can pass the new "push over sftp" test.

Add more tests to test the behavior of server host key checking.

Also refactor the tests generally to separate better the test
framework from the actual tests.

Bug: 520927
Change-Id: Ia4bb85e17ddacde7b36ee8c2d5d454bbfa66dfc3
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoTransportSftp: eliminate dependency on Jsch 82/131882/8
Thomas Wolf [Mon, 17 Sep 2018 18:36:36 +0000 (20:36 +0200)]
TransportSftp: eliminate dependency on Jsch

Introduce an FtpChannel abstraction, which can be obtained from a
RemoteSession. In JSchSession, wrap a JSch ChannelSftp as such an
FtpChannel. The JSch-specific SftpException is also mapped to a
generic FtpException. Rewrite TransportSftp to use only the new
abstraction layer.

This makes it possible to provide alternate ssh/sftp implementations.

Bug: 520927
Change-Id: I379026f7d4122f34931df909a28e73c02cd8a1da
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoUpgrade maven-shade-plugin to 3.2.1 92/132292/1
David Pursehouse [Mon, 12 Nov 2018 16:34:08 +0000 (08:34 -0800)]
Upgrade maven-shade-plugin to 3.2.1

Change-Id: I4f194008bb02ab58eba6d44d1be0424c47be4d81
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoCall unlockPack in finally 55/132255/2
Masaya Suzuki [Sun, 11 Nov 2018 20:27:47 +0000 (12:27 -0800)]
Call unlockPack in finally

The lock is obtained in receivePackAndCheckConnectivity. It seems to me
the structure that requres the caller to unlock the lock is wrong, but
at least by calling in finally ensures it is called even if an exception
is thrown.

Change-Id: I123841b017baf5acffe0064d1004ef11a0a5e6c2
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
6 years agoRemove line break from sslFailureInfo text 46/131546/3
Michael Keppler [Sun, 11 Nov 2018 10:35:44 +0000 (11:35 +0100)]
Remove line break from sslFailureInfo text

Do not add an artificial line break to the message, since it may become
much wider due to the embedded exception messages anyway.

The layout shall be controlled by the egit supplied message dialog using
layout constraints.

Bug: 540537
Change-Id: I4257b52e5e59689dfcbab47bd7c075b3fd031837
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
6 years agoFix git-describe tie-breakers 43/131843/7
Håvard Wall [Wed, 17 Oct 2018 13:34:51 +0000 (15:34 +0200)]
Fix git-describe tie-breakers

Correct behaviour as git 1.7.1.1 is to resolve tie-breakers to choose
the most recent tag.

https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.1.1.txt:
* "git describe" did not tie-break tags that point at the same commit
   correctly; newer ones are preferred by paying attention to the
   tagger date now.

Bug: 538610
Change-Id: Ib0b2a301997bb7f75935baf7005473f4de952a64
Signed-off-by: Håvard Wall <haavardw@gmail.com>
6 years agoMerge changes I97c062d0,Ib4e1f37c
David Pursehouse [Fri, 9 Nov 2018 03:51:48 +0000 (22:51 -0500)]
Merge changes I97c062d0,Ib4e1f37c

* changes:
  Simplify RevWalk#iterator by factoring out common code
  Simplify exception handling in RevWalk#iterator

6 years agoSimplify RevWalk#iterator by factoring out common code 61/132161/2
Jonathan Nieder [Fri, 9 Nov 2018 02:11:57 +0000 (18:11 -0800)]
Simplify RevWalk#iterator by factoring out common code

Factor out a helper that calls next() and tunnels IOException in a
RuntimeException, similar to TunnelException.tunnel(RevWalk::next) in
Guava terms[1].

This should make the code a little more readable.  No functional
change intended.

[1] https://github.com/google/guava/issues/2828#issuecomment-304187823

Change-Id: I97c062d03a17663d5c40895fd3d2c6a7306d4f39
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoSimplify exception handling in RevWalk#iterator 60/132160/1
Jonathan Nieder [Fri, 9 Nov 2018 01:55:19 +0000 (17:55 -0800)]
Simplify exception handling in RevWalk#iterator

MissingObjectException and IncorrectObjectTypeException are subclasses
of IOException.

Change-Id: Ib4e1f37ce1b0b08e69ba3375bbdb6ee82ee4f036
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoDepthGenerator: fix multi-child boundary handling 57/132157/1
Jonathan Tan [Thu, 8 Nov 2018 22:46:10 +0000 (14:46 -0800)]
DepthGenerator: fix multi-child boundary handling

Suppose that a repository has the following commit graph:

 B   C
  \ /
   A

and it was cloned with --shallow-exclude=A. DepthGenerator does not mark
C as shallow, causing an invalid repository to be produced on the
client, because A is not sent. (A similar issue occurs when
--shallow-since is used to exclude A but neither B nor C.)

This happens whenever an excluded commit has more than one child that is
to be sent to the client. Fix DepthGenerator to handle this case
correctly.

While we're editing DepthWalk.Commit, fix the documentation of
DepthWalk.Commit#isBoundary.

Change-Id: I7068abf0fe0c864d1b0e56e1616dad1aa8719411
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoBazel: Increase severity of ClassCanBeStatic to ERROR 98/132098/1
David Pursehouse [Thu, 8 Nov 2018 02:09:54 +0000 (11:09 +0900)]
Bazel: Increase severity of ClassCanBeStatic to ERROR

Change-Id: I8250fd15cfff6bbba54a238be31b3cf772edab3f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoSshTestBase: Make inner class TestCredentialsProvider static 97/132097/1
David Pursehouse [Thu, 8 Nov 2018 02:09:26 +0000 (11:09 +0900)]
SshTestBase: Make inner class TestCredentialsProvider static

Change-Id: Id5ba87b24e8a29157d49e9e5b151d65bdbcab37a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoorg.eclipse.jgit.test/BUILD: Format with buildifier 21/132021/1
David Pursehouse [Wed, 7 Nov 2018 06:56:05 +0000 (15:56 +0900)]
org.eclipse.jgit.test/BUILD: Format with buildifier

Change-Id: Ia70f2af8f8c7a85f891a1963ab146695262e7ce2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoBazel: Consume versions directly from lib:versions.bzl in skylib 20/132020/1
David Pursehouse [Wed, 7 Nov 2018 06:55:35 +0000 (15:55 +0900)]
Bazel: Consume versions directly from lib:versions.bzl in skylib

Avoid loading versions from @bazel_skylib//:lib.bzl, because it is now
deprecated and is going to be removed in future skylib versions:

https://github.com/bazelbuild/bazel-skylib/blob/master/lib.bzl#L17

Change-Id: Ie722351de5254f611cf3489c8689922c8346af7f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFactor out a JSch-independent ssh config parser 80/131880/6
Thomas Wolf [Fri, 21 Sep 2018 20:43:34 +0000 (22:43 +0200)]
Factor out a JSch-independent ssh config parser

Move the bulk of the basic parsing and host entry handling into a
new class OpenSshConfigFile that has no dependencies on any concrete
ssh implementation. Make the existing OpenSshConfig use the new
parser.

Introduce a new class SshConstants collecting all the various ssh-
related string literals. Also use TreeMaps with a case-insensitive
key comparator instead of converting keys to uppercase. Add a test
to verify that keys are matched case-insensitively.

Most of the parsing code was simply moved, except that the new
parser supports looking up entries given host name, port, and user
name, and can thus handle more %-substitutions correctly. This
feature is not yet used and cannot be used with JSch since JSch
only has a ConfigRepository.getConfig(String) interface.

The split is still worth the trouble as it opens the way to using
another ssh client altogether. Apache MINA sshd, for instance,
resolves host entries giving host name, port, and user name.

(Apache MINA has a built-in ssh config handling, but that has
problems, too: its pattern matching is case-insensitive, and its
merging of host entries if several match is not the same as in
OpenSsh. But with this refactoring, it will be possible to plug in
OpenSshConfigFile into an Apache MINA sshd  client without dragging
along JSch.)

One test case that doesn't make sense anymore has been removed. It
tested that repeatedly querying for a host entry returned the same
object. That is no longer true since the caching has been moved to
a deeper level.

Bug: 520927
Change-Id: I6381d52b29099595e6eaf8b05c786aeeaefbf9cc
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoSsh tests with an Apache MINA sshd test git server 79/131879/6
Thomas Wolf [Fri, 14 Sep 2018 20:40:08 +0000 (22:40 +0200)]
Ssh tests with an Apache MINA sshd test git server

Add a simple ssh git server based on Apache MINA sshd, and use it
in new tests that verify ssh operations and in particular a number
of bugs that had cropped up over time in JSch.

The git server supports fetching only, and sftp access.

The tests are all in an abstract base class; the concrete JschSshTest
class only provides ssh-specific test setup. So the same tests could
be run easily also with some other ssh client.

Bug: 520927
Change-Id: Ide6687b717fb497a29fc83f22b07390a26dfce1d
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoBazel: Format tools/BUILD with buildifier 55/131955/1
David Pursehouse [Tue, 6 Nov 2018 04:50:04 +0000 (13:50 +0900)]
Bazel: Format tools/BUILD with buildifier

Change-Id: I292613a0e40d2022bc68c6acbd45d37a54c1e613
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge changes I91883560,I1b12a976
David Pursehouse [Mon, 5 Nov 2018 23:24:08 +0000 (18:24 -0500)]
Merge changes I91883560,I1b12a976

* changes:
  Fix package exports in org.eclipse.jgit MANIFEST.MF
  TransportSftp: remove final modifiers from parameters

6 years agoFix package exports in org.eclipse.jgit MANIFEST.MF 44/131944/1
Thomas Wolf [Mon, 5 Nov 2018 11:56:36 +0000 (12:56 +0100)]
Fix package exports in org.eclipse.jgit MANIFEST.MF

Do not export o.e.j.internal.transport.parser as public package;
restrict visibility to org.eclipse.jgit.test only.

Add two packages that were not listed at all (o.e.j.internal.revwalk
and o.e.j.internal.submodule) marked as x-internal:=true.

Change-Id: I9188356075515ad354b724102fbd6304b682de6a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoTransportSftp: remove final modifiers from parameters 81/131881/5
Thomas Wolf [Mon, 17 Sep 2018 18:25:01 +0000 (20:25 +0200)]
TransportSftp: remove final modifiers from parameters

Change-Id: I1b12a9765575a1368e0c6bd11d87084b2064a17e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoUpgrade Spotbugs to 3.1.8 25/131925/1
David Pursehouse [Mon, 5 Nov 2018 10:27:08 +0000 (19:27 +0900)]
Upgrade Spotbugs to 3.1.8

Change-Id: Ie283ab9d9925c4eae3fad2a3ad2d94bdcb80f75f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>