Commit Graph

5078 Commits

Author SHA1 Message Date
David Pursehouse 07a07a75d6 PacketLineIn: Rename isDelim to isDelimiter
Change-Id: I279808b8ddd8a9230a35582c00867b811633dfe8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-06-02 18:32:55 +09:00
Brandon Weeks f4443ef3f9 Upgrade Bouncy Castle to 1.61
Also now use JcaKeyBoxBuilder constructor in
BouncyCastleGpgKeyLocator.readKeyBoxFile(Path).

CQ: 19868
CQ: 19869
CQ: 19870
Change-Id: I45bd80e158aecd90448b0c7e59615db27aaef892
Signed-off-by: Brandon Weeks <bweeks@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-06-01 01:39:26 +02:00
Sebastian Schuberth 237c76fddf DescribeCommand: Support the "always" option
See:

https://git-scm.com/docs/git-describe#Documentation/git-describe.txt---always

Extend the tests accordingly.

Change-Id: Ibfcda338a246c8cba0df6b6e7b9bad76c9f8b593
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2019-05-31 17:11:15 +02:00
Sebastian Schuberth afcb3a8c9e DescribeCommand: Consistenly omit the default value
Omit the default value of "false" for "useTags" like already done for
"longDesc".

Change-Id: I25aaacae028fc8cf27f4040ba45fe79609318aa1
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2019-05-31 17:08:39 +02:00
David Pursehouse d2425e16f4 PacketLineIn: Add helper methods to check for END and DELIM
These methods will allow clients to check for END and DELIM without
doing a reference comparison on the String objects, which raises
warnings from Error Prone.

Change-Id: I9e7e59843553ed4488ee8e864033198bbb60d67c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-05-30 20:31:39 +09:00
Matthias Sohn 4904a625c9 Avoid null PackConfig in GC
Initialize it using the repository's config already in the constructor.

Change-Id: I4ea620a7db72956e7109f739990f09644640206b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-29 23:41:46 +02:00
Matthias Sohn 43b06f51f9 Capture reason for result of FileSnapshot#isModified
This allows to verify the expected behavior in
FileSnapshotTest#testSimulatePackfileReplacement and enables extending
FileSnapshot for packfiles to read the packfile's checksum as another
criterion to detect modifications without reading the full content.

Also add another field capturing the result of the last check if
lastModified was racily clean.

Remove unnecessary determination of raciness in the constructor. It was
determined twice in all relevant cases.

Change-Id: I100a2f49d7949693d7b72daa89437e166f1dc107
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-29 23:41:45 +02:00
Marc Strapetz f1577909e7 ObjectDirectory: fix closing of obsolete packs
This resolves a regression introduced in fef78212.

Change-Id: Ibb4521635a87012520566efc70870c59d11be874
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
2019-05-27 10:49:51 +02:00
Ivan Frade 82316fc23a BitmapCalculator: javadoc fixes
Fill out the description of when IOException is thrown.

Also fix a typo in the description for IncorrectObjectTypeException.

Change-Id: I9fafd19d68ddc4fe4e95e8516c2c38484b941a3a
Signed-off-by: Ivan Frade <ifrade@google.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-05-27 10:38:37 +09:00
Matthias Sohn 92d1ca8099 Update API filters for methods added to fix bugs
Change-Id: I235c608d80a14c8af39400ae2e749488a4fa0d22
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-26 20:54:44 +02:00
Andrey Loskutov e57a37e767 RevWalkUtils: add progress callback to findBranchesReachableFrom
Offer a version of findBranchesReachableFrom method with progress
monitor callback. This is required to allow UI clients to cancel long
running operations and show progress.

Bug: 547642
Change-Id: I31d1de54dbaa6ffb11e03da4c447963e8defa1d0
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2019-05-25 13:52:49 +02:00
David Pursehouse 76c867d62a Merge branch 'stable-5.4'
* stable-5.4:
  SystemReader: Respect passed-in parent when no system config is present
  Prepare 5.4.0-SNAPSHOT builds
  JGit v5.4.0.201905221418-m3
  Prepare 5.4.0-SNAPSHOT builds
  JGit v5.4.0.201905081430-m2

Change-Id: If69cb0afe9915b926d977e4ad26c7d72db31667c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-05-24 08:34:40 +09:00
David Pursehouse 7eb222f20d Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  SystemReader: Respect passed-in parent when no system config is present

Change-Id: I758ed0c2a3527ffcf6255158a49090aba090e942
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-05-24 08:33:45 +09:00
Dave Borowitz 04bd5821e9 SystemReader: Respect passed-in parent when no system config is present
The default implementation of openSystemConfig has special handling for
when the FS returns null from getGitSystemConfig: it should return a
"real" FileBasedConfig instance that never actually tries to load a
file. However, this codepath was not respecting the passed-in parent
config.

Change-Id: Id0bcdc93bb42f9ebe3f5ee4c6b4be8863e0133f9
2019-05-23 16:07:49 -07:00
Matthias Sohn 73ba6658cf BitmapCalculator and its test: add missing license header
Change-Id: I3c4a8b1e9159b0553aa95213bb82628370b6c036
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-23 02:12:16 +02:00
Matthias Sohn 0988276746 Prepare 5.4.0-SNAPSHOT builds
Change-Id: I9df6fccee253d4087f9afab4cb46e0a40b8a5699
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-22 22:52:43 +02:00
Matthias Sohn 72998dd5ee JGit v5.4.0.201905221418-m3
Change-Id: I8a7e687acfcf8c341abd726ae60b5ee173422215
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-22 20:18:14 +02:00
Ivan Frade 5dce8614ab RevWalk: new method createReachabilityChecker()
Every caller would need to check if bitmaps are available in the repo to
instantiate a reachability checker.

Offer a method to create the reachability checker in the walk: the
caller has already a walk over the repo, and the walk has all the
information required.

This allows us to make the implementation classes package-private.

Change-Id: I355e47486fcd9d55baa7cb5700ec08dcc230eea5
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-05-22 14:17:31 -04:00
Ivan Frade 8216929618 ReachabilityCheckers: @since 5.4
The new ReachabilityChecker interface and its implementations are marked
as @since 5.5, but they will make it to the 5.4 release.

Change-Id: I88c31b3300ccf35d18c35faddb2517f0a57bdcfd
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-05-22 17:37:12 +02:00
Matthias Sohn 91101414ae Include filekey file attribute when comparing FileSnapshots
Due to finite filesystem timestamp resolution the last modified
timestamp of files cannot detect file changes which happened in the
immediate past (less than one filesystem timer tick ago).

Some filesystems expose unique file identifiers, e.g. inodes in Posix
filesystems which are named filekeys in Java's BasicFileAttributes. Use
them as another means to detect file modifications based on stat
information.

Running git gc on a repository yields a new packfile with the same id as
a packfile which existed before the gc if these packfiles contain the
same set of objects. The content of the old and the new packfile might
differ if a different PackConfig was used when writing the packfile.
Considering filekeys in FileSnapshot may help to detect such packfile
modifications.

Bug: 546891
Change-Id: I711a80328c55e1a31171d540880b8e80ec1fe095
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-22 08:13:56 +02:00
Matthias Sohn b513b77477 Measure file timestamp resolution used in FileSnapshot
FileSnapshot.notRacyClean() assumed a worst case filesystem timestamp
resolution of 2.5 sec (FAT has a resolution of 2 sec). Instead measure
timestamp resolution to avoid unnecessary IO caused by false positives
in detecting the racy git problem caused by finite filesystem timestamp
resolution [1].

Cache the measured resolution per FileStore since timestamp resolution
depends on the respective filesystem type. If timestamp resolution
cannot be measured or fails due to an exception fallback to the worst
case FAT timestamp resolution and avoid caching this value.

Add a 10% safety margin in FileSnapshot.notRacyClean(), though running
FsTest.testFsTimestampResolution() 1000 times which is not using a
safety margin didn't fail on Mac using APFS and Java 8, 11, 12.

Measured Java file timestamp resolution: [2]

[1] https://github.com/git/git/blob/master/Documentation/technical/racy-git.txt
[2] https://docs.google.com/spreadsheets/d/1imy0y6WmRqBf0kjCxzxj2X7M50eIVfa7oaUIzEOHmjo

Bug: 546891
Change-Id: I493f3b57b6b306285ffa7d392339d253e5966ab8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-22 08:13:22 +02:00
Matthias Sohn 201bbd6ead Fix FileSnapshot's consideration of file size
* fix equals() and hashCode() methods to consider size
* fix toString() to show size

Change-Id: I5485db55eda5110121efd65d86c7166b3b2e93d0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-22 08:12:51 +02:00
Matthias Sohn ed2e515ddf Fix API problem filters
Change-Id: I566391d7c51875f30cf580d64e6784819985709f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-22 08:03:29 +02:00
Thomas Wolf efe6d2bb5b GPG: check that the key found is a signing key
Throw an exception if not.

Change-Id: I60f36b271d5f44c6dc475302b169cb5b8a1e3945
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-05-21 18:13:40 +02:00
Thomas Wolf 6536b5cbca GPG: use key fingerprint suffix to compare id for signing key
Check whether the value of the git config user.signingKey is a suffix
of the full fingerprint of the key. This was already used for finding
keys in secring.gpg, but not in pubring.kbx. This mechanism allows a
user to use any unique suffix to identify keys; to avoid needless
collisions it's recommended to use at least the last 16 characters of
the hex representation of the fingerprint, which is the key id.[1]

