Commit Graph

6292 Commits

Author SHA1 Message Date
Jonathan Nieder aa095af791 Merge "UploadPack: avoid conflating shallow commit lists in protocol v2" 2018-08-30 17:19:38 -04:00
Ivan Frade e665e3fcd4 UploadPack: avoid conflating shallow commit lists in protocol v2
At the moment there are two copies of the client shallow commit list:
one in the request and another in the clientShallowCommits member of
the class.

The verifyShallowCommit function was removing missing object ids
from the member but not the request list, and code afterwards was
using the request's version.

In practice, this didn't cause trouble because these shallow commits
are used as endpoint for a walk, and missing ids are just never reached.

Change-Id: I70a8f1fd46de135da09f16e5d954693c8438ffcb
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-08-30 13:09:50 -07:00
David Pursehouse af547cf00d Bazel: Use hyphen instead of underscore in external repository names
Recent Bazel versions support the hyphen character in external
repository names. On the Gerrit project, the repository names
were harmonized to consistently use hyphen.

As a side effect, it is no longer possible to build jgit from source
in the gerrit tree, due to the different repository names.

Rename the dependencies to use hyphens, consistent with gerrit.

Change-Id: Ideebd858ddd3f0e6f765643001642dfb6c12441f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-30 15:28:06 +09:00
David Pursehouse 487571e604 Bazel: Format all build files with buildifier 0.15.0
Change-Id: I8343b723da6e40d5ae7fc45c84f64c31276bd5dc
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-30 15:27:20 +09:00
David Pursehouse ee56e5fc04 ChangeIdUtilTest: Remove unused notestCommitDashV
This test was never being run. Since it was introduced it was
named "notest.." which meant it didn't run with JUnit3, and
since it is not annotated @Test it also doesn't run with JUnit4.

When compiling with Bazel 0.6.0, error-prone raises an error
that the public method is not annotated with @Ignore or @Test.

Given that the test has never been run anyway, we can just
remove it.

Bug: 525415
Change-Id: Ie9a54f89fe42e0c201f547ff54ff1d419ce37864
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-30 15:25:38 +09:00
David Pursehouse 19222ce7c4 Bazel: Use hyphen instead of underscore in external repository names
Recent Bazel versions support the hyphen character in external
repository names. On the Gerrit project, the repository names
were harmonized to consistently use hyphen.

As a side effect, it is no longer possible to build jgit from source
in the gerrit tree, due to the different repository names.

Rename the dependencies to use hyphens, consistent with gerrit.

Change-Id: Ideebd858ddd3f0e6f765643001642dfb6c12441f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-30 13:51:11 +09:00
David Pursehouse afbc55aa22 Format BUILD files with buildifier 0.15.0
Change-Id: I6200b0040d24da86968c688f45a2056343e182be
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-30 08:56:19 +09:00
Matthias Sohn aa5007c576 Merge branch 'stable-5.1'
* stable-5.1:
  Adjust severity of missing execution environment for LFS
  Prepare 5.1.0-SNAPSHOT builds
  JGit v5.1.0.201808281540-m3

Change-Id: Iebe26d872b92a347eea479a136a4a2bac726b0bb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-29 23:21:02 +02:00
Markus Duft c64de36a06 Adjust severity of missing execution environment for LFS
All other JGit bundles use severity warning for missing execution
environment definition. Use the same configuration for LFS bundles.

Bug: 488123
Change-Id: I575d6d61418f5c4e39303fb8a9cd69e6539f6b5e
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
2018-08-29 23:18:51 +02:00
Matthias Sohn a6d641a03b Prepare 5.1.0-SNAPSHOT builds
Change-Id: If57fcce14f5ba3ef2a2602515e2f89b8f22a742b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-29 13:51:08 +02:00
David Pursehouse c70c51fdd1 Upgrade maven-compiler-plugin to 3.8.0
Change-Id: I545095f9ee7481c73765d029f9a32edf01625893
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-29 13:05:06 +09:00
Matthias Sohn a7ad89e974 JGit v5.1.0.201808281540-m3
Change-Id: Ie86c46a828b55a2235056b9a5bc2c6c450b95ed0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-28 21:41:37 +02:00
Matthias Sohn e0b24c62e8 Update Orbit to S20180820175350 for 2018-09 M3
Change-Id: Ifecbe9a7f36e65a191f007f0216633e9038ebff9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-28 21:02:41 +02:00
Matthias Sohn c253935f3a Add ls-files CLI command
Implement the basic functionality and support the option --help (-h).

