Commit Graph

4444 Commits

Author SHA1 Message Date
Matthias Sohn a44d95c814 Prepare 5.1.1-SNAPSHOT builds
Change-Id: Ie220dd95fae18f894e2a04a5ae6d29a1e5a6d76b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-11 23:28:07 +02:00
Matthias Sohn 47956bcc68 JGit v5.1.0.201809111528-r
Change-Id: I583bf7d60bccc876156be1f605bfda32b89cd08b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-11 21:30:23 +02:00
Markus Duft 303adeb8bf Fix replacement quoting for replaceAll in filter command
According to String.replaceAll JavaDoc:

"Note that backslashes (\) and dollar signs ($) in the replacement
string may cause the results to be different than if it were being
treated as a literal replacement string; see Matcher.replaceAll. Use
java.util.regex.Matcher.quoteReplacement to suppress the special meaning
of these characters, if desired."

Bug: 536318
Change-Id: Ib70cfec41bf73e14d23d94d14aee05a25b1e87f6
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
2018-09-10 22:21:15 +02:00
Matthias Sohn c857e7f09b Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Prepare 4.11.3-SNAPSHOT builds
  JGit v4.11.2.201809100523-r

Change-Id: I6bd3cb830b7b44dc6e5fd66ff0732957be6b5710
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-10 21:30:49 +02:00
Matthias Sohn 8527e74ea0 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Prepare 4.11.3-SNAPSHOT builds
  JGit v4.11.2.201809100523-r

Change-Id: I8a6f2667f9e43d53e995554224c2a538d1959996
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-10 21:29:46 +02:00
Matthias Sohn 34618a4f86 Prepare 4.11.3-SNAPSHOT builds
Change-Id: I4f5dda6da3f6ecd9b99c1d9a220844c5402f1988
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-10 13:13:19 +02:00
Matthias Sohn ae21714768 JGit v4.11.2.201809100523-r
Change-Id: I85dab173a94b3036ccf669c20b9dffb4af0922b4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-10 11:24:32 +02:00
Matthias Sohn b44bba618b Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Prepare 5.0.4-SNAPSHOT builds
  JGit v5.0.3.201809091024-r
  Prepare 4.9.5-SNAPSHOT builds
  JGit v4.9.4.201809090327-r
  Fix @since tag for LOCK_SUFFIX
  Prepare 4.7.4-SNAPSHOT builds
  JGit v4.7.3.201809090215-r

Change-Id: I9117b961035ee527cb8e1dd5df59976fff83829d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 21:05:41 +02:00
Matthias Sohn 0b11e31a4c Prepare 5.0.4-SNAPSHOT builds
Change-Id: Ib9042662c3f2a1544d597d476c5952c61767687b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 17:28:59 +02:00
Matthias Sohn faf1ae230e JGit v5.0.3.201809091024-r
Change-Id: I9e8e74a10dbb235b08c6a5e1b169c5cae440f129
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 16:24:44 +02:00
Matthias Sohn a9e5ee3f06 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Prepare 4.9.5-SNAPSHOT builds
  JGit v4.9.4.201809090327-r
  Fix @since tag for LOCK_SUFFIX
  Prepare 4.7.4-SNAPSHOT builds
  JGit v4.7.3.201809090215-r

Change-Id: Ia72fc409f0262565cf31b8bc62737c78fc4c3485
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 15:53:35 +02:00
Matthias Sohn 0d4e04c575 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Prepare 4.9.5-SNAPSHOT builds
  JGit v4.9.4.201809090327-r
  Fix @since tag for LOCK_SUFFIX
  Prepare 4.7.4-SNAPSHOT builds
  JGit v4.7.3.201809090215-r

Change-Id: I8e962758973753fe7baffd959050593a059ee44e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 15:44:44 +02:00
Matthias Sohn 8f46488385 Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Prepare 4.9.5-SNAPSHOT builds
  JGit v4.9.4.201809090327-r
  Fix @since tag for LOCK_SUFFIX
  Prepare 4.7.4-SNAPSHOT builds
  JGit v4.7.3.201809090215-r

Change-Id: I78099d2a5ba895273ca3ac587c7aa5f3f43fe869
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 15:43:04 +02:00
Matthias Sohn a253c39729 Use the same default diff.renameLimit = 400 like native git
Bug: 434085
Change-Id: I43a0401049cd85b2c7a2162ccc071af7fffdfed3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 13:03:36 +02:00
Matthias Sohn de0a687948 Prepare 4.9.5-SNAPSHOT builds
Change-Id: Ie8d2b60be1803399027e1a3e9734625278a63861
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 09:36:35 +02:00
Matthias Sohn 6657f93adb JGit v4.9.4.201809090327-r
Change-Id: I13488a915fe0ba871c5f37c6e9efc6f436083171
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 09:29:05 +02:00
Matthias Sohn f8de0596d7 Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  Fix @since tag for LOCK_SUFFIX
  Prepare 4.7.4-SNAPSHOT builds
  JGit v4.7.3.201809090215-r