[1] https://tools.ietf.org/html/rfc4880#section-12.2

Bug: 545673
Change-Id: If6fb4879502b6ee4b8c26c21b2714aeac4e4670c
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-05-21 18:11:28 +02:00
Jonathan Tan f2318190bf UploadPack: restore inadvertently deleted line
In 7b96bd812e ("UploadPack: Use reachability checker to validate
non-advertised wants", 2019-05-16), a "walk.setRetainBody(false);"
statement was inadvertently deleted. (An earlier version of this commit
had this line in another part of the code and a review comment suggested
to move it back here; the line was then deleted from the other part of
the code but not readded.) Restore this line.

Change-Id: I96ff6106ba9e4eef429388c83e898b3363295f69
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2019-05-20 16:22:31 -07:00
Jonathan Tan 7121fa6fec Merge changes from topic 'reachability-2'
* changes:
  UploadPack: Use reachability checker to validate non-advertised wants
  BitmappedReachabilityChecker: Reachability check using bitmaps
  BitmapCalculator: Get the reachability bitmap of a commit
  ReachabilityChecker: Default implementation with a RevWalk
2019-05-20 16:04:28 -04:00
Ivan Frade 7b96bd812e UploadPack: Use reachability checker to validate non-advertised wants
In "Reachable commit" request validators, we need to check that a "want"
in the request, that hasn't been advertised, is reachable from the refs
visible to the user.

Current code has intermixed the translation of ObjectIds to RevCommits
(and its error handling) with the actual walk, with the delegation to
bitmaps in restricted circunstances.

Refactor the code to make it "flatter" and more readable. Move ObjectIds
to RevCommits translation to its own functions. Use the reachability
checker instead of a newly defined walk.

Before the non-advertised wants were validated with bitmaps only if any
"want" refered to an non-commit. Now they will be validated with bitmaps
also if the "wants" refer all to commits.

Change-Id: Ib925a48cde89672b07a88bba4e24d0457546baff
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-05-16 16:31:16 -07:00
Carsten Hammer 84fc5c908d Convert to lambda or member reference
Convert anonymous inner classes to lambda expressions or member
references

Bug: 545856
CQ: 19537
Change-Id: I621431c178e8b99316314602f7c66c9a36f9ae98
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-16 02:58:43 -04:00
Ivan Frade 601b0ae577 BitmappedReachabilityChecker: Reachability check using bitmaps
The "basic" reachability check walks the graph starting from the tips
marking things as "uninteresting". If the target commit is marked as
"uninteresting" it was reached; it is reachable from those tips.

This requires a lot of walking and can be solved directly with bitmaps.
Most of the time the bitmaps are already calculated or a short walk
away.

This should improve the performance of reachability checks, for example
in Gitiles.

Change-Id: I83d33271f58d95d2dc9ed151967b3eda513c99f7
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-05-15 16:36:20 -07:00
Ivan Frade b6da4b34cc BitmapCalculator: Get the reachability bitmap of a commit
To make reachability checks with bitmaps, we need to get the
reachability bitmap of a commit, which is not always precalculated.

There is already a class returning such bitmap (BitmapWalker) but it
does too much unnecessary work: it calculates ALL reachable objects from
a commit (i.e. including trees and blobs), when for reachability the
commits are just enough.

Introduce BitmapCalculator to get the bitmap of a commit: either because
it is precalculated or generating it with a walk only over commits.

Change-Id: Ibb6c78affe9eeaf1fa362a06daf4fd2d91c1caea
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-05-15 15:04:00 -07:00
Ivan Frade 4e196faa1b ReachabilityChecker: Default implementation with a RevWalk
It is common to check if a certain commit is reachable from some
starting points. For example gitiles does it to check if a commit
is visible to a user based on its permissions.

Offer this functionality in JGit.

Split the interface as the next commit will introduce an implementation
using bitmap indices.

Change-Id: I0933b305c8d734f7a64502910ff4d9ef4fc92ae1
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-05-15 14:55:54 -07:00
Matthias Sohn f5957e433c Fix API problem filters
Change-Id: Ie67a9f8c62152a1d02782f0571202d9b88ae31f4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-14 17:22:26 +02:00
Matthias Sohn 8f2b4c8a6e Use integer depth in PackWriter's DepthAwareVisitationPolicy
- ObjectWalk.getTreeDepth() returns int hence there is no need to use
long depths in the lowestDepthVisited map.
- Also fix boxing warnings introduced in 0a15cb3a.

Change-Id: I6d73b6f41d5d20975d02f376c8588e411eaff0ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-03 12:43:59 +02:00
David Pursehouse 8491a1134e SubmoduleWalk#forPath: Clarify that caller must close returned instance
Change-Id: I25e7913a78c23c030a8c568975ee1044a9973517
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-04-29 00:40:46 +02:00
David Pursehouse 18ae69158f ConfigConstants: Fix quoting of section names in javadocs
Replace:

 in the "core section"
 in the "diff section"
 in the "merge section"

with:

 in the "core" section
 in the "diff" section
 in the "merge" section

Change-Id: Ided7bf73e9c8aae4fc4e43d5d5b9f6d7e3066f0a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-04-29 00:40:46 +02:00
Matthias Sohn 88b56ff1e9 Silence API errors and add missing @since tags caused by 175e6654
Change-Id: If55acad84015f988f1e974bc19c426828b98822b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-29 00:36:00 +02:00
Matthias Sohn 3c92025c1b Merge branch 'stable-5.3'
* stable-5.3:
  Prepare 5.3.2-SNAPSHOT builds
  JGit v5.3.1.201904271842-r
  Prepare 5.2.3-SNAPSHOT builds
  JGit v5.2.2.201904231744-r
  Revert 4678f4b and provide another solution for bug 467631
  Apache MINA sshd: make sendKexInit() work also for re-keying
  Prepare 5.1.8-SNAPSHOT builds
  JGit v5.1.7.201904200442-r
  ObjectUploadListener: Add callback interface
  Prepare 4.11.9-SNAPSHOT builds
  JGit v4.11.8.201904181247-r
  Prepare 4.9.11-SNAPSHOT builds
  JGit v4.9.10.201904181027-r
  Prepare 4.7.10-SNAPSHOT builds
  JGit v4.7.9.201904161809-r
  Prepare 4.5.8-SNAPSHOT builds
  JGit v4.5.7.201904151645-r
  Remember the cause for invalidating a packfile
  Fix API problem filters
  Fix pack files scan when filesnapshot isn't modified

Change-Id: I8a8671f7767444a77b809bd66a27d776c8332736
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-29 00:10:43 +02:00
Matthias Sohn 1342942cc8 Prepare 5.3.2-SNAPSHOT builds
Change-Id: Iedd56602acc89783387098c7f92ce0e5bad091e0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-28 00:54:08 +02:00
Matthias Sohn 38049a008d JGit v5.3.1.201904271842-r
Change-Id: If3c323acfd2b6933f7d4fbec480cd4e82224f701
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-28 00:41:59 +02:00
Matthias Sohn 32f0963b84 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Prepare 5.2.3-SNAPSHOT builds
  JGit v5.2.2.201904231744-r
  Revert 4678f4b and provide another solution for bug 467631
  Apache MINA sshd: make sendKexInit() work also for re-keying
  Prepare 5.1.8-SNAPSHOT builds
  JGit v5.1.7.201904200442-r
  ObjectUploadListener: Add callback interface
  Prepare 4.11.9-SNAPSHOT builds
  JGit v4.11.8.201904181247-r
  Prepare 4.9.11-SNAPSHOT builds
  JGit v4.9.10.201904181027-r
  Prepare 4.7.10-SNAPSHOT builds
  JGit v4.7.9.201904161809-r
  Prepare 4.5.8-SNAPSHOT builds
  JGit v4.5.7.201904151645-r
  Remember the cause for invalidating a packfile
  Fix API problem filters
  Fix pack files scan when filesnapshot isn't modified

Change-Id: Ie7e572ac7e346f21fe0c387d7448be168a9c127a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-28 00:30:47 +02:00
Matthias Sohn a72e0b0188 Prepare 5.2.3-SNAPSHOT builds
Change-Id: I6ae3db901d986467128326073d4ba70406ae8385
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-24 00:04:44 +02:00
Matthias Sohn 1d297c3ddc JGit v5.2.2.201904231744-r
Change-Id: I4ed2aff28bff702a8c1b42814acb04c7ef9025a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-23 23:43:50 +02:00
Thomas Wolf 8277f62897 Revert 4678f4b and provide another solution for bug 467631
Making gitlinks and folders match in a tree walk was the wrong
approach to fix bug 467631. The problem is that in such a conflict
the tree walk may then not descend into the folder.

Revert the changes to Paths.java and PathsTest.java from commit
4678f4b. Instead test for the problem case from bug 467631 explicitly
in IndexDiff. Add Daniel's test case from bug 545162, and add yet
another test case for DiffEntry.scan() that covers the problem
originally reported in bug 545162.

Bug: 545162
Change-Id: Ie2214c5d5ee32ac6596b621f0f1c7b86d38fa9b7
Also-by: Daniel Veihelmann <daniel.veihelmann@gmail.com>
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-04-20 11:19:34 +02:00
Matthias Sohn 2a6973bf6b Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Prepare 5.1.8-SNAPSHOT builds
  JGit v5.1.7.201904200442-r
  ObjectUploadListener: Add callback interface
  Prepare 4.11.9-SNAPSHOT builds
  JGit v4.11.8.201904181247-r
  Prepare 4.9.11-SNAPSHOT builds
  JGit v4.9.10.201904181027-r
  Prepare 4.7.10-SNAPSHOT builds
  JGit v4.7.9.201904161809-r
  Prepare 4.5.8-SNAPSHOT builds
  JGit v4.5.7.201904151645-r
  Remember the cause for invalidating a packfile
  Fix API problem filters
  Fix pack files scan when filesnapshot isn't modified

Change-Id: I76761002eedf360e93d0559942ebc927a40428d6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-20 11:16:54 +02:00
Matthias Sohn c2945bd261 Prepare 5.1.8-SNAPSHOT builds
Change-Id: I331bbaefd42ef94673ae8565c9b2b3af9eadfda0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-20 10:51:17 +02:00
Matthias Sohn 22e41cfd56 JGit v5.1.7.201904200442-r
Change-Id: Ifaa3a88c5e117912a8c691b8b8369dd9a17faebb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-20 10:42:58 +02:00
Matthias Sohn f33fd16425 Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Prepare 4.11.9-SNAPSHOT builds
  JGit v4.11.8.201904181247-r
  Prepare 4.9.11-SNAPSHOT builds
  JGit v4.9.10.201904181027-r
  Prepare 4.7.10-SNAPSHOT builds
  JGit v4.7.9.201904161809-r
  Prepare 4.5.8-SNAPSHOT builds
  JGit v4.5.7.201904151645-r
  Remember the cause for invalidating a packfile
  Fix API problem filters
  Fix pack files scan when filesnapshot isn't modified

Change-Id: I685d8a797209bc1b9c1bb9caba40ac8713c6ce5b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-20 01:52:02 +02:00
Matthias Sohn 710d00b85e Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Prepare 4.11.9-SNAPSHOT builds
  JGit v4.11.8.201904181247-r
  Prepare 4.9.11-SNAPSHOT builds
  JGit v4.9.10.201904181027-r
  Prepare 4.7.10-SNAPSHOT builds
  JGit v4.7.9.201904161809-r
  Prepare 4.5.8-SNAPSHOT builds
  JGit v4.5.7.201904151645-r
  Remember the cause for invalidating a packfile
  Fix API problem filters
  Fix pack files scan when filesnapshot isn't modified

Change-Id: I9b7f9faf3dc584068456f1ae2cacc4ce5137d4ad
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-19 12:36:24 +02:00
Matthias Sohn f90c526cfb Prepare 4.11.9-SNAPSHOT builds
Change-Id: Ie0ef10159bac6daf4db3f68e8c0825bc1608e40f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-19 12:05:01 +02:00
Matthias Sohn 513710a9a4 JGit v4.11.8.201904181247-r
Change-Id: I0356bde8fbb789faa74ed3635046f4fd0dce28de
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-18 18:47:14 +02:00
Matthias Sohn bb7d58d670 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Prepare 4.9.11-SNAPSHOT builds
  JGit v4.9.10.201904181027-r
  Prepare 4.7.10-SNAPSHOT builds
  JGit v4.7.9.201904161809-r
  Prepare 4.5.8-SNAPSHOT builds
  JGit v4.5.7.201904151645-r
  Remember the cause for invalidating a packfile
  Fix API problem filters
  Fix pack files scan when filesnapshot isn't modified

Change-Id: Ib2a170e24bddad0e8c9c7be6688269f6318bf30f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-18 18:44:35 +02:00
Matthias Sohn 53014c0804 Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Prepare 4.9.11-SNAPSHOT builds
  JGit v4.9.10.201904181027-r
  Prepare 4.7.10-SNAPSHOT builds
  JGit v4.7.9.201904161809-r
  Prepare 4.5.8-SNAPSHOT builds
  JGit v4.5.7.201904151645-r
  Remember the cause for invalidating a packfile
  Fix API problem filters
  Fix pack files scan when filesnapshot isn't modified

Change-Id: I94c9e6300b5f77b185ec6661fa76f0c74a5fc2a9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-18 18:43:01 +02:00
Matthias Sohn 551110b0e2 Prepare 4.9.11-SNAPSHOT builds
Change-Id: I99137bc4958167773d2fc8b1d48fbb508af52be5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-18 18:05:43 +02:00
Matthias Sohn 7be6f02d32 JGit v4.9.10.201904181027-r
Change-Id: I3034d1ad263fdfb23347304f866309354930fd19
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-18 16:26:30 +02:00
Matthias Sohn d5ec15c8d0 Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  Prepare 4.7.10-SNAPSHOT builds
  JGit v4.7.9.201904161809-r
  Prepare 4.5.8-SNAPSHOT builds
  JGit v4.5.7.201904151645-r
  Remember the cause for invalidating a packfile
  Fix API problem filters
  Fix pack files scan when filesnapshot isn't modified

Change-Id: Idaa789e699f1ef568ea957184d0641355d9e3181
2019-04-18 14:43:23 +02:00
Matthias Sohn fad5cf8b23 Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  Prepare 4.7.10-SNAPSHOT builds
  JGit v4.7.9.201904161809-r
  Prepare 4.5.8-SNAPSHOT builds
  JGit v4.5.7.201904151645-r
  Remember the cause for invalidating a packfile
  Fix API problem filters
  Fix pack files scan when filesnapshot isn't modified

Change-Id: I7984f68833f2d615399296e53cb9a64e5b4ca6ed
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-17 00:54:37 +02:00
Matthias Sohn 21042c0de7 Prepare 4.7.10-SNAPSHOT builds
Change-Id: I662ee441521c1370a31f274cc6d001723ad0c528
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-17 00:18:13 +02:00
Matthias Sohn cfeb4187b7 JGit v4.7.9.201904161809-r
Change-Id: Id6e379c3ce52c83455e37cbc3d77db0e188fdb85
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-17 00:08:39 +02:00
Matthias Sohn b23735107b Merge branch 'stable-4.6' into stable-4.7
* stable-4.6:
  Prepare 4.5.8-SNAPSHOT builds
  JGit v4.5.7.201904151645-r
  Remember the cause for invalidating a packfile
  Fix API problem filters
  Fix pack files scan when filesnapshot isn't modified

Change-Id: I6ea51dde6608a4163d681aa1ebf710f06da44b21
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-16 23:53:21 +02:00
Matthias Sohn 422f030d29 Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Prepare 4.5.8-SNAPSHOT builds
  JGit v4.5.7.201904151645-r
  Remember the cause for invalidating a packfile
  Fix API problem filters
  Fix pack files scan when filesnapshot isn't modified

Change-Id: I0b4eaa521ebdea83ab18c05915d691c07a575a7d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-16 23:36:46 +02:00
Matthew DeVore 0a15cb3a2b tree:<depth>: do not revisit tree during packing
If a tree is visited during pack and filtered out with tree:<depth>, we
may need to include it if it is visited again at a lower depth.

Until now we revisit it no matter what the depth is. Now, avoid
visiting it if it has been visited at a lower or equal depth.

Change-Id: I68cc1d08f1999a8336684a05fe16e7ae51898866
Signed-off-by: Matthew DeVore <matvore@gmail.com>
2019-04-16 10:36:59 -07:00
Matthew DeVore 175e66548b tree:<depth> should not traverse overly-deep trees
If we are traversing a tree which is too deep, then there is no need to
traverse the children. Skipping children is much faster than traversing
the possibly thousands of objects which are directly or indirectly
referenced by the tree.

Change-Id: I6d68cc1d35da48e3288b9cc80356a281ab36863d
Signed-off-by: Matthew DeVore <matvore@gmail.com>
2019-04-16 10:36:59 -07:00
Matthew DeVore 93dd2d482a Preliminary support for tree:<depth> filter
This is used when fetching, and in particular to populate a partial
clone or a virtual file system cache as the user navigates. With this,
a client can pre-fetch a few directories deeper than only the current
directory.

depth:0 will omit all trees, and is useful if you only want to fetch
the commits of a repository, or fetch just a single tree or blob object.
depth:1 will fetch only the root tree of all commits fetched. depth:2
will fetch the root tree and all blobs and tree objects directly
referenced from it. depth:3 gets one more level, and so on. depth:#
will not filter a blob or tree that is explicitly marked wanted.

Bitmaps are disabled when this filter is used.

This implementation is quite slow because it iterates over all omitted
objects rather than skipping them. This will be addressed in follow-up
commits.

Change-Id: Ic312fee22d60e32cfcad59da56980e90ae2cae6a
Signed-off-by: Matthew DeVore <matvore@gmail.com>
2019-04-16 10:36:55 -07:00
Matthias Sohn 0291b2eaf8 Prepare 4.5.8-SNAPSHOT builds
Change-Id: I70628cb8fcad0a60598dc937abbed63606a78599
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-16 00:34:19 +02:00
Matthias Sohn adccfd4503 JGit v4.5.7.201904151645-r
Change-Id: I3e32cf13f5cb99d8e570412d80d941740399c07d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-15 22:46:38 +02:00
Jonathan Nieder 5a0f631063 Merge "Revert "Use try-with-resources in SubmoduleWalk"" 2019-04-14 12:09:02 -04:00
Jonathan Nieder 460500e99a Revert "Use try-with-resources in SubmoduleWalk"
This reverts commit 39b0b51b12. Before
that change, SubmoduleWalk.forPath transferred ownership to the caller
on success. Afterward, it returns a closed SubmoduleWalk to the caller,
which does not appear to be intentional.

Change-Id: I9381daac5153706e24fd9117700089848b58c54e
2019-04-14 11:00:46 -04:00
Carsten Hammer 0b320b2c35 Use Arrays.asList instead of copying array in a for loop
Change-Id: Ie44950f7d2f2f94a0412efb6c274f6e1e31efcd6
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-14 00:19:51 +02:00
Carsten Hammer 39b0b51b12 Use try-with-resources in SubmoduleWalk
Convert try finally block to try-with-resources
Change-Id: Ifd676a2aba3e926bd2f3b6b8fefd5f63564899ed
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-13 19:58:24 +02:00
Carsten Hammer 6a4c77e619 Use isEmpty() instead of size()==0 where possible
Change-Id: I97f1367a2ea9f1f6146e264c27c3981b842f2a26
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-13 19:53:29 +02:00
Carsten Hammer 6e03645ad8 Use jdk 5 for loop
Replace simple uses of Iterator with a corresponding for-loop.
Also add missing braces on loops as necessary.

Change-Id: I708d82acdf194787e3353699c07244c5ac3de189
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-13 19:33:13 +02:00
Carsten Hammer c0268f899e Join catch sections using multicatch
Change-Id: I1a9112e6a4f938638c599b489cb0858eca27ab91
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-13 18:53:58 +02:00
Masaya Suzuki 3c1af2761f Process unshallow commits first
DepthGenerator marks commits reinteresting for the ones that are
reachable from unshallow commits as it walks over the revisions. Those
unshallow commits won't necessarily be processed first. Because of this,
even if a commit is reachable from unshallow commits, if it's processed
before the uninteresting commits, it will not be processed as
reinteresting and processed as uninteresting. This causes unshallow
git-fetch to be failed.

This changes DepthGenerator to process unshallow commits first
independent to their depth. This makes uninteresting flag carry work
properly.

Change-Id: I94378271cf85fbe6302cefc19a167d8cf68e1a69
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
2019-04-11 19:45:52 -07:00
Luca Milanesio d6e00d2015 Remember the cause for invalidating a packfile
Keep track of the original cause for a packfile invalidation.
It is needed for the sysadmin to understand if there is a real
underlying filesystem problem and repository corruption or if it is
simply a consequence of a concurrency of Git operations (e.g. repack
or GC).

Change-Id: I06ddda9ec847844ec31616ab6d17f153a5a34e33
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-11 10:55:45 +02:00
Carsten Hammer 38eaa490f2 Remove unnecessary type specifications
Since Java 7 the diamond operator can be used instead of explicit
type parameters.

Change-Id: I2dee5fce7afebb1d9088eeaec4484ee58b4fa492
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-04-11 11:49:32 +09:00
Carsten Hammer 0db509f7e7 Use String.isEmpty() instead of comparing to ""
Use of String.equals("") can be replaced with with String.length() == 0
(for JDK5 and lower) or String.isEmpty() (for JDK6 and higher)

Change-Id: Id1462d22c5d249485d87993263a9239809e73c55
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-04-11 11:48:31 +09:00
Carsten Hammer bf251ea0e8 Replace usage of String.indexOf with String.contains where possible
Change-Id: Iad3fce891077d85cf2533272c54206c33c37afd8
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-04-11 11:45:11 +09:00
Matthias Sohn aa6e7e2c12 Fix API problem filters
Change-Id: I96e0ddc34251348ec4877c9d94b045eb1c53e758
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-11 00:34:20 +02:00
Luca Milanesio 82b1af31e2 Fix pack files scan when filesnapshot isn't modified
Do not reload packfiles when their associated filesnapshot is not
modified on disk compared to the one currently stored in memory.

Fix the regression introduced by fef78212 which, in conjunction with
core.trustfolderstats = false, caused any lookup of objects inside
the packlist to loop forever when the object was not found in the pack
list.

Bug: 546190
Change-Id: I38d752ebe47cefc3299740aeba319a2641f19391
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-09 14:31:39 +01:00
Patrick Hiesel 93a0e50ed0 Introduce RefDatabase#getTipsWithSha1 to list refs pointing to object
Add resolveTipSha1, an inverse of exactRef(String ...), to RefDatabase
and provide a default implementation that runs in O(n) time where n is
the number of refs. For RefTable, provide an implementation that runs
in O(log(n)) time.

[ifrade@google.com: with tests in InMemoryRepositoryTest to exercise
 the reftable code path, too]

Change-Id: I2811ccd0339cdc1c74b42cce2ea003f07a2ce9e1
Signed-off-by: Patrick Hiesel <hiesel@google.com>
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-04-08 17:53:51 -07:00
Thomas Wolf 965aacc7c9 Attach deletion failure reason in FileUtils.delete()
Use Files.delete() instead of File.delete(), and if there is
an exception thrown propagate it unless errors are to be ignored so
that the actual deletion failure cause is available to the caller
(and will be logged).

Change-Id: I5fdb5a4052942437ab365289ad4bb1b563c29456
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-04-03 18:35:48 +02:00
Gunnar Wagenknecht 440296873b Ignore invalid files in '.gnupg/private-keys-v1.d'
Bug: 545673
Change-Id: I4a2ee1e76f320209b3f8090264d771f1a9da566f
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
2019-04-03 03:11:58 -07:00
Matthias Sohn 27f1fb668f Add missing source bundles and add them to a single source feature
Add missing source bundles for
- org.eclipse.jgit.ant
- org.eclipse.jgit.archive
- org.eclipse.jgit.http.apache
- org.eclipse.jgit.http.server
- org.eclipse.jgit.junit
- org.eclipse.jgit.junit.http
- org.eclipse.jgit.junit.ssh
- org.eclipse.jgit.lfs
- org.eclipse.jgit.lfs.server
- org.eclipse.jgit.ui

Combine all source bundles into a single source feature
org.eclipse.jgit.source and delete the other source features.

Ensure all bundles are added to the jgit p2 repository.

Change-Id: I56785f49c940b79f41f763c26e63a4a820ed7cce
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-04-02 01:57:28 -04:00
Matthias Sohn 04b84dbd74 Suppress API error for new constant Ref.UNDEFINED_UPDATE_INDEX
Change-Id: If8f7c9cc4b78ce2de29b0d93f2b98c2d0dd1eb3d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-30 08:17:49 +01:00
Ivan Frade 9d97d2404f DfsRefDatabase: Keep update index when peeling a reference
The new references created in the peeling do not receive the update
index. In other words, the update index of a reference (if set) is lost
in the peeling.

Pass-through the update index to the newly created references.

Tested via InMemoryRepository, which uses DfsReftableDatabase.

Change-Id: I7ff7c737a9c3366fdec296a4d9b2e51d10227957
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-03-29 22:50:26 +01:00
Ivan Frade cab35b2865 Ref: Add constant for undefined update index
Code that creates references and wants to support ref dbs with and
without update indexes needs to set this value. This leds to a
proliferation of "-1" in the code base.

Make the "undefined" value a constant in the ref interface.

Change-Id: I2622a37536a84b4a4036dd55792e185486fa0628
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-03-29 22:50:26 +01:00
Han-Wen Nienhuys bbff3ff008 Clarify error message for invalid Windows characters
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I20c37d70fc78d745f83b9ce702777535b16b8dfe
2019-03-29 17:34:17 -04:00
Matthias Sohn dae26b43d1 Fix API error filter settings
- UploadPack.getFilterBlobLimit() didn't have a wrong @since tag but was
marked final shortly after 5.3 was released. This was probably caused by
using an outdated API baseline. Currently we should use 5.3.0 as the
baseline.
- remove unused filter on FS.fileAttributes()

Change-Id: I9adc1703e99a9ddb3ea2a1c12a83dccbc1f69a99
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-27 16:26:28 +01:00
Matthew DeVore 7d92a52d9e Justify API-breaking changes introduced in 4cd9548
Use .api_filters to suppress API baseline errors. The justification is
included in comments in that file.

Change-Id: I7b5c69d8d13733719b28ef7317fc9780ed2828d8
Signed-off-by: Matthew DeVore <matvore@gmail.com>
2019-03-25 15:52:26 -07:00
Matthew DeVore 00523f38a1 ObjectWalk: simplify tree traversal logic
Inline newTreeVisit into enterTree and call the new method pushTree. Use
pushTree both for pushing children of the existing currVisit.

Change-Id: I75ea37f48b2befb738a3e88bed40ac08f1df9a03
Signed-off-by: Matthew DeVore <matvore@gmail.com>
2019-03-22 16:06:22 -07:00
Matthew DeVore 4cd954856e Expose and pass around the FilterSpec object rather than the raw blob limit
Use the FilterSpec object so that less code has to know about the make-up of
FilterSpecs. When fields are added to FilterSpec, these pieces of code won't
need updating again.

Change-Id: I2b9e59a9926ff112faf62a3fa2d33c961a1779e5
Signed-off-by: Matthew DeVore <matvore@gmail.com>
2019-03-22 16:06:22 -07:00
Matthew DeVore cc9ca71a16 Put filter spec information in a dedicated object
This increases type-safety and is ground work for support of the
"tree:<depth>" filter.

Change-Id: Id19eacdcdaddb9132064c642f6d554b1060efe9f
Signed-off-by: Matthew DeVore <matvore@gmail.com>
2019-03-22 16:06:22 -07:00
Jonathan Nieder cc714d3bbb Use Objects.requireNonNull instead of a custom helper
This simplifies the API surface and makes JGit internals into less of
a custom Java dialect.

Change-Id: Idbb7d4d1037c5336341088385b8e0a59c8b4c952
2019-03-22 09:45:05 -07:00
Jonathan Nieder 3551e443fc Introduce a checkNotNull helper
When using @NonNull annotations in new code, if I write

	public void setFrobber(@NonNull frobber) {
		this.frobber = frobber;
	}

then consumers of the JGit library that do not have nullness checking
enabled can easily pass in null by mistake.  On the other hand, if I
write

	public void setFrobber(@NonNull frobber) {
		if (frobber == null) {
			throw new NullPointerException();
		}
		this.frobber = frobber;
	}

then Eclipse JDT complains:

	Null comparison always yields false: The variable frobber is specified as @NonNull

Add a checkNotNull helper that offers the best of both worlds:

	public void setFrobber(@NonNull frobber) {
		this.frobber = checkNotNull(frobber);
	}

Briefer code, null check is intact, and no warning.

Inspired by Guava's com.google.common.base.Preconditions.checkNotNull.

Change-Id: If59588d13a1119e899657ed2296931ea18ed0e2a
2019-03-22 09:10:24 -07:00
Matthias Sohn 5efcbaf7c3 Merge branch 'stable-5.3'
* stable-5.3:
  Fix GC to delete empty fanout directories after repacking

Change-Id: I080ddb03c6143f0bfa24707a10a4d926676d32b1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-21 16:47:14 +01:00
Matthias Sohn c23ccd29b5 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Fix GC to delete empty fanout directories after repacking

Change-Id: I29e1da15396daaf0036bcb92cfb567cc243db5a1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-21 16:45:34 +01:00
Matthias Sohn 88fffedd99 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Fix GC to delete empty fanout directories after repacking

Change-Id: I0cf4d26bdee5ecee43e723c4176efbce777acabc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-21 16:14:12 +01:00
Matthias Sohn 08a5d2771d Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Fix GC to delete empty fanout directories after repacking

Change-Id: I5c0e7d59f137c27e4588f20f4472d3ea450cd59c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-21 16:07:23 +01:00
Matthias Sohn b29bb5cbb0 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Fix GC to delete empty fanout directories after repacking

Change-Id: Idce894a24e126e0fbe7bc9b6a3c64318f1a8eb75
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-21 15:55:47 +01:00
Matthias Sohn 1a289e3420 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Fix GC to delete empty fanout directories after repacking

Change-Id: I7118b9c668dcbb0f5435cc613e964c557bfebf01
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-21 15:35:26 +01:00
Matthias Sohn f06de6b575 Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Fix GC to delete empty fanout directories after repacking

Change-Id: Ibdbfe08eb290286fa738010bad1c604e857885cd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-21 15:07:05 +01:00
Matthew DeVore c490373e00 Move filter-line-parsing code to a separate file
This code is not specific to V2 of the protocol, so it doesn't belong
there. Move it to its own class.

Change-Id: I8084764147d1d0e2bceaaead59b332a8ec1a0825
Signed-off-by: Matthew DeVore <matvore@gmail.com>
2019-03-20 19:06:40 -07:00
Masaya Suzuki 47e37b0fa4 Use RefMap instead of HashMap
HashMap<String, Ref> has a memory overhead for refs. Use RefMap.

Change-Id: I3fb4616135dacf687cc3bc2b473effc66ccef5e6
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
2019-03-20 15:52:14 -07:00
Matthias Sohn 534ede2d81 Fix GC to delete empty fanout directories after repacking
The prune method did not delete empty fanout directories when loose
objects moved to a new pack file but only when loose unreferenced
objects were pruned.

Change-Id: Ia068f4914c54d9cf9f40b75e8ea50759402b5000
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-20 14:10:30 +01:00
Sebastian Schuberth d9e1653825 DescribeCommand: Add a missing dots at the end of docs
Ensure the sentences to document fields consistenly end with a dot.

Change-Id: I084899cafe4dea6f2424132dce9f3adca2e20985
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2019-03-18 09:51:37 +01:00
Thomas Wolf d9d9862402 Replace "Checkout" by "Check out" when used as a verb
One occurrence in core JGit, several in jgit.pgm. One unused
occurrence in jgit.pgm; remove it.

Change-Id: I04c3dd9d9f542f1e1ac6df4cbf03bcefb6bfdf78
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-03-15 21:08:46 +01:00
Ivan Frade 23c3702686 BaseReceive/UploadPack: Stop using deprecated RefAdvertiser.send(Map)
RefAdvertiser.send(Map<String, Ref>) is deprecated in favour of
RefAdvertiser.send(Collection<Ref>). Subclasses that need to override
the "send" method need to override also the deprecated version, because
it is still invoked by BaseReceivePack and UploadPack.

Remove the last usages of the deprecated method.

Change-Id: I7eba426970251f78801ddf96b87a65d1baaebdcf
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-03-14 11:27:27 -07:00
Matthias Sohn e53b98ba2f Merge branch 'stable-5.3'
* stable-5.3:
  Prepare 5.3.1-SNAPSHOT builds
  JGit v5.3.0.201903130848-r
  Prepare 5.1.7-SNAPSHOT builds
  JGit v5.1.6.201903130242-r
  Prepare 4.11.8-SNAPSHOT builds
  JGit v4.11.7.201903122105-r
  Prepare 4.9.10-SNAPSHOT builds
  JGit v4.9.9.201903122025-r
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: Ief9f6a9e89c4a1ef122daedbfd933676393fab06
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 17:49:42 +01:00
Matthias Sohn 4ade2de34f Prepare 5.3.1-SNAPSHOT builds
Change-Id: I8dc5e47bd19809d684579610edf922abca3cb3cc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 15:10:33 +01:00
Matthias Sohn de4a633201 JGit v5.3.0.201903130848-r
Change-Id: I52256a6d07011030698299d9a97dd01ea825fb7f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 13:47:54 +01:00
Matthias Sohn 9e74c49808 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Prepare 5.1.7-SNAPSHOT builds
  JGit v5.1.6.201903130242-r
  Prepare 4.11.8-SNAPSHOT builds
  JGit v4.11.7.201903122105-r
  Prepare 4.9.10-SNAPSHOT builds
  JGit v4.9.9.201903122025-r
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: Ia866587a910e620cb297bcb2a81fe0786f4e3db2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 10:26:22 +01:00
Matthias Sohn 6a7a265b4d Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Prepare 5.1.7-SNAPSHOT builds
  JGit v5.1.6.201903130242-r
  Prepare 4.11.8-SNAPSHOT builds
  JGit v4.11.7.201903122105-r
  Prepare 4.9.10-SNAPSHOT builds
  JGit v4.9.9.201903122025-r
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I8da2761ed27ff2817a4136f843b9b293e3c0f4e6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 07:56:47 +01:00
Matthias Sohn 639d53721c Prepare 5.1.7-SNAPSHOT builds
Change-Id: Ica716b2ad18f8390e75466430ef81c86ea06f004
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 07:49:33 +01:00
Matthias Sohn a31756fbfc JGit v5.1.6.201903130242-r
Change-Id: Iaf5e451f72dc8512afee99a9f3fb91aa348e3cf5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 07:41:27 +01:00
Matthias Sohn b0d27cdae9 Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Prepare 4.11.8-SNAPSHOT builds
  JGit v4.11.7.201903122105-r
  Prepare 4.9.10-SNAPSHOT builds
  JGit v4.9.9.201903122025-r
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I71771dcc086a9a0097bad74d65ec71ad97106a38
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 07:38:38 +01:00
Matthias Sohn 7480737aac Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Prepare 4.11.8-SNAPSHOT builds
  JGit v4.11.7.201903122105-r
  Prepare 4.9.10-SNAPSHOT builds
  JGit v4.9.9.201903122025-r
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I04c70f66c6f1e53bdc199fb5b24c9136c9a8e4f7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 02:21:54 +01:00
Matthias Sohn 6a30ffd033 Prepare 4.11.8-SNAPSHOT builds
Change-Id: I92789b0c02e83786961b81556bf2faec5d26b0c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 02:13:36 +01:00
Matthias Sohn a888f80856 JGit v4.11.7.201903122105-r
Change-Id: I4fc62c304b5a8452ca72a3b305e5732a26120000
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 02:04:31 +01:00
Matthias Sohn 7204e35f93 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Prepare 4.9.10-SNAPSHOT builds
  JGit v4.9.9.201903122025-r
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: Ic66dc00455c05f7627919f682a7221ffeef1629d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 01:55:24 +01:00
Matthias Sohn f53c2d11af Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Prepare 4.9.10-SNAPSHOT builds
  JGit v4.9.9.201903122025-r
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: Ifcd8ea6a2b59f6f8e9d896d8407cfcaef0a9375d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 01:48:06 +01:00
Matthias Sohn 2b64345f53 Prepare 4.9.10-SNAPSHOT builds
Change-Id: I2bdbe822ee623c5f15a26d092136d8602cef06ac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 01:34:49 +01:00
Matthias Sohn c28c3ab9f0 JGit v4.9.9.201903122025-r
Change-Id: I807d24461b3557eee48294bfaa652b2a13d78113
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 01:27:02 +01:00
Matthias Sohn c452c007ce Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I9a47153831f8eb10d3cd91b4157cf45385e5b13a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 01:18:01 +01:00
Matthias Sohn 2bf3cc56db Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  Prepare 4.7.9-SNAPSHOT builds
  JGit v4.7.8.201903121755-r
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I1136eaa1590b225ceaf16ba7552af0374253a74e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-13 01:16:28 +01:00
Matthias Sohn 317d747c5c Prepare 4.7.9-SNAPSHOT builds
Change-Id: I1602a6b811fd9f95e284153b560d8d9f855fae9f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 23:26:43 +01:00
Matthias Sohn a2951a996f JGit v4.7.8.201903121755-r
Change-Id: Ia6dbde615671ed09789326aacad1655e7a7a59ad
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 22:55:42 +01:00
Matthias Sohn 92525b584a Merge branch 'stable-4.6' into stable-4.7
* stable-4.6:
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I3d1544d034783fe0fa1385dfe9b03ad8e9247c63
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 22:39:53 +01:00
Matthias Sohn d96eb8b3e6 Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Prepare 4.5.7-SNAPSHOT builds
  JGit v4.5.6.201903121547-r
  Check for packfile validity and fd before reading
  Move throw of PackInvalidException outside the catch
  Use FileSnapshot to get lastModified on PackFile
  Include size when comparing FileSnapshot
  Do not reuse packfiles when changed on filesystem
  Silence API warnings for new API introduced for fixes

Change-Id: I029e1797447e6729de68bd89d4d69b324dbb3f5f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 22:26:58 +01:00
Matthias Sohn a47367e5fb Prepare 4.5.7-SNAPSHOT builds
Change-Id: I5c275c542e12746c3d8ecf8462791969f9e89e12
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 20:54:12 +01:00
Matthias Sohn 1cb31111f7 JGit v4.5.6.201903121547-r
Change-Id: I5a071ed10e1ac1ab28f992d45cde335c12556a80
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 20:47:04 +01:00
Luca Milanesio bf3d1ded35 Check for packfile validity and fd before reading
When reading from a packfile, make sure that is valid
and has a non-null file-descriptor.

Because of concurrency between a thread invalidating a packfile
and another trying to read it, the read() may result into a NPE
that won't be able to be automatically recovered.

Throwing a PackInvalidException would instead cause the packlist
to be refreshed and the read to eventually succeed.

Bug: 544199
Change-Id: I27788b3db759d93ec3212de35c0094ecaafc2434
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
2019-03-12 15:06:05 +01:00
Luca Milanesio afef866a44 Move throw of PackInvalidException outside the catch
When a packfile is invalid, throw an exception explicitly
outside any catch scope, so that is not accidentally caught
by the generic catch-all cause, which would set the packfile
as valid again.

Flagging an invalid packfile as valid again would have
dangerous consequences such as the corruption of the in-memory
packlist.

Bug: 544199
Change-Id: If7a3188a68d7985776b509d636d5ddf432bec798
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
2019-03-12 15:06:05 +01:00
Luca Milanesio 2d116cd0ab Use FileSnapshot to get lastModified on PackFile
Do not redundantly call File.lastModified() for extracting the
timestamp of the PackFile but rather use consistently the FileSnapshot
which reads all file attributes in a single bulk call.

Change-Id: I932675ae4fe56dcd3833dac249816f097303bb09
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 15:06:04 +01:00
Luca Milanesio 2dc572df24 Include size when comparing FileSnapshot
Due to finite filesystem timestamp resolution the last modified
timestamp of files cannot detect file changes which happened in the
immediate past (less than one filesystem timer tick ago).

Read and consider file size also, so that differing file size can help
to more accurately detect file changes without reading the file content.
Use bulk read to avoid multiple stat calls to retrieve file attributes.

Change-Id: I974288fff78ac78c52245d9218b5639603f67a46
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 14:39:14 +01:00
Luca Milanesio fef782128d Do not reuse packfiles when changed on filesystem
The pack reload mechanism from the filesystem works only by name
and does not check the actual last modified date of the packfile.

This lead to concurrency issues where multiple threads were loading
and removing from each other list of packfiles when one of those
was failing the checksum.

Rely on FileSnapshot rather than directly checking lastModified
timestamp so that more checks can be performed.

Bug: 544199
Change-Id: I173328f29d9914007fd5eae3b4c07296ab292390
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
2019-03-12 14:30:36 +01:00
Matthias Sohn d4078dccda Silence API warnings for new API introduced for fixes
Change-Id: I3ea7ff2efd33ca6c780afaef9010cec82780d7fa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 14:30:20 +01:00
Matthias Sohn 51f2979f13 Merge branch 'stable-5.3'
* stable-5.3:
  Reduce contention on PackFile.idx() function.
  Use SystemReader in JSchConfigSessionFactoryTest
  Avoid NPE in ObjectId.isId()

Change-Id: I1d13f6fb705258ae6d6e5fa5e733bfacd4f3d0e3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 00:14:14 +01:00
Matthias Sohn da8e47ddc1 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Reduce contention on PackFile.idx() function.

Change-Id: I6bf4c1db695b8fa134ea425bbd488d2dc5438152
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 00:13:06 +01:00
Matthias Sohn 17e9ec4544 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Reduce contention on PackFile.idx() function.

Change-Id: I3f981dd923209e4d2d23f3b10db9fda1e9e68104
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 00:12:04 +01:00
Matthias Sohn 57f3ee4c16 Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Reduce contention on PackFile.idx() function.

Change-Id: Ic50f375faa757076e2dfd6c25e9e0025482aa3d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 00:10:59 +01:00
Matthias Sohn 35e96348d3 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Reduce contention on PackFile.idx() function.

Change-Id: Ib1be8c04c9587c595f7d95df26f7be9b237bda40
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 00:09:45 +01:00
Matthias Sohn 495ecda567 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Reduce contention on PackFile.idx() function.

Change-Id: I5dd7576018ab2e85d77d336f97c8e77ad71520c9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 00:08:34 +01:00
Matthias Sohn 47d7f7aabb Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Reduce contention on PackFile.idx() function.

Change-Id: I277e53aa752c8ffb8560de710d27ecb58871ec02
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-12 00:06:17 +01:00
Juergen Denner 19c4380689 Reduce contention on PackFile.idx() function.
In case of concurrent pack file access, threads may wait on the idx()
function even for already open files. This happens especially with a
slow file system.

Performance numbers are listed in the bug report.

Bug: 543739
Change-Id: Iff328d347fa65ae07ecce3267d44184161248978
Signed-off-by: Juergen Denner <j.denner@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-11 19:52:26 +01:00
Michael Keppler 391c7a25fa Avoid NPE in ObjectId.isId()
That method can easily be invoked with a null argument (e.g.
isId(repo.getFullBranch()), therefore it should handle null arguments.

Change was suggested in https://git.eclipse.org/r/#/c/137918/, which
tried to fix the same in egit only.

Bug:544982
Change-Id: I32d1df6e9b2946ab324eda7008721159019316b3
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2019-03-09 19:54:29 -05:00
Michael Keppler 90e614a41d Fix Javadoc typo
Change-Id: I3f169eaf649843e954762bb4ac8f72fa5f88a67a
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2019-03-08 14:43:30 +01:00
Jonathan Nieder ee5f449bca UploadPack: Do not retain commit body when checking wants
The commit body contains the commit message, which is not needed for
reachability checks.

Change-Id: Ie209c3b3f022579942f05b8b5d0625ce26400a5d
Signed-off-by: Jonathan Nieder <jrn@google.com>
2019-03-07 19:58:35 -08:00
Ivan Frade a33847b5d9 FetchV2Request.getWantedRefs: Bump @since to 5.4
The visibility change was merged after 5.3 release. The @since line
is wrong.

Fixing it in a new commit looks like the easiest way forward.

Change-Id: I6f72a9e684e99a4440cda1eb532c22b4b7bbdea5
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-03-07 17:38:39 -08:00
Jonathan Nieder 94c8fd55e3 Merge "FetchV2Request: make getWantedRefs public" 2019-03-07 17:28:05 -05:00
Matthias Sohn f8a632657e Merge "Prepare 5.4.0-SNAPSHOT builds" 2019-03-07 11:16:46 -05:00
Matthias Sohn 90107d53eb Prepare 5.4.0-SNAPSHOT builds
Change-Id: I90a4791f63d0eba23da744c720e869f1830b86e7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-07 00:34:14 +01:00
Minh Thai cc2a223fea Do not retain commit body in RevWalk for reachability checks
Commit body contains the message that is not needed for reachability checks, and
takes up memory unnecessarily.

Change-Id: I0c7f6da249bf9c4fda9dc9e62e809322c68effce
Signed-off-by: Minh Thai <mthai@google.com>
2019-03-06 15:29:59 -08:00
Matthias Sohn 0295ee1164 Prepare 5.3.0-SNAPSHOT builds
Change-Id: I9b934bcfad3d2091f4da163170348b0c8ef5e732
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-06 22:26:03 +01:00
Matthias Sohn aca889f8cc JGit v5.3.0.201903061415-rc1
Change-Id: I85866af97fe1c0c0a0da83a7605484082fa56b52
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-06 20:03:00 +01:00
Terry Parker e48410ae9a Track object inflation time in DfsReaderIoStats
This can help track down poor long tail performance that isn't accounted
for in the readIdxMicros or readBlockMicros metrics.

Change-Id: I701b9cfcc124f4ddb860d1766a11ea3557e604ce
Signed-off-by: Terry Parker <tparker@google.com>
2019-03-06 10:54:52 -08:00
David Pursehouse 01cf73c7ab Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Fix error log message in ObjectDirectory.handlePackError()
  Properly format pack checksums in PackFile.idx()
  Cancel gc if thread was interrupted
  PackFile: report correct message for checksum mismatch
  ObjectDirectory: Clean up logging
  Bazel: Stop using native.git_repository
  ObjectDirectory: extra logging on packfile exceptions

Change-Id: If75b149e693005dd3fe06b523e6e6784bedf44c1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-03-06 14:15:36 +09:00
David Pursehouse 3fc9d43339 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Fix error log message in ObjectDirectory.handlePackError()
  Properly format pack checksums in PackFile.idx()
  Cancel gc if thread was interrupted
  PackFile: report correct message for checksum mismatch
  ObjectDirectory: Clean up logging
  Bazel: Stop using native.git_repository
  ObjectDirectory: extra logging on packfile exceptions

Change-Id: I9052e318b5d920770f7c7121d36e3c58df9d5f5a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-03-06 14:14:40 +09:00
David Pursehouse ae5ea80363 Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Fix error log message in ObjectDirectory.handlePackError()
  Properly format pack checksums in PackFile.idx()
  Cancel gc if thread was interrupted
  PackFile: report correct message for checksum mismatch
  ObjectDirectory: Clean up logging
  Bazel: Stop using native.git_repository
  ObjectDirectory: extra logging on packfile exceptions

Change-Id: I0847251eb010616a705e0b91df4bdebc225fa95d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-03-06 14:13:48 +09:00
Matthias Sohn 7b3ee6f62e Fix error log message in ObjectDirectory.handlePackError()
Change-Id: I154f392ad025c4b642eb1123d375a0afaa853885
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit 997d785418)
2019-03-06 02:36:38 +01:00
Matthias Sohn e8f7bb3608 Properly format pack checksums in PackFile.idx()
Change-Id: Id805850dbe9a3d633168f3056e06ddeafd86f961
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit a33e4dc58a)
2019-03-06 02:36:38 +01:00
Matthias Sohn e8bd9556c0 Cancel gc if thread was interrupted
see
https://groups.google.com/d/msg/repo-discuss/oDB2rl3doDc/tFEh5Xt0CAAJ

