Skip to main content
aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2018-06-21Fix maven site generation failing with javadoc errorsMatthias Sohn1-0/+4
The same errors are suppressed when generating javadoc. Suppress the errors during site generation. Change-Id: I83bd1c10e5de82f47c351e7edf2c9230be4b1f21 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-13Prepare 5.0.1-SNAPSHOT buildsMatthias Sohn2-47/+47
Change-Id: Iadf12dbdd63ef17c3f712c0fc18495304aa35016 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-13JGit v5.0.0.201806131550-rv5.0.0.201806131550-rMatthias Sohn2-2/+2
Change-Id: Ia2d548676217250593c3f0c383aec19e12e5e4a4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-13JGit v5.0.0.201806131210-rMatthias Sohn2-2/+2
Change-Id: Iedccfcaf57c11822f1faf5d5195357de42b2a14e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-13RefUpdateTest: Refactor to not use deprecated Repository#getAllRefsDavid Pursehouse1-17/+27
Change-Id: I157e62a0e1479d4bc95ef867e616ca8a30041759 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-06-13Make JGit describe behaves same as c-git for lightweight tagsMarcel Trautwein1-36/+145
JGit now considers lightweight tags only if the --tags option is set i.e. `git.describe().setAllTags(true)` has to be set, else the default is now as in c git: Only annotated tags are evaluated unless you pass true equivalent to --tags (or --all) by the option setAllTags. Hint: This (still) doesn't address any difference between c-git `--all` and `!--all --tags` behavior; perhaps this might be a follow up request Bug: 423206 Change-Id: I9a3699756df0b9c6a7c74a7e8887dea0df17c8e7 Signed-off-by: Marcel Trautwein <me+eclipse@childno.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-09RawTextTest#testBinary: use array comparison to compare arraysMatthias Sohn1-1/+2
Change-Id: Iac1feadf24858a0bdf0cb224f16b34e9498fe3bb Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-08Validate branch names on branch creationMatthias Sohn1-0/+12
Since v2.16.0-rc0~89^2~1 (branch: correctly reject refs/heads/{-dash,HEAD}, 2017-11-14), native git does not allow branch names - refs/heads/HEAD - starting with '-' Bug: 535655 Change-Id: Ib1c4ec9ea844073901a4ebe6a29ff6cc8ae58e93 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-08Use constant for ".lock"Matthias Sohn1-5/+6
Change-Id: Id65dc94c970ffd3ca3d3d4a5d57123c95d29e8af Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-05Prepare 5.0.0-SNAPSHOT buildsMatthias Sohn2-2/+2
Change-Id: I9acca328146aa7100fbc1b457fcb1f8fd87cf52a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-05JGit v5.0.0.201806050710-rc3v5.0.0.201806050710-rc3Matthias Sohn2-2/+2
Change-Id: Ic7a6a87dd3a21351e60fbf6cd330456adf1f6800 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-05Teach UploadPack "filter" in protocol v2 fetchJonathan Tan1-0/+60
If the configuration variable uploadpack.allowfilter is true, advertise that "filter" is supported, and support it if the client sends such an argument. Change-Id: I7de66c0a0ada46ff71c5ba124d4ffa7c47254c3b Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-06-05Refactor test of capabilities outputJonathan Tan1-11/+33
A subsequent patch will dynamically generate the capability advertisement, so the capability advertisements produced are not always the same. Separate the checking of the advertisements into its own test method. Change-Id: I768d14b9d1a244d5d886c42ffd62ef3957b518fb Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-06-05Disallow unknown args to "fetch" in protocol v2Jonathan Tan1-0/+23
JGit's implementation of the fetch command of protocol v2, unlike its implementation of ls-refs, currently tolerates unknown arguments. Tighten fetch to not allow unrecognized arguments and add tests to verify this behavior for both ls-refs and fetch. Change-Id: I321161d568bd638252fab1a47b06b924d472a669 Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-06-05Teach UploadPack shallow fetch in protocol v2Jonathan Tan1-1/+97
Add support for the "shallow" and "deepen" parameters in the "fetch" command in the fetch-pack/upload-pack protocol v2. Advertise support for this in the capability advertisement. TODO: implement deepen-relative, deepen-since, deepen-not Change-Id: I7ffd80d6c38872f9d713ac7d6e0412106b3766d7 Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-05-30Prepare 5.0.0-SNAPSHOT buildsMatthias Sohn2-2/+2
Change-Id: I9c4a0465f8e85041d24da97f4b4c7ad5f5eed3e4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-30JGit v5.0.0.201805301535-rc2v5.0.0.201805301535-rc2Matthias Sohn2-2/+2
Change-Id: Ifad678794525c01838b03e52bada66e1c089c5ae Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-25Don't prune symbolic refs when fetch.prune = trueThomas Wolf1-0/+44
The canonical implementation also doesn't. Compare current code in remote.c, function get_stale_heads_cb.[1] Not handling symrefs in this case was introduced in canonical git in [2] in 2008. [1] https://github.com/git/git/blob/v2.17.0/remote.c#L2259 [2] https://github.com/git/git/commit/740fdd27f0 Bug: 533549 Change-Id: If348d56bb4a96b8aa7141f7e7b5a0d3dd4e7808b Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-05-22Prepare 5.0.0-SNAPSHOT buildsMatthias Sohn2-2/+2
Change-Id: Ie343ccf37f46168041046500a2e19acc80814cfe Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-22JGit v5.0.0.201805221745-rc1v5.0.0.201805221745-rc1Matthias Sohn2-2/+2
Change-Id: Ie2c35fab87f294b00f9754b07b60a848bf256b10 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-22Repository: Deprecate #peel methodDavid Pursehouse3-5/+8
Callers should use getRefDatabase().peel(ref) instead since it doesn't swallow the IOException. Adapt all trivial callers to user the alternative. DescribeCommand still uses the deprecated method and is not adapted in this change since it will require more refactoring to add handling of the IOException. Change-Id: I14d4a95a5e0570548753b9fc5c03d024dc3ff832 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-05-22Skip ignored directories in FileTreeIteratorThomas Wolf4-3/+123
Make FileTreeIterator not enter ignored directories by default. We only need to enter ignored directories if we do some operation against git, and there is at least one tracked file underneath an ignored directory. Walking ignored directories should be avoided as much as possible as it is a potential performance bottleneck. Some projects have a lot of files or very deep hierarchies in ignored directories; walking those may be costly (especially so on Windows). See for instance also bug 500106. Provide a FileTreeIterator.setWalkIgnoredDirectories() operation to force the iterator to iterate also through otherwise ignored directories. Useful for tests (IgnoreNodeTest, CGitIgnoreTest), or to implement things like "git ls-files --ignored". Add tests in DirCacheCheckoutTest, and amend IndexDiffTest to test a little bit more. Bug: 388582 Change-Id: I6ff584a42c55a07120a4369fd308409431bdb94a Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-05-22Repository: Deprecate getTags methodDavid Pursehouse1-6/+11
Callers should use getRefDatabase().getRefsByPrefix(R_TAGS) instead. Adjust the tests accordingly. Bug: 534731 Change-Id: Ib28ae365e42720268996ff46e34cae1745ad545c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-05-18Remove further unnecessary 'final' keywordsHan-Wen Nienhuys21-52/+52
Remove it from * package private functions. * try blocks * for loops this was done with the following python script: $ cat f.py import sys import re import os def replaceFinal(m): return m.group(1) + "(" + m.group(2).replace('final ', '') + ")" methodDecl = re.compile(r"^([\t ]*[a-zA-Z_ ]+)\(([^)]*)\)") def subst(fn): input = open(fn) os.rename(fn, fn + "~") dest = open(fn, 'w') for l in input: l = methodDecl.sub(replaceFinal, l) dest.write(l) dest.close() for root, dirs, files in os.walk(".", topdown=False): for f in files: if not f.endswith('.java'): continue full = os.path.join(root, f) print full subst(full) Change-Id: If533a75a417594fc893e7c669d2c1f0f6caeb7ca Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2018-05-17Teach UploadPack "ofs-delta" in "fetch"Jonathan Tan1-5/+44
Add support for the "ofs-delta" parameter in the "fetch" command in the fetch-pack/upload-pack protocol v2. Change-Id: I728cf986082fce4ddeb6a6435897692e15e60cc7 Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-05-17Teach UploadPack "include-tag" in "fetch"Jonathan Tan1-0/+33
Add support for the "include-tag" parameter in the "fetch" command in the fetch-pack/upload-pack protocol v2. In order to determine which tags to include, only objects pointed to by refs starting with "refs/tags/" are checked. This restriction is for performance reasons and to match the behavior of Git (see add_ref_tag() in builtin/pack-objects.c). Change-Id: I7d70aa09bcc8a525218ff1559e286c2a610258ca Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-05-15Remove 'final' in parameter listsHan-Wen Nienhuys56-110/+110
Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2018-05-12Introduce new RawText constructor and RawParseUtils.lineMapOrBinaryHan-Wen Nienhuys2-2/+26
This makes binary detection exact in ResolveMerger and DiffFormatter This has the same intention as Id4342a199628d9406bfa04af1b023c27a47d4014 but preserves backward compatibility of the signature of RawParseUtils.lineMap. Change-Id: Ia24a4e716592bab3363ae24e3a46315a7511154f Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-08Mark CrissCrossMergeTest as flakyJonathan Nieder1-0/+5
It often fails on my machine, both in maven and bazel. This patch marks the test flaky[1] in bazel so that "bazel test" can run it a few times before declaring failure. [1] https://docs.bazel.build/versions/master/be/common-definitions.html#test.flaky Bug: 534285 Change-Id: Ibe5414fefbffe4e8f86af7047608d51cf5df5c47
2018-04-25Remove trivial cases of using deprecated RefDatabase.getRefs()Matthias Sohn1-3/+3
Change-Id: I2d3e426a3391923f8a690ac68fcc33851f3eb419 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-04-24Suppress boxing warningMatthias Sohn1-0/+1
Change-Id: I90226674320841774ad691c84609e3fe71bf7852 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-04-24Remove unnecessary semicolonMatthias Sohn1-1/+1
Change-Id: I3677ecb106ade209e756cec2c6f4232a416bfb44 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-04-24Remove unused code and link to deprecated codeJonathan Tan1-20/+1
Eclipse reports these as errors, so remove them. Change-Id: Ic53d8003f9faef38fe776af5a73794e7bb1dfc49 Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-04-23Teach UploadPack "no-progress" in "fetch"Jonathan Tan1-0/+42
Add support for the "no-progress" parameter in the "fetch" command in the fetch-pack/upload-pack protocol v2. Change-Id: I6a6d6b1534f44845254b81d0e1f5c4ba2ac3d10b Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-04-23Teach UploadPack "thin-pack" in "fetch"Jonathan Tan1-0/+31
Add support for the "thin-pack" parameter in the "fetch" command in the fetch-pack/upload-pack protocol v2. Change-Id: I39a37b2b66a16929137d35c718a3acf2afb6b0b5 Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-04-23Teach UploadPack basic "fetch" commandJonathan Tan1-2/+258
Add basic support for the "fetch" command in the fetch-pack/upload-pack protocol v2. This patch teaches "have" and "done". The protocol specification (Documentation/technical/protocol-v2.txt in the Git project) states: want <oid> Indicates to the server an object which the client wants to retrieve. Wants can be anything and are not limited to advertised objects. It is unspecified whether the server should respect the uploadpack.allowtipsha1inwant option etc. when serving packfiles. This patch is conservative in that the server respects them. Change-Id: I3dbec172239712ef9286a15b8407e86b87ea7863 Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-04-23Teach UploadPack "ref-prefix" in "ls-refs"Jonathan Tan1-0/+39
Add support for the "ref-prefix" parameter in the "ls-refs" command in the fetch-pack/upload-pack protocol v2. Change-Id: If9cf93b2646f75d50a11b5f482594f014d59a836 Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-04-23Implement ls-refs in UploadPackJonathan Tan1-0/+81
Implement support for Git protocol v2's "ls-refs" command and its "symrefs" and "peel" parameters. This adds support for this command to UploadPack but the git://, ssh://, and git:// transports do not make use of it yet. That will have to wait for later patches. Change-Id: I8abc6bcc6ed4a88c165677ff1245625aca01267b Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-04-20Implement protocol v2 with no capabilities in UploadPackJonathan Tan1-0/+64
Add initial support for protocol v2 of the fetch-pack/upload-pack protocol. This protocol is described in the Git project in "Documentation/technical/protocol-v2.txt". This patch adds support for protocol v2 (without any capabilities) to UploadPack. Adaptations of callers to make use of this support will come in subsequent patches. [jn: split from a larger patch; tweaked the API to make UploadPack handle parsing the extra parameters and config instead of requiring each caller to do such parsing] Change-Id: I79399fa0dce533fdc8c1dbb6756748818cee45b0 Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-04-20PacketLineIn, PacketLineOut: Add support for delim-pktJonathan Tan2-11/+13
Most pkt-lines (data-pkts) have the form pkt-len pkt-payload where pkt-len is a string of 4 hexadecimal digits representing the size in bytes of the pkt-line. Since this size includes the size of the pkt-len, no data-pkt has a length less than 4. A pkt-line with a length field less than 4 can thus be used for other purposes. In Git protocol v1, the only such pkt-line was flush-pkt = "0000" which was used to mark the end of a stream. Protocol v2 (see Documentation/technical/protocol-v2.txt in git.git) introduces a second special pkt-line type: delim-pkt = "0001" used to mark the end of a section within a stream, for example to separate capabilities from the content of a command. [jn: split out from a larger patch that made use of this support] Change-Id: I10e7824fa24ed74c4f45624bd490bba978cf5c34 Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-04-20Add RefDatabase#getRefsByPrefix methodJonathan Tan1-0/+23
The existing RefDatabase#getRefs abstract method (to be implemented by ref database backends) has the following issues: - It returns a map with a key (the name of the ref with the prefix removed) which is potentially superfluous (it can be derived by the caller if need be) and confusing (in that the prefix is removed). - The prefix is required to end with a '/', but some backends (e.g. reftable) have fast search by prefix regardless of what the last character of the prefix is. Add a new method #getRefsByPrefix that does not have these issues. This is non-abstract with a default implementation that uses #getRefs (for backwards compatibility), but ref database backends can reimplement it. This also prepares for supporting "ref-prefix" in the "ls-refs" command in the fetch-pack/upload-pack protocol v2, which does not require that the prefix end with a '/'. Change-Id: I4c92f852e8c1558095dd460b5fd7b602c1d82df1 Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-04-18Handle Gerrit Change-Ids for merge commitsThomas Wolf1-15/+57
Otherwise successful, non-conflicting merges will never get a Gerrit Change-Id. Bug: 358206 Change-Id: I9b599ad01d9f7332200c1d81a1ba6ce5ef990ab5 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-04-13Merge "Push: Ensure ref updates are processed in input order"David Pursehouse1-1/+59
2018-04-13Push: Ensure ref updates are processed in input orderDave Borowitz1-1/+59
Various places on the client side of the push were creating unordered maps and sets of ref names, resulting in ReceivePack processing commands in an order other than what the client provided. This is normally not problematic for clients, who don't typically care about the order in which ref updates are applied to the storage layer. However, it does make it difficult to write deterministic tests of ReceivePack or hooks whose output depends on the order in which commands are processed, for example if informational per-ref messages are written to a sideband.[1] Add a test that ensures the ordering of commands both internally in ReceivePack and in the output PushResult. [1] Real-world example: https://gerrit-review.googlesource.com/c/gerrit/+/171871/1/javatests/com/google/gerrit/acceptance/git/PushPermissionsIT.java#149 Change-Id: I7f1254b4ebf202d4dcfc8e59d7120427542d0d9e
2018-04-12Allow '@' as last character of refChristian Halstrick1-0/+2
Previously @ was allowed e.g. in branch names, but not as the last character. The case that @ is the last character was not handled. Change-Id: Ic33870b22236f7a5ec7b54007f1b0cefd9354bfb
2018-03-25Significantly speed up FileTreeIterator on WindowsThomas Wolf1-0/+93
Getting attributes of files on Windows is an expensive operation. Windows stores file attributes in the directory, so they are basically available "for free" when a directory is listed. The implementation of Java's Files.walkFileTree() takes advantage of that (at least in the OpenJDK implementation for Windows) and provides the attributes from the directory to a FileVisitor. Using Files.walkFileTree() with a maximum depth of 1 is thus a good approach on Windows to get both the file names and the attributes in one go. In my tests, this gives a significant speed-up of FileTreeIterator over the "normal" way: using File.listFiles() and then reading the attributes of each file individually. The speed-up is hard to quantify exactly, but in my tests I've observed consistently 30-40% for staging 500 files one after another, each individually, and up to 50% for individual TreeWalks with a FileTreeIterator. On Unix, this technique is detrimental. Unix stores file attributes differently, and getting attributes of individual files is not costly. On Unix, the old way of doing a listFiles() and getting individual attributes (both native operations) is about three times faster than using walkFileTree, which is implemented in Java. Therefore, move the operation to FS/FS_Win32 and call it from FileTreeIterator, so that we can have different implementations depending on the file system. A little performance test program is included as a JUnit test (to be run manually). While this does speed up things on Windows, it doesn't solve the basic problem of bug 532300: the iterator always gets the full directory listing and the attributes of all files, and the more files there are the longer that takes. Bug: 532300 Change-Id: Ic5facb871c725256c2324b0d97b95e6efc33282a Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-03-24Rename RecursiveMergerTest and ResolveMergerTest to reduce confusionDavid Pursehouse2-2/+2
The class names imply that RecursiveMergerTest tests the RecursiveMerger and ResolveMergerTest tests the ResolveMerger. In fact, both of them include coverage of both strategies; the difference is that RecursiveMergerTest is only testing criss-cross merges. The tests cannot be combined into a single class because the criss-cross test methods have additional data points. Instead, rename the classes to more meaningful names. Change-Id: I7ca8a03a3b7e351e2d4fcaca3b3186c098a3ca66 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-24ResolveMergerTest: Use @DataPoints instead of @DataPointDavid Pursehouse1-6/+4
Define strategiesUnderTest as an array of MergeStrategy using the @DataPoints annotation, rather than two separate variables each annotated as @DataPoint. This makes the implementation consistent with RecursiveMergerTest. Change-Id: I9f1d525b38cb59634ba054c7779dc4af1fc46e25 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-19UploadPackTest: Fix name hiding introduced by If72b4b422David Pursehouse1-26/+26
The local variable 'remote' hides the class scope variable of the same name. Change-Id: I7410c33678677ce2a14691772466d91e8139e3fa Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-16Merge branch 'stable-4.11'David Pursehouse1-2/+10
* stable-4.11: ObjectIdSerializer: Support serialization of known non-null ObjectId Change-Id: Ie430fa2c5d13ae698d884a37d0d03884ebbf25ec Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>

Back to the top