Change-Id: Id3c85149316cbe671e55f41438bd3a3a892b4ed0
2018-09-09 09:25:54 +02:00
Matthias Sohn b0a0c1004f Fix @since tag for LOCK_SUFFIX
Change-Id: Ia65cf3f12ec6d35a21b4d9332be912f06d8bf834
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 08:46:11 +02:00
Matthias Sohn 582d623964 Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Fix atomic lock file creation on NFS
  Use constant for ".lock"
  Fix handling of option core.supportsAtomicCreateNewFile
  GC: Avoid logging errors when deleting non-empty folders

Change-Id: I3c8892e33516bdcadd983e7ab668635b7fa3d4c5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-08 22:13:00 +02:00
Matthias Sohn 155dd1c5be Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Fix atomic lock file creation on NFS
  Use constant for ".lock"
  Fix handling of option core.supportsAtomicCreateNewFile
  GC: Avoid logging errors when deleting non-empty folders

Change-Id: Ifcc8bfab4fd05c18a08dd82588860dffd0e6d726
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-08 11:09:27 +02:00
Matthias Sohn 5a583ef393 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Fix atomic lock file creation on NFS
  Use constant for ".lock"
  Fix handling of option core.supportsAtomicCreateNewFile
  GC: Avoid logging errors when deleting non-empty folders

Change-Id: Ie86079d9ad76972306bc80e63d8bfe18ae06a0da
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-08 10:12:48 +02:00
Matthias Sohn 9e26cb106f Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Fix atomic lock file creation on NFS
  Use constant for ".lock"
  Fix handling of option core.supportsAtomicCreateNewFile
  GC: Avoid logging errors when deleting non-empty folders

Change-Id: I32dc651870b7ba7c88de448c7984134b7c99e7e3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-08 10:03:22 +02:00
Matthias Sohn 4ce79bf738 Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  Fix atomic lock file creation on NFS
  Use constant for ".lock"
  Fix handling of option core.supportsAtomicCreateNewFile
  GC: Avoid logging errors when deleting non-empty folders

Change-Id: Id7f68f4e8fb07a21737e3b7090f600507a13bbbe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-08 09:15:01 +02:00
Matthias Sohn 8699a95d2d Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  Fix atomic lock file creation on NFS
  Use constant for ".lock"
  Fix handling of option core.supportsAtomicCreateNewFile
  GC: Avoid logging errors when deleting non-empty folders

Change-Id: Ia7a18f69eee173aec9e462c16eee2b0ca4565e76
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-08 08:58:12 +02:00
Matthias Sohn 06e06fc291 Fix atomic lock file creation on NFS
FS_POSIX.createNewFile(File) failed to properly implement atomic file
creation on NFS using the algorithm [1]:
- name of the hard link must be unique to prevent that two processes
  using different NFS clients try to create the same link. This would
  render nlink useless to detect if there was a race.
- the hard link must be retained for the lifetime of the file since we
  don't know when the state of the involved NFS clients will be
  synchronized. This depends on NFS configuration options.

To fix these issues we need to change the signature of createNewFile
which would break API. Hence deprecate the old method
FS.createNewFile(File) and add a new method createNewFileAtomic(File).

The new method returns a LockToken which needs to be retained by the
caller (LockFile) until all involved NFS clients synchronized their
state. Since we don't know when the NFS caches are synchronized we need
to retain the token until the corresponding file is no longer needed.
The LockToken must be closed after the LockFile using it has been
committed or unlocked. On Posix, if core.supportsAtomicCreateNewFile =
false this will delete the hard link which guarded the atomic creation
of the file. When acquiring the lock fails ensure that the hard link is
removed.

[1] https://www.time-travellers.org/shane/papers/NFS_considered_harmful.html
also see file creation flag O_EXCL in
http://man7.org/linux/man-pages/man2/open.2.html

Change-Id: I84fcb16143a5f877e9b08c6ee0ff8fa4ea68a90d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-07 12:13:53 +02:00
Matthias Sohn 6bec391d36 Use constant for ".lock"
(cherry picked from commit 5f27032fb8)

Change-Id: I6bc0e9a910b110418a82d8e574fb2aecc3a31d6a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-07 12:13:53 +02:00
Christian Halstrick 2faccd5b32 Fix handling of option core.supportsAtomicCreateNewFile
When core.supportsAtomicCreateNewFile was set to false and the
repository was located on a filesystem which doesn't support the file
attribute "unix:nlink" then FS_POSIX#createNewFile may report an error
even if everything was ok. Modify FS_POSIX#createNewFile to silently
ignore this situation. An example of such a filesystem is sshfs where
reading "unix:nlink" always returns 1 (instead of throwing a exception).