Change-Id: Ia6d4631c64e065d8b9b09e0b45e7a9ea8ac3f41d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit 882fed0d96)
2019-03-06 02:36:38 +01:00
Luca Milanesio daefa69502 PackFile: report correct message for checksum mismatch
When the packfile checksum does not match the expected one
report the correct checksum error instead of reporting that
the number of objects is incorrect.

Change-Id: I040f36dacc4152ae05453e7acbf8dfccceb46e0d
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit 436c99ce59)
2019-03-06 02:36:38 +01:00
David Pursehouse e6fd4732d0 ObjectDirectory: Clean up logging
Externalize the message and log the pack file with absolute path.

Change-Id: I019052dfae8fd96ab67da08b3287d699287004cb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
(cherry picked from commit 9665d86ba1)
2019-03-06 02:36:37 +01:00
Luca Milanesio baf1bb20d0 ObjectDirectory: extra logging on packfile exceptions
Display extra logging, including the exception with the associated
stacktrace, whenever a packFile can't be read and thus removed
from the packlist.

Change-Id: I97a4e31dc427bfcc0baae438dcbe2dcd4704b824
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
(cherry picked from commit 962babc4b2)
2019-03-06 02:36:37 +01:00
David Pursehouse 52179ee247 Merge branch 'stable-5.2'
* stable-5.2:
  Fix error log message in ObjectDirectory.handlePackError()
  Properly format pack checksums in PackFile.idx()
  Cancel gc if thread was interrupted
  PackFile: report correct message for checksum mismatch
  ObjectDirectory: Clean up logging
  Bazel: Stop using native.git_repository

