]> source.dussan.org Git - jgit.git/log
jgit.git
6 years agoMerge branch 'stable-4.11' into stable-5.0 59/126859/1
Matthias Sohn [Tue, 31 Jul 2018 22:57:07 +0000 (00:57 +0200)]
Merge branch 'stable-4.11' into stable-5.0

* stable-4.11:
  Prepare 4.11.2-SNAPSHOT builds
  JGit v4.11.1.201807311124-r
  Prepare 4.9.4-SNAPSHOT builds
  JGit v4.9.3.201807311005-r

Change-Id: I8c8ecc818205e1f5d94c02b463792ea1d72d8ba1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoPrepare 4.11.2-SNAPSHOT builds 56/126856/1
Matthias Sohn [Tue, 31 Jul 2018 20:07:17 +0000 (22:07 +0200)]
Prepare 4.11.2-SNAPSHOT builds

Change-Id: I02630900ab131478b30abe68b2133d2c8a5a67ab
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.11.1.201807311124-r 52/126852/1 v4.11.1.201807311124-r
Matthias Sohn [Tue, 31 Jul 2018 15:31:30 +0000 (17:31 +0200)]
JGit v4.11.1.201807311124-r

Change-Id: Ic58a916d7e2c380b84690afa5e3517c6c178af8c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.10' into stable-4.11 51/126851/1
Matthias Sohn [Tue, 31 Jul 2018 15:21:10 +0000 (17:21 +0200)]
Merge branch 'stable-4.10' into stable-4.11

* stable-4.10:
  Prepare 4.9.4-SNAPSHOT builds
  JGit v4.9.3.201807311005-r

Change-Id: I5f73f240951733e8d81d634aa5340a0861936a0c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.9' into stable-4.10 40/126840/1
Matthias Sohn [Tue, 31 Jul 2018 15:11:29 +0000 (17:11 +0200)]
Merge branch 'stable-4.9' into stable-4.10

* stable-4.9:
  Prepare 4.9.4-SNAPSHOT builds
  JGit v4.9.3.201807311005-r

Change-Id: Ifd4b815b0f66d44afeafa9ae77a2a714942d675d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoPrepare 4.9.4-SNAPSHOT builds 38/126838/1
Matthias Sohn [Tue, 31 Jul 2018 14:57:13 +0000 (16:57 +0200)]
Prepare 4.9.4-SNAPSHOT builds

Change-Id: Ibb2ee9d00d5d049f681e1abbb449656105e553a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.9.3.201807311005-r 36/126836/1 v4.9.3.201807311005-r
Matthias Sohn [Tue, 31 Jul 2018 14:05:49 +0000 (16:05 +0200)]
JGit v4.9.3.201807311005-r

Change-Id: I3f4f437649736c6a27e78d536344c7b31c8a0f65
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.11' into stable-5.0 01/126701/1
Matthias Sohn [Fri, 27 Jul 2018 12:06:14 +0000 (14:06 +0200)]
Merge branch 'stable-4.11' into stable-5.0

* stable-4.11:
  Prepare 4.7.3-SNAPSHOT builds
  JGit v4.7.2.201807261330-r
  Delete all loose refs empty directories
  Use java.nio to delete path to get detailed errors
  GC: Remove empty references folders
  Do not ignore path deletion errors

Change-Id: I780d4a1624fbb97a2acdf5321b9c3244b0626444
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.10' into stable-4.11 99/126699/1
Matthias Sohn [Fri, 27 Jul 2018 11:38:21 +0000 (13:38 +0200)]
Merge branch 'stable-4.10' into stable-4.11

* stable-4.10:
  Prepare 4.7.3-SNAPSHOT builds
  JGit v4.7.2.201807261330-r
  Delete all loose refs empty directories
  Use java.nio to delete path to get detailed errors
  GC: Remove empty references folders
  Do not ignore path deletion errors

Change-Id: I2b44d862869d4453c57db668fc7c925da591f671
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.9' into stable-4.10 93/126693/1
Matthias Sohn [Fri, 27 Jul 2018 09:03:11 +0000 (11:03 +0200)]
Merge branch 'stable-4.9' into stable-4.10

* stable-4.9:
  Prepare 4.7.3-SNAPSHOT builds
  JGit v4.7.2.201807261330-r
  Delete all loose refs empty directories
  Use java.nio to delete path to get detailed errors
  GC: Remove empty references folders
  Do not ignore path deletion errors

Change-Id: Ie7029bc91621af32e7bfd2e0d76a424b991b1995
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.8' into stable-4.9 92/126692/1
Matthias Sohn [Fri, 27 Jul 2018 08:51:58 +0000 (10:51 +0200)]
Merge branch 'stable-4.8' into stable-4.9

* stable-4.8:
  Prepare 4.7.3-SNAPSHOT builds
  JGit v4.7.2.201807261330-r
  Delete all loose refs empty directories
  Use java.nio to delete path to get detailed errors
  GC: Remove empty references folders
  Do not ignore path deletion errors

