aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* DiffFormatterTest: Create auto-closeable instances in try-with-resourceDavid Pursehouse2016-01-211-78/+82
| | | | | | | | Git, ByteArrayOutputStream, and DiffFormatter are auto-closeable and should be managed in try-with-resource. Change-Id: I83395116acb4b4f7cd4300fd69564355bc07e4bb Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* ConfigTest: Create Git instance in try-with-resourceDavid Pursehouse2016-01-211-1/+3
| | | | | Change-Id: Ie65c69e0f1aed95bcdf68ebd68d21b3e2590b41c Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* CommitAndLogCommandTest: Use assumeFalse to skip test on WindowsDavid Pursehouse2016-01-211-2/+2
| | | | | | | | Use JUnit's assumeFalse method to cause the test to skip when run on Windows. Change-Id: I3f59440cfe62c37c127e381052b60471fbe8ec5e Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* CommitAndLogCommandTest: Create Git instances in try-with-resourceDavid Pursehouse2016-01-211-250/+256
| | | | | Change-Id: Id06417f1d3914cd3addacdbe9b5801a06cc3955f Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* AddCommandTest: Create Git instances in try-with-resourceDavid Pursehouse2016-01-211-306/+327
| | | | | Change-Id: Idf42f03099eeb9975fef9492ea8a75776afc2a3c Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* ArchiveCommandTest: Create Git instances in try-with-resourceDavid Pursehouse2016-01-211-85/+89
| | | | | Change-Id: Icbfd92395db85818736142fd3fb3432385e89ca9 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* TagCommandTest: Instantiate Git and RevWalk objects in try-with-resourceDavid Pursehouse2016-01-201-101/+115
| | | | | Change-Id: I08959650e2970e964bc864dc6d120d7bddfd8232 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* BlameCommandTest: Instantiate Git objects in try-with-resourceDavid Pursehouse2016-01-201-303/+305
| | | | | Change-Id: Icb9e6bb9ee99589fa2e0388c8b305a8a1f5954db Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* SideBandOutputStreamTest: Use try-with-resourceDavid Pursehouse2016-01-201-11/+16
| | | | | | | | | | | Factor out the creation of the SideBandOutputStream objects into a utility method that wraps it in a try-with-resource. Remove the "unused" suppression that is now unnecessary, and add declaration that the tests methods can throw Exception. Change-Id: Iff02e4e3532bd6ab6e423f197e70d44c4f328d0b Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* FileTreeIteratorJava7Test: Create Git instances in try-with-resourceDavid Pursehouse2016-01-201-32/+38
| | | | | Change-Id: I493e90e8a0d96db5acc49759c8e138b0a8c7b099 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* CheckoutCommandTest: Create Git instances in try-with-resourceDavid Pursehouse2016-01-191-48/+49
| | | | | | | | Also rename a local variable in one of the tests that was hiding a class variable of the same name. Change-Id: Ia9398157b87a78df6eef0b64a833c16ca2e57ce3 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* BranchCommandTest: Create Git instances in try-with-resourceDavid Pursehouse2016-01-191-33/+33
| | | | | | | | Also remove a local variable in one of the tests that was hiding a member variable with the same name. Change-Id: Ia4d94cdbf2d83d8be2645f0a93d8891d01606c59 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* CheckoutTest: Create Git instances in try-with-resourceDavid Pursehouse2016-01-191-285/+306
| | | | | Change-Id: I49a03f7bee0b61c062ce160674f9aa0cd1bcc8ba Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* BranchTest: Create Git instances in try-with-resourceDavid Pursehouse2016-01-191-8/+12
| | | | | Change-Id: I8becee479fab91a18e6daffd6f4fd57338c9d120 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* URIishTest: Use @Test annotation's `expected` argumentDavid Pursehouse2016-01-191-36/+10
| | | | | | | | Specify the expected exception in the annotation, instead of catching it and calling `fail()` when it wasn't raised. Change-Id: I8a640c0e42353533e4e73b85b50c224dc060f2d7 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* Suppress "The allocated object is never used" warning in testsDavid Pursehouse2016-01-196-0/+13
| | | | | Change-Id: Ibb405e0b36ce5a2cb30268a7de31ab2bd079ad80 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* Add $NON-NLS to suppress "Non-externalized string literal" warningsDavid Pursehouse2016-01-1910-41/+41
| | | | | Change-Id: I3e6f83ad2bc7d493e2c1ab5a8c60affa2b49c386 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* Don't use deprecated constructors of CmdLineExceptionDavid Pursehouse2016-01-196-22/+29
| | | | | Change-Id: If01fa896537209821d6a7a262ee978572195a397 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* Merge "Prepare 4.2.0-SNAPSHOT builds" into stable-4.2Matthias Sohn2016-01-1946-49/+49
|\
| * Prepare 4.2.0-SNAPSHOT buildsMatthias Sohn2016-01-1946-49/+49
| | | | | | | | | | Change-Id: Ibe38a95bf36db0c0ed948280b28c416943ec0329 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Merge "Remove org.eclipse.jgit.updatesite project from tools/version.sh" ↵Matthias Sohn2016-01-191-11/+0
|\| | | | | | | into stable-4.2
| * Remove org.eclipse.jgit.updatesite project from tools/version.shMatthias Sohn2016-01-191-11/+0
| | | | | | | | | | | | | | | | We don't need to update versions for this project which was removed a long time ago. Change-Id: Ie2d030134942add152847581797db3a213ec4c9e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | RevParse: Remove superfluous semicolonDavid Pursehouse2016-01-141-1/+1
| | | | | | | | | | Change-Id: I5975bc58d7933dafb3e7a8d891e9f6878b98a9a1 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* | RefUpdateTest: Use try-with-resource for auto-closable typesDavid Pursehouse2016-01-141-10/+13
| | | | | | | | | | Change-Id: I25c8db0e410aa2a4a53dc7d8863e4a6efefcf7cb Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* | RefUpdateTest: Add null check to prevent potential NPEDavid Pursehouse2016-01-141-1/+1
|/ | | | | Change-Id: I64b1850c3bb80b09409044461ca3fdde1c46d4bb Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* CommitCommand: Remove redundant null checkDavid Pursehouse2016-01-141-1/+1
| | | | | | | | Repository.getWorkTree is annotated as @NonNull, so the check for it returning null is redundant. Change-Id: I597b0f774ff857b8900519f14a1a17a904cf7c6f Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* JGit v4.2.0.201512141825-rc1v4.2.0.201512141825-rc1Matthias Sohn2015-12-1546-49/+49
| | | | | Change-Id: Id725ea888acd23793d37de2864ec0727160a2eaf Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'master' into stable-4.2Matthias Sohn2015-12-15147-776/+5994
|\ | | | | | | | | Change-Id: Ia92c91e1226da7d6455ab14f1e255a1546f8f357 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Merge "push: Do not blindly overwrite peer"Shawn Pearce2015-12-144-4/+156
| |\
| | * push: Do not blindly overwrite peerShawn Pearce2015-12-144-4/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an application uses PushConnection directly on the native Git wire protocols JGit should send along the application's expected oldId, not the advertised value. This allows the remote peer to compare-and-swap since it was not tested inside JGit. Discovered when I tried to use a PushConnection (bypassing the standard PushProcess) and the client blindly overwrote the remote reference, even though my app had supplied the wrong ObjectId for the expectedOldObjectId. This was not expected and cost me over an hour of debugging, plus "corruption" in the remote repository. By passing along the exact expectedOldObjectId from the app the remote side can do the check that the application skipped, and avoid data loss. Change-Id: Id3920837e6c47100376225bb4dd61fa3e88c64db
| * | Fix FileTreeIterator.idSubmodule(Entry)Christian Halstrick2015-12-132-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | FileTreeIterator was calling by mistake WorkingTreeIterator.idSubmodule(Entry). Instead it should always compute idSubmodule on its own. Change-Id: Id1b988aded06939b1d7edd2671e34bf756896c0e
| * | URIish: fixed full uri pattern not expecting end of line after host nameAndrey Loskutov2015-12-122-4/+23
| | | | | | | | | | | | | | | | | | Bug: 483326 Change-Id: I8b6e3eb648c8ec2c38f73de22382537b1276b779 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | Add remote command to JGit CLIKaloyan Raev2015-12-1116-2/+1307
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Supported subcommands are: - <none> (lists available remotes) - add - remove - set-url - update Supported options are: --verbose --push --prune Bug: 481316 Change-Id: I57c34ed6daabb7d308bc383b17c1ef4af433e714 Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | Merge "Fix NPE in HttpAuthMethod"Christian Halstrick2015-12-081-1/+2
| |\ \
| | * | Fix NPE in HttpAuthMethodMatthias Sohn2015-12-071-1/+2
| | |/ | | | | | | | | | | | | | | | | | | If the password char array is null constructing a new String from this array fails with a NPE. Add a null check to fix this. Change-Id: Ifae6eecca38d5f114861f44658a32521e6e96866 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * / Use runtime retention for Nullable annotationJonathan Nieder2015-12-071-4/+35
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JGit's Nullable type was added[1] in the hope of being able to add nullness annotations that (a) do not preclude building and running with Java 7 and (b) could be shared by Gerrit, which uses a custom Nullable type for other reasons[2]. Sharing a type is useful because Eclipse's null analysis is only able to use one Nullable type at a time in a given workspace (so for this analysis to function in a workspace used to develop Gerrit, JGit and Gerrit would need to use the same Nullable type). The new Nullable type has CLASS instead of RUNTIME retention because there wasn't any obvious use for the annotation at run time. Gerrit uses the Nullable annotation to communicate with Guice. Guice injection happens at runtime, so it needs to be able to read the @Nullable annotations at run time[3]. Otherwise Guice produces provisioning errors, such as 3) null returned by binding at com.google.gerrit.lucene.LuceneChangeIndex$Factory.create() but parameter 7 of com.google.gerrit.lucene.LuceneChangeIndex.<init>() is not @Nullable Switch to RUNTIME retention to avoid this. While at it, update the javadoc to explain more clearly how this annotation relates to other Nullable types[4]. This should make it clearer why JGit needed another Nullable type: A. Avoiding dependency on Java 8 B. RUNTIME retention to allow Guice to read the annotation at run time C. Named Nullable so Guice can recognize the annotation D. Not an addition to Java EE's javax.annotation package, to avoid the split-package problem[2] that prevents the annotation from being readable at run time when loaded from an OSGi container E. Avoiding heavyweight dependencies, deprecated dependencies, and dependencies on package internals org.checkerframework.checker.nullness.qual.Nullable: A com.sun.istack.internal.Nullable: B, E *.CheckForNull, *.NullAllowed, etc: C edu.umd.cs.findbugs.annotations.Nullable: B, E javax.annotation.Nullable: D org.eclipse.jdt.annotation.Nullable: B org.jetbrains.annotations.Nullable: B org.jmlspecs.annotation.Nullable: E android.annotation.Nullable, android.support.annotation.Nullable: E [1] https://git.eclipse.org/r/59993 [2] https://gerrit-review.googlesource.com/50112 [3] https://github.com/google/guice/blob/master/core/src/com/google/inject/internal/Nullability.java [4] https://github.com/typetools/checker-framework/blob/5832a01f1/checker/src/org/checkerframework/checker/nullness/NullnessAnnotatedTypeFactory.java#L118 http://types.cs.washington.edu/checker-framework/current/checker-framework-manual.html#nullness-related-work Change-Id: I6c482653d2b53e3509abb11211b67fc29cf2949c Signed-off-by: Jonathan Nieder <jrn@google.com>
| * Support atomic push in JGit clientShawn Pearce2015-12-029-34/+446
| | | | | | | | | | | | | | | | | | | | | | | | | | This should mirror the behavior of `git push --atomic` where the client asks the server to apply all-or-nothing. Some JGit servers already support this based on a custom DFS backend. InMemoryRepository is extended to support atomic push for unit testing purposes. Local disk server side support inside of JGit is a more complex animal due to the excessive amount of file locking required to protect every reference as a loose reference. Change-Id: I15083fbe48447678e034afeffb4639572a32f50c
| * Fix wrong @since tag In ReceiveCommandMatthias Sohn2015-12-021-1/+1
| | | | | | | | Change-Id: I58fa657dd4783fed0ffca94020c87c49d99009c6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * ReceiveCommand.filter: Accept IterableShawn Pearce2015-12-011-7/+28
| | | | | | | | | | | | | | | | | | | | PreReceiveHook is given a Collection<ReceiveCommand> and it can be very useful here to call ReceiveCommand.filter(cmds, NOT_ATTEMPTED). Overload filter to accept both Iterable and List. Keep backwards binary compatibility for List by upcasting to Iterable. Change-Id: Ib1341876c703670945ef209edc8259715ee86c26
| * Merge changes If1490ca2,Ife950253Shawn Pearce2015-11-305-62/+167
| |\ | | | | | | | | | | | | | | | * changes: DirCacheBuilder: Speed up reading from trees Delay locating .gitattributes until requested
| | * DirCacheBuilder: Speed up reading from treesShawn Pearce2015-11-302-19/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recursively copying a tree into a DirCache is a bottleneck for some algorithms like the in memory merge code in Gerrit Code Review. Drop a layer down in the stack and use CanonicalTreeParser directly as the addition logic only processes 1 tree at a time and does not need the merge sorting feature (or overhead) of TreeWalk. Combined with 761814fe9c ("DirCacheEntry: Speed up creation by avoiding string cast") tree loading 38,900 entries nearly halves in running time from 70ms to 36ms on some platforms. Change-Id: If1490ca25de0679a71cf508f59b486f9cc816165
| | * Delay locating .gitattributes until requestedShawn Pearce2015-11-293-43/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of checking every entry for .gitattributes only look for the entry on request by TreeWalk. This avoids impacting uses like RevWalk filtering history. When the attrs is requested skip to the start of the tree and look for .gitattributes until either it is found, or it is impossible to be present. Due to the sorting rules of tree entries .gitattributes should be among the first or second entries in the tree so very few entries will need to be considered. Waiting to find the .gitattributes file by native ordering may miss attrs for files like .config, which sorts before .gitattributes. Starting from the front of the tree on demand ensures the attributes are parsed as early as necessary to process any entry in the tree. Due to TreeWalk recursively processing up the tree of iterators we cannot just reset the current CanonicalTreeParser to the start as parent parsers share the same path buffer as their children. Resetting a parent to look for .gitattributes may overwrite path buffer data used by a child iterator. Work around this by building a new temporary CanonicalTreeParser instance. Change-Id: Ife950253b687be325340d27e9915c9a40df2641c
| * | DirCache: Add helper to read from a treeShawn Pearce2015-11-293-36/+27
| |/ | | | | | | | | | | | | | | | | | | | | Application code sometimes wants to read a DirCache from an ObjectId, but its confusing how to do this because its buried inside the DirCacheBuilder. Use this utility in a few places within JGit that also want to read a DirCache from a tree's ObjectId. Change-Id: I578b7e18e58753d154937f4ab835012b09e5adca
| * DirCache: Fix bad code formattingShawn Pearce2015-11-282-8/+9
| | | | | | | | | | | | | | | | | | | | | | Line breaking before , is ugly to read. Most formatters and humans expect line break after , so update a few offensive locations. Use String.format() for the construction of the error message when a bad DirCachEntry is being failed on. This simplifies the code and its not a performance critical section. Change-Id: I5d990389e7ba24ef0861cf8ec0026ed030d4aeda
| * DirCacheEntry: Speed up creation by avoiding string castShawn Pearce2015-11-284-26/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The checkPath function is available as a byte[] form, in fact the String form just converts to byte[] to run the algorithm. Having DirCacheEntry take a byte[] -> String -> byte[] to check if each path is valid is a huge waste of CPU time. On some systems it can double the time required to read 38,999 files from trees to the DirCache. This slows down any operation using a DirCache. Expose the byte[] form and use it for DirCacheEntry creation. Change-Id: I6db7bc793ece99ff3c356338d793c07c061aeac7
| * DirCache: Fix getEntriesWithin("") to not include null entriesShawn Pearce2015-11-271-2/+2
| | | | | | | | | | | | | | | | The internal array may be longer than entryCnt, in this case the tail of the array is padded with null entries. Do not return those to the caller of getEntriesWithin(). Change-Id: I19efb05e103fab6b739ced407f6e28155a48dba6
| * Fix performance regression in CanonicalTreeParserShawn Pearce2015-11-271-15/+12
| | | | | | | | Change-Id: I14046559fddb9656d890d3099010117e84cd9439
| * Add support for smudge filtersChristian Halstrick2015-11-274-19/+234
| | | | | | | | | | | | | | | | | | | | | | If defined in .gitattributes call smudge filter during checkout. To support checkout where current HEAD,index do not contain attributes we need to also consider attributes from the tree we checkout. Therefore CanonicalTreeParser has to learn how to provide attributes. Change-Id: I168fdb81a8e1a9f991587b3e95a36550ea845f0a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Add support for clean filtersChristian Halstrick2015-11-2713-9/+546
| | | | | | | | | | | | | | | | | | When filters are defined for certain paths in gitattributes make sure that clean filters are processed when adding new content to the object database. Change-Id: Iffd72914cec5b434ba4d0de232e285b7492db868 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Add the new class Attributes holding multiple Attribute(s)Ivan Motsch2015-11-2713-60/+306
| | | | | | | | | | | | | | | | | | | | Attributes represents a semantic collector of Attribute(s) and replaces the anonymous Map<String,Attribute>. This class will be returned by TreeWalk.getAttributes(). It offers convenient access to the attributes wrapped in the Attributes object. Adds preparations for a future Attribute Macro Expansion Change-Id: I8348c8c457a2a7f1f0c48050e10399b0fa1cdbe1 Signed-off-by: Ivan Motsch <ivan.motsch@bsiag.com>