Change-Id: Ib972641105cef8089791fc65389c4f43e218620a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-03-05 10:24:34 +09:00
David Pursehouse c2dbdabfb9 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Fix error log message in ObjectDirectory.handlePackError()
  Properly format pack checksums in PackFile.idx()
  Cancel gc if thread was interrupted
  PackFile: report correct message for checksum mismatch
  ObjectDirectory: Clean up logging
  Bazel: Stop using native.git_repository

Change-Id: I42b72a3bba3b4c9389d91a1a35a8004836567e7c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-03-05 10:23:38 +09:00
Matthias Sohn 997d785418 Fix error log message in ObjectDirectory.handlePackError()
Change-Id: I154f392ad025c4b642eb1123d375a0afaa853885
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-04 13:51:12 +01:00
Matthias Sohn a33e4dc58a Properly format pack checksums in PackFile.idx()
Change-Id: Id805850dbe9a3d633168f3056e06ddeafd86f961
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-04 13:28:40 +01:00
Matthias Sohn 882fed0d96 Cancel gc if thread was interrupted
see
https://groups.google.com/d/msg/repo-discuss/oDB2rl3doDc/tFEh5Xt0CAAJ

Change-Id: Ia6d4631c64e065d8b9b09e0b45e7a9ea8ac3f41d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-03 18:35:04 +01:00
Luca Milanesio 436c99ce59 PackFile: report correct message for checksum mismatch
When the packfile checksum does not match the expected one
report the correct checksum error instead of reporting that
the number of objects is incorrect.