Change-Id: I6ab2b951dd94a9fc1c4f5283847a3e2ec37d0895
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 34/126634/2
David Pursehouse [Fri, 27 Jul 2018 07:22:51 +0000 (08:22 +0100)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Prepare 4.7.3-SNAPSHOT builds
  JGit v4.7.2.201807261330-r
  Delete all loose refs empty directories
  Use java.nio to delete path to get detailed errors
  GC: Remove empty references folders
  Do not ignore path deletion errors

Change-Id: Iadc8275fbaa3d6f7d08a96ab66d49f392f6aab78
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoPrepare 4.7.3-SNAPSHOT builds 85/126685/1
Matthias Sohn [Thu, 26 Jul 2018 23:00:35 +0000 (01:00 +0200)]
Prepare 4.7.3-SNAPSHOT builds

Change-Id: I5c437f45d5bc469e3c32bef1180c127d96d24d23
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.7.2.201807261330-r 75/126675/1 v4.7.2.201807261330-r
Matthias Sohn [Thu, 26 Jul 2018 17:28:38 +0000 (19:28 +0200)]
JGit v4.7.2.201807261330-r

Change-Id: I0d8c7ca756e6236e315c91da000fe8103ce83d05
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoDelete all loose refs empty directories 55/125755/4
Luca Milanesio [Sat, 7 Jul 2018 22:35:20 +0000 (23:35 +0100)]
Delete all loose refs empty directories

Remove completely the empty directories under refs/<namespace>
including the first level partition of the changes, when they are
completely empty.

Bug: 536777
Change-Id: I88304d34cc42435919c2d1480258684d993dfdca
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUse java.nio to delete path to get detailed errors 54/125754/4
Luca Milanesio [Sat, 7 Jul 2018 22:09:36 +0000 (23:09 +0100)]
Use java.nio to delete path to get detailed errors

Get the full IOException of the reason why a directory
cannot be removed during GC.

Change-Id: Ia555bce009fa48087a73d677f1ce3b9c0b685b57
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoGC: Remove empty references folders 47/125747/4
Hector Caballero [Mon, 5 Feb 2018 13:58:46 +0000 (08:58 -0500)]
GC: Remove empty references folders

After packaging references, the folders containing these references are
not deleted. In a busy repository, this causes operations to slow down
as traversing the references tree becomes longer.

Delete empty reference folders after the loose references have been
packed.
To avoid deleting a folder that was just created by another concurrent
operation, only delete folders that were not modified in the last 30
seconds.

Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com>
Change-Id: Ie79447d6121271cf5e25171be377ea396c7028e0
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDo not ignore path deletion errors 67/125767/1
Luca Milanesio [Sun, 8 Jul 2018 22:41:00 +0000 (23:41 +0100)]
Do not ignore path deletion errors

Log as warning when an attempt to remove a directory
fails. This helps troubleshooting some bugs like the GC leaving
behind empty directories.

Change-Id: Idb94ce17f8be9668a970c7ecae31436bf434073c
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
6 years agoMerge branch 'stable-4.11' into stable-5.0 86/125486/2
David Pursehouse [Wed, 4 Jul 2018 05:12:14 +0000 (14:12 +0900)]
Merge branch 'stable-4.11' into stable-5.0

* stable-4.11:
  ResolveMerger: Fix encoding with string; use bytes

Change-Id: I40b7b4b3fd6d53bbad32f8f550e885c0e698faf1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.10' into stable-4.11 85/125485/1
David Pursehouse [Wed, 4 Jul 2018 05:11:06 +0000 (14:11 +0900)]
Merge branch 'stable-4.10' into stable-4.11

* stable-4.10:
  ResolveMerger: Fix encoding with string; use bytes

Change-Id: I2f02298d0ff7caafeca4020cde4fdfa29a46e585
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.9' into stable-4.10 84/125484/1
David Pursehouse [Wed, 4 Jul 2018 05:10:24 +0000 (14:10 +0900)]
Merge branch 'stable-4.9' into stable-4.10

* stable-4.9:
  ResolveMerger: Fix encoding with string; use bytes

Change-Id: Ibd8f2a041b0de6e008a1ea84b92823f8cbc6e3d2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.8' into stable-4.9 83/125483/1
David Pursehouse [Wed, 4 Jul 2018 05:09:48 +0000 (14:09 +0900)]
Merge branch 'stable-4.8' into stable-4.9

* stable-4.8:
  ResolveMerger: Fix encoding with string; use bytes

Change-Id: Id6a85804695d5dcb32f26ed1d861b7c93577c5e4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 82/125482/1
David Pursehouse [Wed, 4 Jul 2018 05:08:56 +0000 (14:08 +0900)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  ResolveMerger: Fix encoding with string; use bytes

Change-Id: If17328fbd101d596a8a16d9c4a190e9b6e120902
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.11' into stable-5.0 23/124923/1
David Pursehouse [Sat, 23 Jun 2018 04:56:50 +0000 (13:56 +0900)]
Merge branch 'stable-4.11' into stable-5.0

* stable-4.11:

Empty merge because of previous merge from stable-4.9 into
stable-5.0 and commits subsequently merged into stable-4.10
and stable-4.11.

Change-Id: I69b8d3e96173ef58b77186dfe462148075954ce4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.10' into stable-4.11 68/124868/1
David Pursehouse [Fri, 22 Jun 2018 02:14:09 +0000 (11:14 +0900)]
Merge branch 'stable-4.10' into stable-4.11

* stable-4.10:
  Temporarily @Ignore flaky CommitCommandTest methods

Change-Id: I9902553ac442821416912d26a5d6ee1b0dc41cf4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoPrepare 5.0.2-SNAPSHOT builds 65/124865/1
Matthias Sohn [Thu, 21 Jun 2018 23:42:14 +0000 (01:42 +0200)]
Prepare 5.0.2-SNAPSHOT builds

Change-Id: I65e83f39a4082278c4cb809dbb08d44a119cebe0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v5.0.1.201806211838-r 64/124864/1 v5.0.1.201806211838-r
Matthias Sohn [Thu, 21 Jun 2018 22:40:01 +0000 (00:40 +0200)]
JGit v5.0.1.201806211838-r

Change-Id: I594cd85d46698953c27da3687e4ec40aeb73b445
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoResolveMerger: Fix encoding with string; use bytes 60/124860/1
Marco Miller [Thu, 21 Jun 2018 18:18:48 +0000 (14:18 -0400)]
ResolveMerger: Fix encoding with string; use bytes

This change fixes the issue [1]. Before this fix, a merge involving
the caching of consecutive yet similar filenames with Norwegian
characters [2] used to throw an IllegalStateException: Duplicate
stages not allowed. This was caused by inaccurate decoding of the
filenames, using string values assuming default encoding. In the
toString method of DirCacheEntry, used before through getPathString,
UTF-8 encoding is used, but the end result becomes default encoding,
through Object's default toString usage. The special characters in
those two consecutive (particular) filenames [2] were becoming the
very same decoded /single character, lending consecutive -but then
identical- filenames. Thus the perceived duplicate 0-staging of the
file(s).

Replace getPathString usage with getRawPath for this specific case,
or use byte array representations of cached entries instead of string.

Adding a test for this change is not possible, as there is no known
way to change the default encoding for filenames such as [2] (e.g.).
JGitTestUtil does write file contents through UTF-8, but encoding like
so does not apply to the actual file name. Hence there is no way to
create files with names properly made of special characters such as
[2]'s. And the test that is necessary for this case assumes such
Norwegian (or similar characters) filenames. Changing the default
locale programmatically in a test has no effect either. And changing
the LANG value passed to the JVM is only possible upon starting it.

[1] https://bugs.chromium.org/p/gerrit/issues/detail?id=9153

[2] <=>
(...)
"a/b/SíÒr-Norge.map",
"a/b/Sør-Norge.map",
(...)

Change-Id: Ib9f2f5297932337c9817064cc09d9f774dd168f4
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
6 years agoAdd project-info reports to maven site 29/124829/2
Matthias Sohn [Thu, 21 Jun 2018 05:47:17 +0000 (07:47 +0200)]
Add project-info reports to maven site

Change-Id: I290d9c4a27d2ca1b9071f39639195e0d85799c00
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix maven site generation failing with javadoc errors 28/124828/1
Matthias Sohn [Thu, 21 Jun 2018 05:48:29 +0000 (07:48 +0200)]
Fix maven site generation failing with javadoc errors

The same errors are suppressed when generating javadoc.
Suppress the errors during site generation.

Change-Id: I83bd1c10e5de82f47c351e7edf2c9230be4b1f21
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.9' into stable-4.10 07/124807/1
David Pursehouse [Thu, 21 Jun 2018 07:17:38 +0000 (16:17 +0900)]
Merge branch 'stable-4.9' into stable-4.10

* stable-4.9:
  Temporarily @Ignore flaky CommitCommandTest methods

Change-Id: I5f256aa6117847a25ab9e15c7d7ccc51e43cbb64
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRespect "unshallow" lines in protocol v2 04/124804/2
Jonathan Nieder [Thu, 21 Jun 2018 04:19:11 +0000 (21:19 -0700)]
Respect "unshallow" lines in protocol v2

If I run

 git config --global protocol.version 2
 mkdir repo
 cd repo
 git init --bare
 git remote add origin https://go.googlesource.com/proposal
 git fetch --depth=1
 git fetch --unshallow

then I expect to have a full history, just as though I had fetched
without --depth in the first place.  Instead, it reports success
but does not fetch enough objects:

 $ git fsck
 notice: HEAD points to an unborn branch (master)
 Checking object directories: 100% (256/256), done.
 Checking objects: 100% (468/468), done.
 broken link from  commit 2c6bc83f234085c8eadb7ea33405ce6223c44d1b
               to  commit 878975cf2b600675b4c905e5d9591bd24541ae9e
 missing commit 878975cf2b600675b4c905e5d9591bd24541ae9e
 dangling commit 314be00dae78dd526851f5635e6349014e2ad0c2

The false success indicates problems in the client and the server.
Git 2.18-rc2 (the client) ought to have been more defensive, noticing
the incomplete history.  The greater error is in JGit (the server),
which neglects to send the objects requested.

When serving protocol v0 requests, JGit sends the correct objects by
taking unshallowCommits into account when generating the pack to send
to the client.  Do the same in the protocol v2 code path.  I forgot to
do this in v5.0.0.201806050710-rc3~6 (Teach UploadPack shallow fetch
in protocol v2, 2018-03-15).

Reported-by: Russ Cox <rsc@golang.org>
Change-Id: I282b45f47616a641b9e8d6210b4a070d3efdbb9b
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoMerge branch 'stable-4.9' into stable-5.0 60/124760/1
David Pursehouse [Wed, 20 Jun 2018 07:09:08 +0000 (16:09 +0900)]
Merge branch 'stable-4.9' into stable-5.0

* stable-4.9:
  Temporarily @Ignore flaky CommitCommandTest methods

Change-Id: I2db9bf014ba222d77851cc58da7ee5a0e8b344f6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.8' into stable-4.9 59/124759/1
David Pursehouse [Wed, 20 Jun 2018 07:08:32 +0000 (16:08 +0900)]
Merge branch 'stable-4.8' into stable-4.9

* stable-4.8:
  Temporarily @Ignore flaky CommitCommandTest methods

Change-Id: I318813d19445ab7c44384015d36830ed02b8b590
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 58/124758/1
David Pursehouse [Wed, 20 Jun 2018 07:07:48 +0000 (16:07 +0900)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Temporarily @Ignore flaky CommitCommandTest methods

Change-Id: I016c9b3ec0081542bb903f361d9a3af1ea746ae3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.6' into stable-4.7 57/124757/1
David Pursehouse [Wed, 20 Jun 2018 07:06:44 +0000 (16:06 +0900)]
Merge branch 'stable-4.6' into stable-4.7

* stable-4.6:
  Temporarily @Ignore flaky CommitCommandTest methods

Change-Id: Idc653c22a9af2013a4c481bb19ca8d059f5c34d0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.5' into stable-4.6 38/124738/1
David Pursehouse [Tue, 19 Jun 2018 12:41:05 +0000 (21:41 +0900)]
Merge branch 'stable-4.5' into stable-4.6

* stable-4.5:
  Temporarily @Ignore flaky CommitCommandTest methods

Change-Id: I2a0e0b63a06f442f5a088d4bc8bb08eaf02ce952
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoTemporarily @Ignore flaky CommitCommandTest methods 32/124732/1
Dave Borowitz [Fri, 7 Jul 2017 18:43:57 +0000 (14:43 -0400)]
Temporarily @Ignore flaky CommitCommandTest methods

Change-Id: Ia2c42d014323bd29b85bf76f1a20c83f612406d7
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
(cherry picked from commit e93b0026ced10c956e76daed038f2560a33b5baf)

6 years agoPrepare 5.0.1-SNAPSHOT builds 01/124501/1
Matthias Sohn [Wed, 13 Jun 2018 21:24:42 +0000 (23:24 +0200)]
Prepare 5.0.1-SNAPSHOT builds

Change-Id: Iadf12dbdd63ef17c3f712c0fc18495304aa35016
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v5.0.0.201806131550-r 95/124495/1 v5.0.0.201806131550-r
Matthias Sohn [Wed, 13 Jun 2018 19:42:40 +0000 (21:42 +0200)]
JGit v5.0.0.201806131550-r

Change-Id: Ia2d548676217250593c3f0c383aec19e12e5e4a4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v5.0.0.201806131210-r 79/124479/1
Matthias Sohn [Wed, 13 Jun 2018 16:11:23 +0000 (18:11 +0200)]
JGit v5.0.0.201806131210-r

Change-Id: Iedccfcaf57c11822f1faf5d5195357de42b2a14e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoDowngrade Apache httpclient to 4.5.2.v20170210-0925 46/124446/2
Matthias Sohn [Wed, 13 Jun 2018 07:03:20 +0000 (09:03 +0200)]
Downgrade Apache httpclient to 4.5.2.v20170210-0925

Eclipse platform uses this version from the Oxygen Orbit release for
Photon. In order to avoid that we end up with two slightly different
versions in the same p2 repository of the simultaneous release we
downgrade temporarily from the version 4.5.2.v20180410-1551 in the
Photon Orbit release.

See
https://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg15659.html

Change-Id: Id46a840aa4b1010af7fe311498f17f1f2e5b81e0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRefUpdateTest: Refactor to not use deprecated Repository#getAllRefs 26/123126/3
David Pursehouse [Wed, 23 May 2018 04:54:52 +0000 (13:54 +0900)]
RefUpdateTest: Refactor to not use deprecated Repository#getAllRefs

Change-Id: I157e62a0e1479d4bc95ef867e616ca8a30041759
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoPropagate failure of ssh command to caller of SshSupport 06/124406/4
Matthias Sohn [Tue, 12 Jun 2018 12:09:39 +0000 (14:09 +0200)]
Propagate failure of ssh command to caller of SshSupport

When SshSupport.runSshCommand fails since the executed external ssh
command failed throw a CommandFailedException.

If discovery of LFS server fails due to failure of the
git-lfs-authenticate command chain the CommandFailureException to the
LfsConfigInvalidException in order to allow root cause analysis in the
application using that.

Change-Id: I2f9ea2be11274549f6d845937164c248b3d840b2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMake JGit describe behaves same as c-git for lightweight tags 35/124435/3
Marcel Trautwein [Fri, 23 Feb 2018 06:27:52 +0000 (07:27 +0100)]
Make JGit describe behaves same as c-git for lightweight tags

JGit now considers lightweight tags only if the --tags option is set
i.e. `git.describe().setAllTags(true)` has to be set, else the default
is now as in c git:

Only annotated tags are evaluated unless you pass true
equivalent to --tags (or --all) by the option setAllTags.

Hint: This (still) doesn't address any difference between c-git
`--all` and `!--all --tags` behavior;
perhaps this might be a follow up request

Bug: 423206
Change-Id: I9a3699756df0b9c6a7c74a7e8887dea0df17c8e7
Signed-off-by: Marcel Trautwein <me+eclipse@childno.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix issues with LFS on GitHub (SSH) 55/124355/3
Markus Duft [Mon, 11 Jun 2018 15:12:00 +0000 (17:12 +0200)]
Fix issues with LFS on GitHub (SSH)

 * URIish seems to have a tiny feature (bug?). The path of the URI
   starts with a '/' only if the URI has a port set (it seems).
 * GitHub does not return SSH authorization on a single line as Gerrit
   does - need to account for that.
 * Increase the SSH git-lfs-authenticate timeout, as GitHub sometimes
   responds slower than expected.
 * Guard against NPE in case the download action does not contain any
   additional headers.

Change-Id: Icd1ead3d015479fd4b8bbd42ed42129b0abfb95c
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
6 years agoMerge branch 'stable-4.11' into stable-5.0 32/124332/1
Matthias Sohn [Mon, 11 Jun 2018 09:25:27 +0000 (11:25 +0200)]
Merge branch 'stable-4.11' into stable-5.0

* stable-4.11:

Change-Id: Iec2dafd00979ab02f5ab698fc514866255007de5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.10' into stable-4.11 21/124321/1
Matthias Sohn [Mon, 11 Jun 2018 09:03:42 +0000 (11:03 +0200)]
Merge branch 'stable-4.10' into stable-4.11

* stable-4.10:
  Ensure DirectoryStream is closed promptly

Change-Id: I2c0d5ea96b2c96336908674032d0f7d39dc062b9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.9' into stable-4.10 20/124320/1
Matthias Sohn [Mon, 11 Jun 2018 08:54:50 +0000 (10:54 +0200)]
Merge branch 'stable-4.9' into stable-4.10

* stable-4.9:
  Ensure DirectoryStream is closed promptly

Change-Id: I62674a1db9266c04fb353ab697e2c0a24a7369b7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix Javadoc typo 08/124308/1
Michael Keppler [Sun, 10 Jun 2018 12:15:45 +0000 (14:15 +0200)]
Fix Javadoc typo

Change-Id: Ib4ebc57236bdea663f27295764886413e2550580
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoEnsure Jsch checks all configured algorithms 51/124251/2
Thomas Wolf [Fri, 8 Jun 2018 13:47:05 +0000 (15:47 +0200)]
Ensure Jsch checks all configured algorithms

Jsch checks only for the availability of the algorithms given by
Jsch-internal config keys "CheckCiphers", "CheckKexes", and
"CheckSignatures". If the ssh config defines any algorithms
unknown to Jsch not listed in those keys, it'll still propose them
during the negotiation phase, and run into an NPE later on if the
server happens to propose such an algorithm and it gets chosen.

Jsch reads those "CheckCiphers" and the other values from either a
session-local config, or the global static Jsch config. It bypasses
~/.ssh/config for these values.

Therefore, copy these values from the config as read from
~/.ssh/config into the session-specific config. That makes Jsch
check _all_ configured algorithms up front, discarding any for
which it has no implementation. Thus it proposes only algorithms
it actually can handle.

Bug: 535672
Change-Id: I6a68e54f4d9a3267e895c536bcf3c58099826ad5
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoMerge branch 'stable-4.9' into stable-5.0 01/124301/2
Matthias Sohn [Sun, 10 Jun 2018 07:21:16 +0000 (09:21 +0200)]
Merge branch 'stable-4.9' into stable-5.0

* stable-4.9:
  Ensure DirectoryStream is closed promptly

Change-Id: I447a01e1170db85fcf5978206ed35ad1956a2d82
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRawTextTest#testBinary: use array comparison to compare arrays 87/124287/2
Matthias Sohn [Sat, 9 Jun 2018 00:01:59 +0000 (02:01 +0200)]
RawTextTest#testBinary: use array comparison to compare arrays

Change-Id: Iac1feadf24858a0bdf0cb224f16b34e9498fe3bb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoLFS: Better SSH authentication token timeout handling 88/124288/2
Markus Duft [Thu, 12 Apr 2018 08:11:18 +0000 (10:11 +0200)]
LFS: Better SSH authentication token timeout handling

 * Larger eager timeout to compensate for high-latency lines
 * Respect eager timeout in case the server uses "expiresIn"

Change-Id: Id87da1eea874e70b69eaccf35c84af4c3bb50770
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
6 years agoEnsure DirectoryStream is closed promptly 85/124285/1
Dave Borowitz [Fri, 5 Jan 2018 18:02:47 +0000 (13:02 -0500)]
Ensure DirectoryStream is closed promptly

From the javadoc for Files.list:

"The returned stream encapsulates a DirectoryStream. If timely disposal
of file system resources is required, the try-with-resources construct
should be used to ensure that the stream's close method is invoked
after the stream operations are completed."

This is the only call to Files#newDirectoryStream that is not already in
a try-with-resources.

Change-Id: I91e6c56b5d74e8435457ad6ed9e6b4b24d2aa14e
(cherry picked from commit 1c16ea4601920c9dbc7a0202efc20137e1a63d55)

6 years agoValidate branch names on branch creation 72/124272/7
Matthias Sohn [Fri, 8 Jun 2018 15:45:00 +0000 (17:45 +0200)]
Validate branch names on branch creation

Since v2.16.0-rc0~89^2~1 (branch: correctly reject
refs/heads/{-dash,HEAD}, 2017-11-14),
native git does not allow branch names
- refs/heads/HEAD
- starting with '-'

Bug: 535655
Change-Id: Ib1c4ec9ea844073901a4ebe6a29ff6cc8ae58e93
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUse constant for ".lock" 71/124271/3
Matthias Sohn [Fri, 8 Jun 2018 15:22:54 +0000 (17:22 +0200)]
Use constant for ".lock"

Change-Id: Id65dc94c970ffd3ca3d3d4a5d57123c95d29e8af
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoSimplify locking of FileRepository's index snapshot 35/124235/3
Matthias Sohn [Fri, 8 Jun 2018 07:50:39 +0000 (09:50 +0200)]
Simplify locking of FileRepository's index snapshot

synchronize on simple Object monitor instead of using ReentrantLock

Change-Id: I897020ab35786336b51b0fef76ea6071aff8aefa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRefactor FileRepository.detectIndexChange() 34/124234/1
Matthias Sohn [Fri, 8 Jun 2018 07:42:13 +0000 (09:42 +0200)]
Refactor FileRepository.detectIndexChange()

Change-Id: I50c751e2e90f685dc27043c569da2eb210d4611b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge "Ensure index change event is fired when index snapshot changed" into stable-5.0
Jonathan Nieder [Fri, 8 Jun 2018 05:34:12 +0000 (01:34 -0400)]
Merge "Ensure index change event is fired when index snapshot changed" into stable-5.0

6 years agoUpdate to latest Photon Orbit R20180606145124 91/124191/1
Matthias Sohn [Thu, 7 Jun 2018 12:44:40 +0000 (14:44 +0200)]
Update to latest Photon Orbit R20180606145124

also add missing bundle org.hamcrest

Change-Id: I88ad7769b8fda491fe3641ddaf0964ca55ffc0f6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUpdate maven plugins to fix Zip Slip vulnerability 56/124056/1
David Pursehouse [Wed, 6 Jun 2018 04:34:34 +0000 (13:34 +0900)]
Update maven plugins to fix Zip Slip vulnerability

Zip Slip [1] is an arbitrary file write generic vulnerability, that can
be achieved using a specially crafted zip (or bzip2, gzip, tar, xz, war)
archive, that holds path traversal filenames.

According to Maven's announcement [2] several plugins use plexus-archiver to
unpack dependencies to disk and have been identified as potential triggers
for exposing the vulnerability.

Of those, JGit uses the maven-dependency-plugin and the maven-javadoc-plugin.

Update them to the fixed versions reported in [2].

See the corresponding issues for the maven-dependency-plugin [3] and the
maven-javadoc-plugin [4] for details.

[1] https://snyk.io/research/zip-slip-vulnerability
[2] https://maven.apache.org/security-plexus-archiver.html
[3] https://issues.apache.org/jira/browse/MDEP-611
[4] https://issues.apache.org/jira/browse/MJAVADOC-520

Change-Id: Id3ab2d6161db240f2ab8f82298fa3ecd7a930a43
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoEnsure index change event is fired when index snapshot changed 92/123892/6
Matthias Sohn [Sun, 3 Jun 2018 11:32:51 +0000 (13:32 +0200)]
Ensure index change event is fired when index snapshot changed

Ensure that notifyIndexChanged is called every time we call
FileSnapshot.save, except the first.

Change-Id: I5a4e9826e791f518787366ae7c3a0ef3d416d2c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoPrepare 5.0.0-SNAPSHOT builds 17/124017/1
Matthias Sohn [Tue, 5 Jun 2018 13:31:07 +0000 (15:31 +0200)]
Prepare 5.0.0-SNAPSHOT builds

Change-Id: I9acca328146aa7100fbc1b457fcb1f8fd87cf52a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v5.0.0.201806050710-rc3 90/123990/1 v5.0.0.201806050710-rc3
Matthias Sohn [Tue, 5 Jun 2018 11:10:10 +0000 (13:10 +0200)]
JGit v5.0.0.201806050710-rc3

Change-Id: Ic7a6a87dd3a21351e60fbf6cd330456adf1f6800
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoTeach UploadPack "filter" in protocol v2 fetch 61/123961/2
Jonathan Tan [Mon, 30 Apr 2018 20:21:43 +0000 (13:21 -0700)]
Teach UploadPack "filter" in protocol v2 fetch

If the configuration variable uploadpack.allowfilter is true, advertise
that "filter" is supported, and support it if the client sends such an
argument.

Change-Id: I7de66c0a0ada46ff71c5ba124d4ffa7c47254c3b
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoRefactor test of capabilities output 60/123960/2
Jonathan Tan [Wed, 2 May 2018 23:35:48 +0000 (16:35 -0700)]
Refactor test of capabilities output

A subsequent patch will dynamically generate the capability
advertisement, so the capability advertisements produced are not always
the same. Separate the checking of the advertisements into its own test
method.

Change-Id: I768d14b9d1a244d5d886c42ffd62ef3957b518fb
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoRefactor v2 advertisement into own function 59/123959/2
Jonathan Tan [Wed, 2 May 2018 22:43:50 +0000 (15:43 -0700)]
Refactor v2 advertisement into own function

A subsequent patch needs dynamic generation of this advertisement
depending on a configuration variable in the underlying repository, so
refactor it into a function instead of using a constant list.

Change-Id: Ie00584add1fb56c9e88c7b57f75703981ea5bb85
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoRefactor parsing of "filter" into its own method 58/123958/2
Jonathan Tan [Mon, 30 Apr 2018 19:49:02 +0000 (12:49 -0700)]
Refactor parsing of "filter" into its own method

The implementation of protocol v2 will also need to parse the "filter"
option, so refactor it into its own method.

Change-Id: I751f6e6ca63fab873298594653a3885202297a2e
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoDisallow unknown args to "fetch" in protocol v2 57/123957/2
Jonathan Tan [Thu, 3 May 2018 00:17:04 +0000 (17:17 -0700)]
Disallow unknown args to "fetch" in protocol v2

JGit's implementation of the fetch command of protocol v2, unlike its
implementation of ls-refs, currently tolerates unknown arguments.
Tighten fetch to not allow unrecognized arguments and add tests to
verify this behavior for both ls-refs and fetch.

Change-Id: I321161d568bd638252fab1a47b06b924d472a669
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoTeach UploadPack shallow fetch in protocol v2 56/123956/2
Jonathan Tan [Thu, 15 Mar 2018 22:56:50 +0000 (15:56 -0700)]
Teach UploadPack shallow fetch in protocol v2

Add support for the "shallow" and "deepen" parameters in the "fetch"
command in the fetch-pack/upload-pack protocol v2. Advertise support for
this in the capability advertisement.

TODO: implement deepen-relative, deepen-since, deepen-not

Change-Id: I7ffd80d6c38872f9d713ac7d6e0412106b3766d7
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoRefactor unshallowCommits to local variable 55/123955/2
Jonathan Tan [Tue, 22 May 2018 22:19:04 +0000 (15:19 -0700)]
Refactor unshallowCommits to local variable

This reduces the amount of state held as instance variables in
UploadPack, and makes it easier for a future patch to contain a clearer
version of UploadPack#processShallow.

Change-Id: I6df80b42f9e5118fda1420692e02e417670cced3
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoAdd protocol v2 support in http 54/123954/2
Jonathan Tan [Wed, 28 Feb 2018 22:36:44 +0000 (14:36 -0800)]
Add protocol v2 support in http

Teach UploadPack to support protocol v2 with non-bidirectional pipes,
and add support to the HTTP protocol for v2. This is only activated if
the repository's config has "protocol.version" equal to 2.

Change-Id: I093a14acd2c3850b8b98e14936a716958f35a848
Helped-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoGive info/refs services more control over response 53/123953/2
Jonathan Tan [Wed, 25 Apr 2018 20:59:52 +0000 (13:59 -0700)]
Give info/refs services more control over response

Currently, SmartServiceInfoRefs always prints "# service=serviceName"
followed by a flush packet in response to an info/refs request, and then
hands it off to the specific service class. Printing of "#
service=serviceName" is mandated for protocol v0, but not v2.

Therefore, the existing code works for protocol v0, but whenever a
service that supports protocol v2 receives an info/refs request, it must
first determine which protocol version is to be used (depending on, for
example, the request and any relevant configuration variables), and then
decide if "# service=serviceName" needs to be printed.

Create a new method that v2-supporting service classes can override,
covering the printing of both "# service=serviceName" and everything
that the #advertise method prints. This will be used in a subsequent
commit in which UploadPackServlet (and the other classes it uses) is
updated to support protocol v2.

Change-Id: Ia026b06e96a6b15937514096babd024ef77df1ea
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoChain RemoteAddCommand methods 62/123762/2
Mincong HUANG [Wed, 30 May 2018 20:24:24 +0000 (22:24 +0200)]
Chain RemoteAddCommand methods

Change-Id: I1cf64c90a5cd2220034810b0d65d59582b420c4e
Signed-off-by: Mincong Huang <mincong.h@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUpdate target platforms to Orbit R20180531190352-Photon 33/123833/1
Matthias Sohn [Fri, 1 Jun 2018 12:18:29 +0000 (14:18 +0200)]
Update target platforms to Orbit R20180531190352-Photon

Use the final Photon Orbit release

Change-Id: Ie07eb3dedb5ccb6a2a7b0ad2c90593a07fdd240e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoPrepare 5.0.0-SNAPSHOT builds 03/123703/1
Matthias Sohn [Wed, 30 May 2018 21:16:23 +0000 (23:16 +0200)]
Prepare 5.0.0-SNAPSHOT builds

Change-Id: I9c4a0465f8e85041d24da97f4b4c7ad5f5eed3e4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v5.0.0.201805301535-rc2 91/123691/1 v5.0.0.201805301535-rc2
Matthias Sohn [Wed, 30 May 2018 19:33:49 +0000 (21:33 +0200)]
JGit v5.0.0.201805301535-rc2

Change-Id: Ifad678794525c01838b03e52bada66e1c089c5ae
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix description property in feature.properties of pgm source feature 80/123580/1
Matthias Sohn [Tue, 29 May 2018 23:14:14 +0000 (01:14 +0200)]
Fix description property in feature.properties of pgm source feature

Change-Id: I29c7bf1dc6aaf71542e2529883d44dcd995e17f7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUpdate SUA 31/123531/4
Matthias Sohn [Tue, 29 May 2018 11:45:06 +0000 (13:45 +0200)]
Update SUA

Following [1] update SUA in license.html [2] and feature.properties [3]

[1] https://www.eclipse.org/projects/handbook/#legaldoc-plugins
[2] https://www.eclipse.org/legal/epl/notice.html
[3] https://www.eclipse.org/legal/epl/feature.properties.txt

Bug: 532265
Change-Id: Ia3929808154510ad09ceeead263a3fe0dba9a34a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoDon't prune symbolic refs when fetch.prune = true 25/123325/1
Thomas Wolf [Thu, 24 May 2018 14:26:36 +0000 (16:26 +0200)]
Don't prune symbolic refs when fetch.prune = true

The canonical implementation also doesn't. Compare current
code in remote.c, function get_stale_heads_cb.[1] Not handling
symrefs in this case was introduced in canonical git in [2]
in 2008.

[1] https://github.com/git/git/blob/v2.17.0/remote.c#L2259
[2] https://github.com/git/git/commit/740fdd27f0

Bug: 533549
Change-Id: If348d56bb4a96b8aa7141f7e7b5a0d3dd4e7808b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoPrepare 5.0.0-SNAPSHOT builds 14/123114/1
Matthias Sohn [Tue, 22 May 2018 23:54:32 +0000 (01:54 +0200)]
Prepare 5.0.0-SNAPSHOT builds

Change-Id: Ie343ccf37f46168041046500a2e19acc80814cfe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v5.0.0.201805221745-rc1 08/123108/1 v5.0.0.201805221745-rc1
Matthias Sohn [Tue, 22 May 2018 21:43:43 +0000 (23:43 +0200)]
JGit v5.0.0.201805221745-rc1

Change-Id: Ie2c35fab87f294b00f9754b07b60a848bf256b10
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'master' into stable-5.0 04/123104/1
Matthias Sohn [Tue, 22 May 2018 21:00:37 +0000 (23:00 +0200)]
Merge branch 'master' into stable-5.0

* master:
  DescribeCommand: Refactor to not use deprecated Repository#peel
  Repository: Deprecate #peel method
  Repository: Make #exactRef and #findRef final
  Skip ignored directories in FileTreeIterator
  Repository: Deprecate getTags method
  InfoRefsServlet: Refactor to not use deprecated methods
  RefAdvertiser: Add send(Collection<Ref>) and deprecate send(Map<String, Ref>)
  Remove deprecated Repository#notifyIndexChanged
  Implementors should override Repository#notifyIndexChanged(boolean)
  Revive Repository#notifyIndexChanged()
  Remove further unnecessary 'final' keywords
  Execute AdvertiseRefsHook only for protocol v0 and v1
  Add protocol v2 support in "jgit daemon"
  Teach UploadPack "ofs-delta" in "fetch"
  Teach UploadPack "include-tag" in "fetch"
  Avoid using #refs in UploadPack#sendPack
  FileRepository: Don't use deprecated RefDatabase#getRefs(String)
  BatchRefUpdate: Don't use deprecated RefDatabase#getRefs(String)

Change-Id: I16c5da62d09262d3f4070aa0f466dd6c8352b5ea
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoDescribeCommand: Refactor to not use deprecated Repository#peel 36/123036/1
David Pursehouse [Tue, 22 May 2018 03:08:08 +0000 (12:08 +0900)]
DescribeCommand: Refactor to not use deprecated Repository#peel

Change-Id: I76073ad62d1bc4fc21d8a1f5fc7eb92060a73baa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRepository: Deprecate #peel method 35/123035/2
David Pursehouse [Tue, 22 May 2018 02:27:30 +0000 (11:27 +0900)]
Repository: Deprecate #peel method

Callers should use getRefDatabase().peel(ref) instead since it
doesn't swallow the IOException.

Adapt all trivial callers to user the alternative.

DescribeCommand still uses the deprecated method and is not adapted in
this change since it will require more refactoring to add handling of
the IOException.

Change-Id: I14d4a95a5e0570548753b9fc5c03d024dc3ff832
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRepository: Make #exactRef and #findRef final 34/123034/3
David Pursehouse [Tue, 22 May 2018 00:47:16 +0000 (09:47 +0900)]
Repository: Make #exactRef and #findRef final

This means less cognitive overhead for both implementors and callers,
since this way we can guarantee that they are always synonyms for
RefDatabase#exactRef and RefDatabase#findRef, respectively.

Change-Id: Ic8aeb52fc7ed65672f3f6cd1da39a66908d88baa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoSkip ignored directories in FileTreeIterator 37/120337/3
Thomas Wolf [Tue, 27 Mar 2018 20:22:09 +0000 (22:22 +0200)]
Skip ignored directories in FileTreeIterator

Make FileTreeIterator not enter ignored directories by default. We
only need to enter ignored directories if we do some operation against
git, and there is at least one tracked file underneath an ignored
directory.

Walking ignored directories should be avoided as much as possible as
it is a potential performance bottleneck. Some projects have a lot of
files or very deep hierarchies in ignored directories; walking those
may be costly (especially so on Windows). See for instance also bug
500106.

Provide a FileTreeIterator.setWalkIgnoredDirectories() operation to
force the iterator to iterate also through otherwise ignored
directories. Useful for tests (IgnoreNodeTest, CGitIgnoreTest), or
to implement things like "git ls-files --ignored".

Add tests in DirCacheCheckoutTest, and amend IndexDiffTest to test a
little bit more.

Bug: 388582
Change-Id: I6ff584a42c55a07120a4369fd308409431bdb94a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoRepository: Deprecate getTags method 17/123017/3
David Pursehouse [Mon, 21 May 2018 23:34:53 +0000 (08:34 +0900)]
Repository: Deprecate getTags method

Callers should use getRefDatabase().getRefsByPrefix(R_TAGS) instead.

Adjust the tests accordingly.

Bug: 534731
Change-Id: Ib28ae365e42720268996ff46e34cae1745ad545c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge changes Ibf6ee80d,I721db0f4,I7d014890
David Pursehouse [Mon, 21 May 2018 23:15:22 +0000 (19:15 -0400)]
Merge changes Ibf6ee80d,I721db0f4,I7d014890

* changes:
  Remove deprecated Repository#notifyIndexChanged
  Implementors should override Repository#notifyIndexChanged(boolean)
  Revive Repository#notifyIndexChanged()

6 years agoInfoRefsServlet: Refactor to not use deprecated methods 28/122728/4
David Pursehouse [Wed, 16 May 2018 03:07:34 +0000 (12:07 +0900)]
InfoRefsServlet: Refactor to not use deprecated methods

- Replace RefDatabase#getRefs(String) with #getRefsByPrefix(String)
- Replace RefAdvertiser#send(Map<String, Ref>) with #send(Collection<Ref>)

Bug: 534731
Change-Id: I25b617c3b0c54793cf4ab5b62f002e17745a5377
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRefAdvertiser: Add send(Collection<Ref>) and deprecate send(Map<String, Ref>) 27/122727/4
David Pursehouse [Wed, 16 May 2018 03:03:02 +0000 (12:03 +0900)]
RefAdvertiser: Add send(Collection<Ref>) and deprecate send(Map<String, Ref>)

Bug: 534731
Change-Id: If15032a34dc62f420569e2b2b6d8e14e2dfed522
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRemove deprecated Repository#notifyIndexChanged 72/122972/1
Jonathan Nieder [Fri, 18 May 2018 16:23:03 +0000 (09:23 -0700)]
Remove deprecated Repository#notifyIndexChanged

It is no longer used.

Change-Id: Ibf6ee80d5b6cd554295f4e657e087302770621b6

6 years agoImplementors should override Repository#notifyIndexChanged(boolean) 71/122971/1
Jonathan Nieder [Fri, 18 May 2018 16:16:16 +0000 (09:16 -0700)]
Implementors should override Repository#notifyIndexChanged(boolean)

Declare Repository#notifyIndexChanged() final and
Repository#notifyIndexChanged(boolean) abstract to force implementors
to switch to overriding the latter method.  This makes Repository less
error-prone to extend since implementors no longer need to remember to
override one of those two methods.

Change-Id: I721db0f4a4865db3b35212ee0a2045d5b31c96af
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoRevive Repository#notifyIndexChanged() 70/122970/1
Jonathan Nieder [Fri, 18 May 2018 16:15:30 +0000 (09:15 -0700)]
Revive Repository#notifyIndexChanged()

e9e150fdd24d (Store in IndexChangedEvent if it was caused by JGit
itself, 2018-05-13) modified Repository#notifyIndexChanged to take a
boolean argument to indicate whether the index change happened under
the current process's control or externally, for use by EGit.  In
other words, the function signature changed from

public abstract void notifyIndexChanged();

to

public abstract void notifyIndexChanged(boolean internal);

Callers outside JGit itself notifying a Repository about index changes
are expected to be rare, so this is not very disruptive to them.  In
most cases they would be notifying about changes that they made
themselves, so treating their notifyIndexChanged() calls as
notifyIndexChanged(true) should be relatively safe.

Implementors have the opposite problem: adding the new "abstract void
notifyIndexChanged(boolean)" method means they are obligated to
override it.  Add a default implementation that calls their existing
override of notifyIndexChanged() to make their migration easier.

The main downside is that authors of new Repository subclasses that
do not realize they need to override notifyIndexChanged would end up
with a default implementation which calls notifyIndexChanged(true),
in turn calling notifyIndexChanged() again and so on, resulting in
StackOverflowException.  Add an implementors' note to the class
Javadoc to avoid this issue.  A followup commit will force
implementors to adapt to the new API by changing the methods to

@Deprecated
public final void notifyIndexChanged() {
notifyIndexChanged(true);
}

public abstract void notifyIndexChanged(boolean internal);

Change-Id: I7d014890ee19abf283ea824d9baa9044bfdde130
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoRemove further unnecessary 'final' keywords 88/122788/2
Han-Wen Nienhuys [Wed, 16 May 2018 14:34:16 +0000 (16:34 +0200)]
Remove further unnecessary 'final' keywords

Remove it from

 * package private functions.

 * try blocks

 * for loops

this was done with the following python script:

$ cat f.py
import sys
import re
import os

def replaceFinal(m):
  return m.group(1) + "(" +  m.group(2).replace('final ', '') + ")"

methodDecl = re.compile(r"^([\t ]*[a-zA-Z_ ]+)\(([^)]*)\)")

def subst(fn):
  input = open(fn)
  os.rename(fn, fn + "~")

  dest = open(fn, 'w')
  for l in input:
    l = methodDecl.sub(replaceFinal, l)
    dest.write(l)
  dest.close()

for root, dirs, files in os.walk(".", topdown=False):
  for f in files:
    if not f.endswith('.java'):
      continue

    full = os.path.join(root, f)
    print full
    subst(full)

Change-Id: If533a75a417594fc893e7c669d2c1f0f6caeb7ca
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
6 years agoExecute AdvertiseRefsHook only for protocol v0 and v1 26/122726/3
Masaya Suzuki [Mon, 14 May 2018 21:13:11 +0000 (14:13 -0700)]
Execute AdvertiseRefsHook only for protocol v0 and v1

Refs are not advertised as part of the protocol v2 capability
advertisement. Don't call AdvertiseRefsHook.

Noticed because many implementations of AdvertiseRefsHook read all
refs in order to call UploadPack#setAdvertisedRefs, causing the
capability advertisement to be as slow as a v0 ref advertisement with
some RefDatabase implementations.

Such an AdvertiseRefsHook is of dubious utility (a better place to
determine which refs are advertised is in the RefDatabase
implementation itself, as in Gerrit), but at any rate since it's not
bringing about any benefit here, we can skip the hook call.

TODO:
- call an appropriate hook instead (https://bugs.eclipse.org/534847)
- add tests

[jn: fleshed out commit message; added TODO notes]

Change-Id: I6eb60ccfb251a45432954467a9ae9c1079a8c8b5
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoAdd protocol v2 support in "jgit daemon" 54/119454/14
Jonathan Tan [Sat, 24 Feb 2018 00:55:03 +0000 (16:55 -0800)]
Add protocol v2 support in "jgit daemon"

With this patch, a server spawned by "jgit daemon" can be accessed using
protocol v2 from a Git client that supports it (for example, "git" with
the appropriate patches). This is only activated if the repository's
config has "protocol.version" be 2.

This required a change to the package-private #execute methods in
DaemonService to allow passing of extra parameters.

This has been tested with a patched Git.

Change-Id: Icf043efec7ce956d72b075fc6dc7a87d5a2da82a
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoTeach UploadPack "ofs-delta" in "fetch" 53/119453/14
Jonathan Tan [Tue, 13 Mar 2018 20:29:46 +0000 (13:29 -0700)]
Teach UploadPack "ofs-delta" in "fetch"

Add support for the "ofs-delta" parameter in the "fetch" command in
the fetch-pack/upload-pack protocol v2.

Change-Id: I728cf986082fce4ddeb6a6435897692e15e60cc7
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoTeach UploadPack "include-tag" in "fetch" 52/119452/14
Jonathan Tan [Tue, 13 Mar 2018 18:07:36 +0000 (11:07 -0700)]
Teach UploadPack "include-tag" in "fetch"

Add support for the "include-tag" parameter in the "fetch" command in
the fetch-pack/upload-pack protocol v2.

In order to determine which tags to include, only objects pointed to by
refs starting with "refs/tags/" are checked. This restriction is for
performance reasons and to match the behavior of Git (see add_ref_tag()
in builtin/pack-objects.c).

Change-Id: I7d70aa09bcc8a525218ff1559e286c2a610258ca
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>