Change-Id: Ibcdf0c958d0f93b7415d4e591b1455ccba5d95f7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-28 01:52:06 +02:00
David Pursehouse 4c77f62ccf Merge branch 'stable-5.0'
* stable-5.0:
  Fix NoSuchFileException in GC.deleteTempPacksIdx()
  Fix NoSuchFileException during directory cleanup in RefDirectory

Change-Id: I35bd4bcbeac2430f674ccb6b947ac3776cec8a82
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-27 21:12:59 +02:00
Matthias Sohn cf60f26d26 Merge "Externalize warning message in RefDirectory.delete()" 2018-08-27 15:05:09 -04:00
Christian Halstrick 074168f2de Merge "Cleanup existing tests" 2018-08-27 07:16:58 -04:00
Matthias Sohn 5e68fe245f Externalize warning message in RefDirectory.delete()
Change-Id: Icec16c01853a3f5ea016d454b3d48624498efcce
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-27 10:52:20 +02:00
Matthias Sohn ddf56d6f85 Fix NoSuchFileException in GC.deleteTempPacksIdx()
This exception is thrown in GC.deleteTempPacksIdx() if the repository
has no packs.

Bug: 538286
Change-Id: Ieb482be751226baf0843068a0f847e0cdc6e0cb6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-27 09:12:14 +02:00
Matthias Sohn 8ab89ef066 Fix NoSuchFileException during directory cleanup in RefDirectory
Bug: 538285
Change-Id: Iab5c381a412cb2c2176af55189668c267ed29fbc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-27 09:12:02 +02:00
David Pursehouse e5b72a4d36 HttpClientConnectionTest: Throw UnsupportedOperationException for unused methods
The HttpResponseMock class is only used in a single test to assert
on the expected headers. All of its overridden methods are empty, and
this results in warnings in Eclipse:

  'Empty block should be documented'

Rather than adding "// Not used" comments, change all of the methods'
implementations to throw UnsupportedOperationException. This not only
gets rid of the warnings, but also makes it explicit that we don't
intend any of them to actually be called.

Change-Id: I8fe06b155e0809bb3507e4e28b00fcc4f9333b0b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-27 08:52:34 +09:00
David Pursehouse 0a13545966 HttpClientConnectionTest: Reformat with the Eclipse style
Change-Id: I1066dea0bbb4573aabaf417365fb46772f0f4d0e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-27 08:51:44 +09:00
David Pursehouse 6e797bc74a HttpClientConnectionTest: Add missing license header
Change-Id: I9e4bd2bfe16f4824eb8ed7ccfab332646b3233b1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-27 08:40:24 +09:00
Matthias Sohn 851f239951 Merge branch 'stable-5.0'
* stable-5.0:
  Silence API warning for new ObjectIdSerializer introduced in 4.11.1
  Ignore API warnings
  Fix photon target platform to use photon version of org.eclipse.osgi
  Update Photon orbit repository to R20180606145124
  Suppress warning for trying to delete non-empty directory
  Fix fetching with duplicate ref updates
  Fetch(Process): should tolerate duplicate refspecs
  FetchCommandTest: test add/update/delete fetch

Change-Id: I9e7fa37b100a7ea3cbe4104802d36c6f38df9e08
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-25 16:14:22 +02:00
Matthias Sohn cde0e31381 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Silence API warning for new ObjectIdSerializer introduced in 4.11.1
  Ignore API warnings
  Fix photon target platform to use photon version of org.eclipse.osgi
  Update Photon orbit repository to R20180606145124
  Suppress warning for trying to delete non-empty directory
  Fix fetching with duplicate ref updates
  Fetch(Process): should tolerate duplicate refspecs
  FetchCommandTest: test add/update/delete fetch