Change-Id: I040f36dacc4152ae05453e7acbf8dfccceb46e0d
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-03-03 17:52:33 +01:00
David Pursehouse 9665d86ba1 ObjectDirectory: Clean up logging
Externalize the message and log the pack file with absolute path.

Change-Id: I019052dfae8fd96ab67da08b3287d699287004cb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-03-03 13:15:19 +09:00
Dave Borowitz ea54b6a5a7 ResolveMerger: Destroy TemporaryBuffer on unchecked exceptions
Previously, we called destroy() to delete the temp file on failure only
when catching an IOException, not a RuntimeException. Use a slightly
different construction with a finally block to ensure it's always
deleted on error (assuming the JVM is still healthy enough).

Change-Id: Ie201f3cfc81099ee1cafed066632da76223cef1f
2019-03-01 12:35:38 -08:00
Ivan Frade e1b1e01bec FetchV2Request: make getWantedRefs public
There are valid cases where a hook, invoked by ProtocolV2Hook
and probably implemented in a different package, is interested
in knowing the wanted refs in the request.

Increase visibility to public in the wanted-ref method.

Change-Id: I5da085ac7af4c396c1cb85e630f40a57fc70b33e
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-02-28 23:49:19 -08:00
Terry Parker 875dccf33c Expose the filter blob limit in UploadPack
Similar to UploadPack.getDepth() to know the shallow clone depth, expose
the user-specified filter blob limit for partial clones.