Bug: 537969
Change-Id: I6deda7672fa7945efa8706ea1cd652272604ff19
Also-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-09-07 00:33:14 +02:00
Matthias Sohn 4c8a4eb8fd Prepare 5.1.0-SNAPSHOT builds
Change-Id: I3d06c5237edae54b09f465f415f5a308b5e7ceff
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-05 20:41:53 +02:00
Matthias Sohn e4281f1d5f JGit v5.1.0.201809051400-rc1
Change-Id: I0b53f95ee51d94da8b029c9bb10eb854ff9dd4f6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-05 19:55:38 +02:00
Hector Caballero b7351facd5 GC: Avoid logging errors when deleting non-empty folders
I88304d34c and Ia555bce00 modified the way errors are handled when
trying to delete non-empty reference folders. Before, this error was
silently ignored as it was considered an expected output. Now, every
failed folder delete is logged which can be noisy.

Ignore the DirectoryNotEmptyException but log any other error avoiding
deletion of an eligible folder.

Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com>
Change-Id: I194512f67885231d62c03976ae683e5cc450ec7c
2018-09-05 06:59:51 -04:00
David Turner 559c68cb01 Parse signature of GPG-signed commits
In order to support GPG-signed commits, add some methods which will
allow GPG signatures to be parsed out of RevCommit objects.

Later, we can add code to verify the signatures.

Change-Id: Ifcf6b3ac79115c15d3ec4b4eaed07315534d09ac
Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-04 20:13:16 +02:00
David Pursehouse 30c6c75421 Deprecate Constants.CHARSET in favor of StandardCharsets.UTF_8
Change-Id: I3b748620f067582afef20f144feebe40d0332be2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-09-04 10:53:10 +09:00
Jonathan Nieder ce38391e09 Merge "Replace useminimalnegotation flag with maxhaves flag" 2018-08-31 20:02:51 -04:00
Minh Thai c398fb2b6b Replace useminimalnegotation flag with maxhaves flag
Client will stop sending haves when the number of haves sent reaches maxhaves.

Change-Id: I1e5b1525be4c67f20a81ca24a2770c20eb5c1271
Signed-off-by: Minh Thai <mthai@google.com>
2018-08-31 16:43:46 -07:00
Ivan Frade a8c38bc767 Extract protocol v2 fetch request parsing to its own class
The parsing code for protocol v2 fetch doesn't have any dependency on
the rest of UploadPack.

Move it to its own class. This makes testing easier (no need to
instantiate the full UploadPack), simplifies the code in UploadPack and
increases modularity.

At the moment, the parser needs to know about the reference database to
validate incoming references. This dependency could be easily removed
moving the validation later in the flow, after the parsing, where other
validations are already happening. Postponing that to keep this patch
about moving unmodified code around.

Change-Id: I7ad29a6b99caa7c12c06f5a7f30ab6a5f6e44dc7
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-08-31 15:31:36 -07:00
Jonathan Nieder 346bc34169 FetchV2Request: Rename shallowSince to deepenSince
This fetch parameter is called deepen-since in the protocol.  Call it
the same thing in the request object to make the code easier to reason
about.

This doesn't touch UploadPack#shallowSince, which is likely to be
eliminated altogether in a later patch anyway.

Change-Id: I8ef34bc7ad12fae3a9057ae951367cc024e1a1cb
Suggested-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-08-31 13:07:45 -07:00
Jonathan Nieder 4e8feb96a3 FetchV2Request: Correct typo in parameter name
There is an extra 'd' in deependNotRefs.  Noticed during code review.

Change-Id: I93d8d7951fe5c351b62e23bdf5bad0ebd631017d
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-08-31 13:03:29 -07:00
Ivan Frade 04d27cf70f FetchV2Request round up (doneReceived, renamings)
Make "doneReceived" a member of the fetch request. It indicates if the
"done" line has been received (so it makes sense there) and makes all
the code after the parsing depend only on the request.

Rename "shallowExcludeRefs" to "deepenNot". Those refs come in
"deepen-not" lines in the protocol, and this name makes clearer the
intention.

Change-Id: I7bec65de04930277266491d278de7c3af7d8cbe6
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-08-31 09:16:11 -07:00
Ivan Frade 74d41be0d1 Use right variable in error message about depth
When this exception is thrown, the `depth` member variable isn't set
yet, resulting in a confusing error message: "Invalid depth: 0".

Change-Id: I8a2bd5e1d9bec00acb0b8857bbf6821e95bf1369
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-08-30 14:37:06 -07: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 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 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
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
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
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