Change-Id: I2497f99b7d0686a0e0f773c39c8725e813ce9d4a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-25 08:56:45 +02:00
Matthias Sohn 2dfc9ed6d2 Silence API warning for new ObjectIdSerializer introduced in 4.11.1
Change-Id: Ic271dae300f7554b7e13bb1f44006e5b38c00011
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-25 08:02:31 +02:00
Matthias Sohn 6670ff1663 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Ignore API warnings
  Fix photon target platform to use photon version of org.eclipse.osgi
  Update Photon orbit repository to R20180606145124
  Suppress warning for trying to delete non-empty directory
  Fix fetching with duplicate ref updates
  Fetch(Process): should tolerate duplicate refspecs
  FetchCommandTest: test add/update/delete fetch

Change-Id: I47671108574fcd10fe016a58e38c038af54a6748
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-25 07:55:55 +02:00
David Pursehouse 5786ac991b pgm: remove explicit version of log4j and slf4j in pom.xml
The version is inherited from the master pom.xml so does not need
to be explicitly specified, unless the intent is to override the
version. This is not the case, though, since the versions are
specified with the properties defined in the master pom.xml.

Despite the fact that using the properties results in the versions
effectively not being overridden, Eclipse still warns about it,
seemingly due the fact that a value is given in the version field.

Change-Id: I163ede6689b9e2e7dd7b21f22b4068d638fa97aa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-25 14:16:54 +09:00
David Pursehouse 05ecfb1ce1 Don't override managed version of httpclient for LFS server tests
The version is 4.5.5 in the master pom.xml but overridden with 4.3.6
in the LFS server tests pom.xml.

Remove the override so that the same version is used everywhere.

Change-Id: Ibccc93a0c2a9c05db23cf131585184d67611b579
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-25 14:16:54 +09:00
David Pursehouse 3151bc33ea HttpClientTests: Open OutputStream in try-with-resource
Change-Id: Ib690b0af6d562765f43ad54d3855200a17eaa90b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-25 14:16:30 +09:00
David Pursehouse 3f8b9cb5fa HttpClientTests: Use assertEquals to assert about response code
The current usage of assertThat causes a warning in Eclipse:

  "The expression of type int is boxed into Integer".

Replace it with assertEquals which does not cause this warning, and is
consistent with how such assertions are done in other tests.

Change-Id: Id3de3548353bf6be069b6ede89c605d094b6d3f4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-25 14:16:30 +09:00
Ivan Frade 40e9c38405 Add fetch support to ProtocolV2Hook
This makes it symmetrical with ls-refs operation and gives the
instantiator of UploadPack the chance to run some code after parsing
the protocol and before any actual work for the fetch starts.

Request and Builder methods keep the naming in the original code to
make this change just about request encapsulation and hook invocation.
They are package-private for now to allow further improvements.

Change-Id: I5ad585c914d3a5f23b11c8251803faa224beffb4
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-08-24 13:58:52 -07:00
René Scheibe dbe01e8852 Cleanup existing tests
Renamed and restructured tests for improved clarity.

Bug: 479266
Change-Id: Ic9d05ddf722bddd148fa9d9c19248dd53d97f1e4
Signed-off-by: René Scheibe <rene.scheibe@gmail.com>
2018-08-24 22:39:07 +02:00
Matthias Sohn db6c2c2aa5 Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Ignore API warnings
  Fix photon target platform to use photon version of org.eclipse.osgi
  Update Photon orbit repository to R20180606145124
  Suppress warning for trying to delete non-empty directory
  Fix fetching with duplicate ref updates
  Fetch(Process): should tolerate duplicate refspecs
  FetchCommandTest: test add/update/delete fetch

Change-Id: I2a83c059b7014c2a9e6267c963422c7785b23f17
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-24 17:39:07 +02:00
Matthias Sohn b0332d0133 Ignore API warnings
The following commits introduced in stable-4.5 and stable-4.9
introduced some minor API additions in service releases.

f7ceeaa2 FileRepository: Add pack-based inserter implementation
085d1f95 Make PackInserter public
10e65cb4 Fix LockFile semantics when running on NFS

Change-Id: I4afed7e0395cf93d828e671080e3ec9ddf20987d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-24 17:23:00 +02:00
Matthias Sohn 7446d576e2 Fix photon target platform to use photon version of org.eclipse.osgi
Change-Id: I81cb499a5092eed6569f6fdf612ecab3f5d9bd5e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-24 16:30:04 +02:00
Ivan Frade 0b84c5b29e UploadPack: shallowExcludeRefs doesn't need to be nullable
Code can check size instead of null, and that makes the initialization
trivial.

