Commit Graph

6292 Commits

Author SHA1 Message Date
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 81735222c9 Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  Prepare 4.7.4-SNAPSHOT builds
  JGit v4.7.3.201809090215-r

Change-Id: I980807ad4701f9e510354b505c9556e123f32471
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 08:48:59 +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 6fe4505b2a Prepare 4.7.4-SNAPSHOT builds
Change-Id: Ie4d17e1604270946606e75145012c5b7fa1283eb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 08:24:16 +02:00
Matthias Sohn 9796e86165 JGit v4.7.3.201809090215-r
Change-Id: I1ded7a2b61235509c5a6ba95e7329e288bbfddb1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-09 08:15:48 +02:00
Matthias Sohn bb8fa8c646 Merge branch 'stable-5.1'
* stable-5.1:
  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: If912f34bc15cba66cdb7fda1d8293e10727ea4a8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-08 22:14:02 +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 2fae326aa9 Prepare 5.2.0-SNAPSHOT builds
Change-Id: If8e8ca20e745901a5e0239c16cb4acc7934b4ec8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-06 09:36:00 +02:00
David Pursehouse 1f962f3c53 Merge "Merge branch 'stable-5.1'" 2018-09-06 03:06:35 -04:00
Matthias Sohn b1b7376567 Merge branch 'stable-5.1'
* stable-5.1:
  Prepare 5.1.0-SNAPSHOT builds
  JGit v5.1.0.201809051400-rc1

Change-Id: Ic34523c4ac725d2af20c79c4f856060808090699
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-06 01:24:52 +02:00
René Scheibe d80a01e6a0 Extend ResetCommandTest
Also check that reflog is enabled by default.
Also check that a file in a folder is reset correctly.

Change-Id: I4bc6649928ce10d7b558901e465e8032b083ade0
Signed-off-by: René Scheibe <rene.scheibe@gmail.com>
2018-09-05 15:32:11 -04: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
Matthias Sohn 771ca345e5 Merge branch 'master' into stable-5.1
* master:
  UploadPackTest: Avoid unnecessarily boxing int into Integer
  Parse signature of GPG-signed commits
  Deprecate Constants.CHARSET in favor of StandardCharsets.UTF_8
  Simplify file creation in ResetCommandTest
  Specify charset when constructing InputStreamReader
  Update Orbit to S20180829155938 for 2018-09 RC1
  Replace useminimalnegotation flag with maxhaves flag
  Extract protocol v2 fetch request parsing to its own class
  FetchV2Request: Rename shallowSince to deepenSince
  FetchV2Request: Correct typo in parameter name
  FetchV2Request round up (doneReceived, renamings)
  Use right variable in error message about depth
  UploadPack: avoid conflating shallow commit lists in protocol v2
  Bazel: Use hyphen instead of underscore in external repository names
  Format BUILD files with buildifier 0.15.0
  Upgrade maven-compiler-plugin to 3.8.0

Change-Id: Ibc6feb828e4ff20a3158e6b75dcfce7617e00b0e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-05 17:52:44 +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 Pursehouse 2173f44158 UploadPackTest: Avoid unnecessarily boxing int into Integer
The statement:

  assertThat(recvStream.available(), is(0));

results in a warning from Eclipse:

  The expression of type int is boxed into Integer

because recvStream.available() returns int, but the hamcrest is()
method takes an Integer.

Replace it with the equivalent JUnit assertion.

Also remove the suppression of another similar warning and fix that
in the same way.

Change-Id: I6f18b304a540bcd0a10aec7d3abc7dc6f047fe80
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-09-05 08:39:32 +09: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
René Scheibe 685f8c8dbe Simplify file creation in ResetCommandTest
Use existing test utility methods instead of nested PrintWriter usage.

Change-Id: I324852c7971ae644fa499f377a31d1cf265c7fd9
Signed-off-by: René Scheibe <rene.scheibe@gmail.com>
2018-09-03 23:21:10 +02:00
David Pursehouse a3cb474c94 Specify charset when constructing InputStreamReader
ErrorProne warns [1] about implicit use of the platform default charset,
which can result in differing behaviour between JVM executions or
incorrect behavior if the encoding of the data source doesn't match
expectations.

[1] http://errorprone.info/bugpattern/DefaultCharset

Change-Id: I0fd489d352170339c3867355cd24324dfdbd4b59
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-09-02 01:44:36 -05:00
Matthias Sohn c9e4359c7c Update Orbit to S20180829155938 for 2018-09 RC1
Change-Id: I48d5a2e06e2833c9745cb71c53600da3ed5f8501
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-01 08:22:52 +02: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
Jonathan Nieder eb9a0c1983 Merge "FetchV2Request round up (doneReceived, renamings)" 2018-08-31 14:11:59 -04: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
David Pursehouse 6196eb6825 Merge branch 'stable-5.1'
* stable-5.1:
  Bazel: Use hyphen instead of underscore in external repository names
  Bazel: Format all build files with buildifier 0.15.0
  ChangeIdUtilTest: Remove unused notestCommitDashV

Change-Id: Ie9d77a7716591246b87fb59ac85214417fe8309d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-31 16:55:21 +09:00
David Pursehouse b6f3bdefce Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Bazel: Use hyphen instead of underscore in external repository names
  Bazel: Format all build files with buildifier 0.15.0
  ChangeIdUtilTest: Remove unused notestCommitDashV

Change-Id: I7c2fc7d694d7d891cac96cb805c89c8bdf7c5cbf
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-31 16:11:37 +09:00
David Pursehouse 0718d22cf4 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Bazel: Use hyphen instead of underscore in external repository names
  Bazel: Format all build files with buildifier 0.15.0
  ChangeIdUtilTest: Remove unused notestCommitDashV

Change-Id: I5ebb1058927ea5a478eae9e44b7d96f123a22523
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-31 15:45:42 +09:00
David Pursehouse b67aacda2f Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Bazel: Use hyphen instead of underscore in external repository names
  Bazel: Format all build files with buildifier 0.15.0
  ChangeIdUtilTest: Remove unused notestCommitDashV

Change-Id: I500dd4e63302abb19ad669988b3a427cef8ef3d4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-31 15:21:10 +09:00
David Pursehouse c4c7770d04 Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Bazel: Use hyphen instead of underscore in external repository names
  Bazel: Format all build files with buildifier 0.15.0
  ChangeIdUtilTest: Remove unused notestCommitDashV

Change-Id: I37e936de0c06d4b9f17724ac4f1feb83f6c15ae3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-31 13:58:15 +09:00
David Pursehouse a074203fa9 Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  Bazel: Use hyphen instead of underscore in external repository names
  Bazel: Format all build files with buildifier 0.15.0
  ChangeIdUtilTest: Remove unused notestCommitDashV

Change-Id: I17436237cd66ca1c2800ad5ab0142f4a2bc07328
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-31 13:14:28 +09:00
David Pursehouse b270e4b740 Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  Bazel: Use hyphen instead of underscore in external repository names
  Bazel: Format all build files with buildifier 0.15.0
  ChangeIdUtilTest: Remove unused notestCommitDashV

Change-Id: I414ade902dc38b696c566dd604000e3d289f3973
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-08-31 09:25:43 +09: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