Change-Id: I04bde06862a1cf8a9862d950c15023c49d16a2a6
Signed-off-by: Terry Parker <tparker@google.com>
2019-02-28 16:00:24 -08:00
Thomas Wolf f491af08ea Merge changes from topic 'rebase_compatibility'
* changes:
  RebaseCommand: tighten check for --preserve-merges on --continue
  RebaseCommand: use orig-head to abort
  RebaseCommand: use orig-head in addition to head
2019-02-26 16:22:22 -05:00
Jonathan Nieder 2fe1f0d638 Merge "Strongly reference indices in DfsPackFile" 2019-02-26 15:08:39 -05:00
Gunnar Wagenknecht 98df7ec801 Merge "On Windows use %APPDATA%\gnupg as GPG directory if it exists" 2019-02-26 14:46:51 -05:00
Christian Halstrick 20b633d95d Merge "Remove duplicate externalized message" 2019-02-26 07:35:52 -05:00
Thomas Wolf ca011107b8 On Windows use %APPDATA%\gnupg as GPG directory if it exists
Hard-coding ~/.gnupg for the GPG directory doesn't work on Windows,
where GnuPG uses %APPDATA%\gnupg by default. Make the determination
of the directory platform-dependent.

Bug: 544797
Change-Id: Id4bfd39a981ef7c5b39fbde46fce9a7524418709
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-02-26 12:49:59 +01:00
Thomas Wolf 4169a95a65 Remove duplicate externalized message
Instead of a new "unexpectedNlinkValue" message use the already
existing "failedAtomicFileCreation". Remove a stray double quote
from the latter.