Change-Id: Icbe655816429a7a680926b0e871d96f3b2f1f7ba
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-08-23 15:22:06 -07:00
Matthias Sohn c0c2dea8b0 Update Photon orbit repository to R20180606145124
The S-repository doesn't exist anymore and we should have updated to the
final Photon orbit repository already.

Change-Id: I6d1757833be4abd3643677d6e7814363533e88b2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-23 11:29:15 +02:00
David Pursehouse e1b971848a RefDirectory: Add missing $NON-NLS suppression
Change-Id: I6afb4f86c3a8a06e5ea3128bf1b9b20c46ca158c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-23 16:51:19 +09:00
Michael Keppler 2fc00af44e refactor: simplify collection.toArray()
On recent VMs, collection.toArray(new T[0]) is faster than
collection.toArray(new T[collection.size()]). Since it is also more
readable, it should now be the preferred way of collection to array
conversion.

https://shipilev.net/blog/2016/arrays-wisdom-ancients/

Change-Id: I80388532fb4b2b0663ee1fe8baa94f5df55c8442
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-08-23 01:34:39 -04:00
David Pursehouse 7058493fea UploadPack: Add missing $NON-NLS suppressions
Change-Id: Ica2cc0ed23a7667bcb8d2006fd0a6ba6bddfee9a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-23 11:35:06 +09:00
David Pursehouse 985e6342b3 UploadPack: Remove redundant specification of type
Change-Id: I257635ed3f9ce012e03a3c45ed666fb9195019e0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-23 11:33:17 +09:00
David Pursehouse e748abdf14 Upgrade spotbugs to 3.1.6
Change-Id: Id84497107ef9ee2eca3c9d65197ab8c14f492655
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-23 11:29:11 +09:00
Thomas Wolf d9e767b431 Suppress warning for trying to delete non-empty directory
This is actually a fairly common occurrence; deleting the parent
directories can work only if the file deleted was the last one
in the directory.

Bug: 537872
Change-Id: I86d1d45e1e2631332025ff24af8dfd46c9725711
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-08-22 18:36:31 +02:00
Thomas Wolf ffd1ac5dde Fix fetching with duplicate ref updates
If packed refs are used, duplicate updates result in an exception
because JGit tries to lock the same lock file twice. With non-atomic
ref updates, this used to work, since the same ref would simply be
locked and updated twice in succession.

Let's be more lenient in this case and remove duplicates before
trying to do the ref updates. Silently skip duplicate updates
for the same ref, if they both would update the ref to the same
object ID. (If they don't, behavior is undefined anyway, and we
still throw an exception.)

Add a test that results in a duplicate ref update for a tag.

Bug: 529400
Change-Id: Ide97f20b219646ac24c22e28de0c194a29cb62a5
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-08-22 11:09:01 +02:00
Marc Strapetz 65a0cfc82a Fetch(Process): should tolerate duplicate refspecs
Bug: 529314
Change-Id: I91eaeda8a988d4786908fba6de00478cfc47a2a2
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-08-22 11:09:00 +02:00
Marc Strapetz 109c07ac8e FetchCommandTest: test add/update/delete fetch
Change-Id: I2442394fb7eae5b3715779555477dd27b274ee83
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-08-22 11:08:58 +02:00
Masaya Suzuki 36346bd81c Add SuppressWarnings for FutureReturnValueIgnored
https://errorprone.info/bugpattern/FutureReturnValueIgnored

The submitted task logs the error in case it fails.

Change-Id: I280442ddb8046da47aeb79d005886f65d2e3067b
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
2018-08-21 10:28:37 -07:00
Jonathan Nieder af75250a45 Merge "Support remove-project node in the manifest parser" 2018-08-20 22:14:35 -04:00
Masaya Suzuki 58a90f7a70 Support remove-project node in the manifest parser
This directive removes the projects added by other directives.

https://gerrit.googlesource.com/git-repo/+/65b0ba5aa0447f7ee25103828115662b1eb80ff9/manifest_xml.py#614
https://gerrit.googlesource.com/git-repo/+/e469a0c741832f6584513f4a382d6b93f417b8d2/docs/manifest-format.txt#339

Change-Id: I90d7b9fc711b586dec05f475422d34d67d909986
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
2018-08-20 18:27:32 -07:00