Change-Id: I1ba5e9ea48d3f7615354b2ace2575883070b3206
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-02-26 11:53:49 +01:00
Thomas Wolf 38e5a75ce4 RebaseCommand: tighten check for --preserve-merges on --continue
With native git, .git/rebase-merge/rewritten exists actually in two
different cases:

* as a file in git rebase --merge recording OIDs for copying notes
* as a directory in git rebase --preserve-merges

Add a comment, and check for isDirectory() instead of exists().

Bug: 511487
Change-Id: I6a3317b4234d4f41c41b3004cdc7ea0abf2c6223
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-02-26 16:18:27 +09:00
Thomas Wolf a64fa0bd7f RebaseCommand: fix ONTO_NAME, and --preserve-merges is interactive
ONTO_NAME must be "onto_name", not "onto-name".

For native git, --preserve-merges is an interactive mode. Create the
INTERACTIVE marker file, otherwise a native git rebase --continue
will fall back into rebase --merge mode before git 2.19.0 since it
started looking for the REWRITTEN directory to make the distinction
only then.[1]

This allows a JGit interactive rebase to be continued via native git
rebase --continue.

[1] https://github.com/git/git/commit/6d98d0c0

Bug: 511487
Change-Id: I13850e0fd96ac77d03fbb581c8790d76648dbbc6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-02-26 16:18:27 +09:00
Thomas Wolf 4ad53c0cbf RebaseCommand: use orig-head to abort
Aborting a rebase used ORIG_HEAD to reset. Strictly speaking this is
not correct, since other commands run during the rebase (for instance,
when the rebase stopped on a conflict) might have changed ORIG_HEAD.

Prefer the OID recorded in the orig-head file, falling back to the
older "head" file if "orig-head" doesn't exist, and use ORIG_HEAD only
if neither exists.

Bug: 511487
Change-Id: Ifa99221bb33e4e4754377f9b8f46e76c8936e072
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-02-26 16:18:27 +09:00
Thomas Wolf 60cf85a4a3 Fix core.autocrlf for non-normalized index
With text=auto or core.autocrlf=true, git does not normalize upon
check-in if the file in the index contains already CR/LFs. The
documentation says: "When text is set to "auto", the path is
marked for automatic end-of-line conversion. If Git decides that
the content is text, its line endings are converted to LF on
checkin. When the file has been committed with CRLF, no conversion
is done."[1]

Implement the last bit as in canonical git: check the blob in the
index for CR/LFs. For very large files, we check only the first 8000
bytes, like RawText.isBinary() and AutoLFInputStream do.

In Auto(CR)LFInputStream, ensure that the buffer is filled as much as
possible for the isBinary() check.

Regarding these content checks, there are a number of inconsistencies:

* Canonical git considers files containing lone CRs as binary.
* RawText checks the first 8000 bytes.
* Auto(CR)LFInputStream checks the first 8096 (not 8192!) bytes.

None of these are changed with this commit. It appears that canonical
git will check the whole blob, not just the first 8k bytes. Also
note: the check for CR/LF text won't work with LFS (neither in JGit
nor in git) since the blob data is not run through the smudge filter.
C.f. [2].

Two tests in AddCommandTest actually tested that normalization was
done even if the file was already committed with CR/LF.These tests
had to be adapted. I find the git documentation unclear about the
case where core.autocrlf=input, but from [3] it looks as if this
non-normalization also applies in this case.

Add new tests in CommitCommandTest testing this for the case where
the index entry is for a merge conflict. In this case, canonical git
uses the "ours" version.[4] Do the same.

[1] https://git-scm.com/docs/gitattributes
[2] https://github.com/git/git/blob/3434569fc/convert.c#L225
[3] https://github.com/git/git/blob/3434569fc/convert.c#L529
[4] https://github.com/git/git/blob/f2b6aa98b/read-cache.c#L3281

Bug: 470643
Change-Id: Ie7310539fbe6c737d78b1dcc29e34735d4616b88
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-02-26 16:18:27 +09:00
Thomas Wolf b4c212309b RebaseCommand: use orig-head in addition to head
Since 2011-02-10 (i.e., git 1.7.6)[1] native git uses "orig-head" for
REBASE_HEAD. JGit was still using "head". Currently native git has a
legacy fall-back for reading this, but for how long? Let's write to
both. Note that JGit never reads this file.

[1] https://github.com/git/git/commit/84df4560

Bug: 511487
Change-Id: Id3742bf9bbc0001d850e801b26cc8880e646abfc
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-02-26 16:18:27 +09:00
David Pursehouse e54243278f SHA1: Use externalized message in log
The non-externalized warning message says there is a "possible SHA-1
collision" but then the Sha1CollisionException is always thrown.

Replace the message with the existing externalised string that does
not say "possible".

Change-Id: I9773ec76b416c356e234a658fb119f98d33eac83
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-02-25 11:05:44 +09:00
David Pursehouse a5a62a4cdb JGitText: Remove unnecessary suffix from externalized message identifier
Change-Id: I7a3ade56c219826b81d33d1d52566a86ad2e853a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-02-25 11:05:44 +09:00
David Pursehouse 6305869bf1 FS_POSIX: Externalize log message
Change-Id: Ida538e05c4595fdce99f1fa87469a3be60160adb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-02-25 11:05:42 +09:00
Minh Thai 01f084f5d9 Strongly reference indices in DfsPackFile
DfsBlockCache.Ref might get cleared out if the JVM is running out of
memory. As a result, the index is not persisted for the request and
will be reloaded unnecessarily.

Change-Id: I3b57ad5e6673f77f2dc66177a649ac412a97fe20
Signed-off-by: Minh Thai <mthai@google.com>
2019-02-21 16:48:43 -08:00
David Pursehouse 2902255526 Merge branch 'stable-5.3'
* stable-5.3:
  ObjectDirectory: extra logging on packfile exceptions
  Prepare 5.3.0-SNAPSHOT builds
  JGit v5.3.0.201901162155-m1
  Fix tools/version.sh
  JGit v5.3.0.201901161700-m1

Change-Id: I3c511fbc08f21eec5bb49d443de33d43094da4a4
2019-02-18 11:22:31 +09:00
David Pursehouse 9d02e52406 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  ObjectDirectory: extra logging on packfile exceptions

Change-Id: I4bbeb1d28ab042e3c6c74f7284f5d882ed034305
2019-02-18 11:21:38 +09:00
David Pursehouse 90876890bc Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  ObjectDirectory: extra logging on packfile exceptions

Change-Id: Id2fea30664d53b31ad026ee5ae06a5a24d731a52
2019-02-18 11:20:56 +09:00
Matthias Sohn 3ae22bdf66 Add missing @since tag for new API method getUpdateIndex
Change-Id: Idd4a580e241a9105a55bc6f0457ad02a35e55faf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-02-17 20:58:25 -05:00
Matthias Sohn ae79969715 Fix NPE in PlotCommitList
Bug: 544513
Change-Id: I2fca766bbdc441a2dca947fba5dde532de7a10fd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-02-18 01:25:12 +01:00
David Pursehouse 0368906353 CommitBuilder: Deprecate setEncoding(String)
Deprecate the method in favor of setEncoding(Charset).

Update the only caller in the code base that was still using
the deprecated variant.

Change-Id: I6357f2d0c727007013c72e9d5b7c72a3f5f3f2b1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-02-18 00:14:35 +01:00
David Pursehouse e5c4057467 CommitBuilder: Add missing periods on methods' Javadoc
Change-Id: Ibcf64b23de8534f7831d6e40ee4b0ad2bade74ce
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-02-18 00:14:34 +01:00
Luca Milanesio 962babc4b2 ObjectDirectory: extra logging on packfile exceptions
Display extra logging, including the exception with the associated
stacktrace, whenever a packFile can't be read and thus removed
from the packlist.

Change-Id: I97a4e31dc427bfcc0baae438dcbe2dcd4704b824
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
2019-02-14 10:44:00 +09:00
Minh Thai 2b7fa04dad Fix bug in copyPackBypassCache's skip 'PACK' header logic
Bug caused the pack to be 12 bytes short when cold cache.  Also added
test for copyPackAsIs method.

Change-Id: Idf8fb0e50d1215245d4b032e2e00df4b218c115f
Signed-off-by: Minh Thai <mthai@google.com>
2019-02-13 12:48:05 -08:00
Thomas Wolf a29d11775c Atomic file creation: hard-linking may not be allowed
Android for instance forbids hard linking via a SELinux
policy. If we can't hard link, the NFS work-around for
atomic file creation cannot work at all. In this case,
fall back to not using the hard-linking mechanism.

Android throws an AccessDeniedException, so we catch that.
The javadoc on Files.createLink() indicates that another
possibility might be a SecurityException, so catch that,
too.

Bug: 543956
Change-Id: I551b7a45f7b2fbbd8cf94f0b7233dbd8a200520e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-02-02 23:23:46 +01:00