summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add progress monitor to MergerLaurent Delaigue2016-01-215-0/+58
| | | | | | | | | | | | Monitoring progress of merges can be useful for users for large repositories or complex merge processes that take some time. This enables setting a monitor. Existing merge implementations in jgit do not yet report progress if a monitor is set. This will be added in a later change. Change-Id: I17b978b3fc91750dd88649638b90a46820a0877c Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix TransportException when reading bundleChris Gavin2016-01-211-10/+17
| | | | | | | | | | | | | When reading a bundle file, commit messages who's oneline format is longer than 982 characters caused JGit to treat subsequent text in the commit as a SHA, then throw a TransportException because it's not a valid SHA. Now the readLine method will read all the way to the end of the line, not just the first 1024 characters of it. Change-Id: If15b491aa9a1e4fd9b8bbed2dd9e6be47a64ccb7 Signed-off-by: Chris Gavin <chris@chrisgavin.me>
* Fix unused throws CorruptObjectException from addTreeShawn Pearce2016-01-212-4/+2
| | | | | | | | 2262a794b48ea removed throws CorruptObjectException, but was not compiled under Eclipse and did not see errors generated by Eclipse. Maven build silently ignored the unnecessary code. Change-Id: I6e9014adcc604588e10e5963d13d0c6ef0e1c617
* Merge branch 'master' into stable-4.2Matthias Sohn2016-01-21195-3891/+9433
|\ | | | | | | Change-Id: Ieec4f51aedadf5734ae0e3f4e8713248a3c4fc52 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Merge "TreeWalk: Remove CorruptObjectException from ↵Shawn Pearce2016-01-201-10/+5
| |\ | | | | | | | | | addTree(AbstractTreeIterator)"
| | * TreeWalk: Remove CorruptObjectException from addTree(AbstractTreeIterator)Shawn Pearce2016-01-201-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This form of addTree() does not parse any objects and cannot throw the declared checked exception. Callers are being forced to try-catch CorruptObjectException that cannot occur when the iterator instance has already been constructed. Change-Id: Id338035302903bab81569d1576eab063eee0885a
| * | Fix ResetCommand to return the resulting refChristian Halstrick2016-01-202-24/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | ResetCommand was not returning the updated ref as a result of the call() method. Since the ResetCommand is always updating the same ref (HEAD) this should always be the HEAD ref. Bug: 440750 Change-Id: I7974975c3ab05e68c208384e69cf0692ded6e8db Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | Add option to allow empty commits to CommitCommandChristian Halstrick2016-01-203-0/+135
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | CommitCommand should allow to specify whether empty commits (commits having the same tree as the sole predecessor commit) are allowed or not. Similar to native git's "--allow-empty" flag. The defaults differ between JGit and native git even after this change. When not specifying paths then by default JGit allows to create empty commits while native git does not. It would be API breaking to change this now. Bug: 460301 Change-Id: I88feb0c3ffb2c686b1d0594e669729b065cda4cb Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Merge "Remove declared IOException which is no longer thrown"Matthias Sohn2016-01-192-4/+2
| |\
| | * Remove declared IOException which is no longer thrownMatthias Sohn2016-01-202-4/+2
| | | | | | | | | | | | | | | | | | | | | Since 2ccea7f0 ChangeIdUtil.computeChangeId() doesn't throw IOException anymore. Change-Id: I0bf43f2346dadbbfe7e6cbcb38b5525456fbf686 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | Merge branch 'stable-4.2'David Pursehouse2016-01-2029-496/+508
| |\ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.2: CheckoutCommandTest: Create Git instances in try-with-resource BranchCommandTest: Create Git instances in try-with-resource CheckoutTest: Create Git instances in try-with-resource BranchTest: Create Git instances in try-with-resource URIishTest: Use @Test annotation's `expected` argument Suppress "The allocated object is never used" warning in tests Add $NON-NLS to suppress "Non-externalized string literal" warnings Don't use deprecated constructors of CmdLineException Prepare 4.2.0-SNAPSHOT builds Remove org.eclipse.jgit.updatesite project from tools/version.sh RevParse: Remove superfluous semicolon RefUpdateTest: Use try-with-resource for auto-closable types RefUpdateTest: Add null check to prevent potential NPE CommitCommand: Remove redundant null check JGit v4.2.0.201512141825-rc1 Change-Id: I2179859289b2f2e3d0b7c6d02ef7e7890c467f7b Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
| * | ChangeIdUtil: Don't throw IOExceptionDave Borowitz2016-01-191-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This could have only happened during the getBytes call. Instead, use Constants.encode, which is a non-throwing implementation. This change is binary compatible with existing code compiled against older versions of JGit, although it might break compilation of previously compiling code due to dead catch blocks. Change-Id: I191fec5cac718657407230de141440e86d0151fb
| * | Merge "Transport: Implement AutoCloseable"Shawn Pearce2016-01-1911-263/+132
| |\ \
| | * | Transport: Implement AutoCloseableShawn Pearce2016-01-1911-263/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After creating a Transport instance callers should always call its close() method. Use AutoCloseable to document this idiom and allow use of try-with-resources. Change-Id: I0c6ff3e39ebecdd7a028dbcae1856a818937b186
| * | | Merge changes from topic 'deadtree'Shawn Pearce2016-01-1911-1628/+151
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | * changes: Ignore API errors about Tree, TreeEntry, FileTreeEntry and friends being removed Revert "Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and friends""
| | * | | Ignore API errors about Tree, TreeEntry, FileTreeEntry and friends beingShawn Pearce2016-01-191-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | removed Bug: 486105 Change-Id: I04adcdb68bee7d5f608bb7ab959fe36a890f9ecd
| | * | | Revert "Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry andAndrey Loskutov2016-01-1910-1628/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | friends"" This reverts commit 2cc80187d3633adedc99eb97132e0a749b457c19. Bug: 486105 Change-Id: Id4f9987c33d66cbed9de6e4d4d6784afdd01a3cf Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | | | Merge "ReceiveCommand.abort(): Utility to mark batch of commands as failed"Shawn Pearce2016-01-196-57/+63
| |\ \ \ \ | | |/ / / | |/| / / | | |/ /
| | * | ReceiveCommand.abort(): Utility to mark batch of commands as failedShawn Pearce2016-01-186-57/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If one or more commands is failing the entire group usually has to also fail with "transaction aborted". Pull this loop into a helper so the idiom can be easily reused in several places throughout JGit. Change-Id: I3b9399b7e26ce2b0dc5f7baa85d585a433b4eaed
| * | | Annotated to be removed Tree API with @noreference and @noextendAndrey Loskutov2016-01-195-0/+10
| |/ / | | | | | | | | | | | | | | | | | | | | | See https://wiki.eclipse.org/Eclipse/API_Central/API_Removal_Process. Bug: 486105 Change-Id: I460e43da0d487279608729a2081c614e7065f56f Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | Merge "Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and friends""Shawn Pearce2016-01-1510-111/+1618
| |\ \
| | * | Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and friends"Shawn Pearce2016-01-1510-111/+1618
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 0f8743d4d7a4f3af1eccea60d45d51d13f1a2ad4. JGit is unable to iterate its API. Change-Id: Ie3d6a28e622a5c0cf54768a2299f1c44c0114c19
| * | | Merge "PackWriter: Declare preparePack object sets as @NonNull"Shawn Pearce2016-01-125-42/+38
| |\ \ \
| | * | | PackWriter: Declare preparePack object sets as @NonNullShawn Pearce2016-01-125-42/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Require callers to pass in valid sets for both want and have collections. Offer PackWriter.NONE as a handy constant for an empty collection for the have part of preparePack instead of null. Change-Id: Ifda4450f5e488cbfefd728382b7d30797e229217
| * | | | Merge "GC: Pack RefTrees in their own pack"Shawn Pearce2016-01-124-33/+197
| |\| | |
| | * | | GC: Pack RefTrees in their own packShawn Pearce2016-01-124-33/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The RefTree graph needs to be quickly accessed to read references. It is also distinct graph disconnected from the rest of the repository. Store the commit and tree objects in their own pack. Change-Id: Icbb735be8fa91ccbf0708ca3a219b364e11a6b83
| * | | | Change to extensions.refsStorageShawn Pearce2016-01-111-1/+1
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | git-core just rerolled the extensible backends series with refsStorage as the configuration key. Update JGit to match git-core. Change-Id: If345a2403a996e358b29cfa2a2298f6e8d59d96b
| * | | RefTree: Change peel suffix to " ^" (space carrot)Shawn Pearce2016-01-112-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using ^{} as the peel suffix has caused problems when projects used tags like v2.1 and then v2.1.1, v2.2.2, etc. The peeled value for v2.1 was stored very far away in the tree relative to v2.1 itself as ^ sorts in the ASCII/UTF-8 encoding after all other common tag characters like digits and dots. Use " ^" instead as space is not valid in a reference name, sorts before all other valid reference characters (thus forcing next entry locality) and this looks like a peeled marker for the prior tag. Change-Id: I26d2247a0428dfe26a9c319c02159502b3a67455
| * | | FileRepository: Support extensions.refsBackendType = RefTreeShawn Pearce2016-01-114-13/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This experimental code can be enabled in $GIT_DIR/config: [core] repositoryformatversion = 1 [extensions] refsBackendType = RefTree When these are set the repository will read references from the RefTree rooted by the $GIT_DIR/refs/txn/committed reference. Update debug-rebuild-ref-tree to rebuild refs/txn/committed only from the bootstrap layer. This avoids misuse by rebuilding using packed-refs and $GIT_DIR/refs tree. Change-Id: Icf600e4a36b2f7867822a7ab1f1617d73c710a4b
| * | | RefTreeDatabase: Ref database using refs/txn/committedShawn Pearce2016-01-1110-4/+1937
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of storing references in the local filesystem rely on the RefTree rooted at refs/txn/committed. This avoids needing to store references in the packed-refs file by keeping all data rooted under a single refs/txn/committed ref. Performance to scan all references from a well packed RefTree is very close to reading the packed-refs file from local disk. Storing a packed RefTree is smaller due to pack file compression, about 49.39 bytes/ref (on average) compared to packed-refs using ~65.49 bytes/ref. Change-Id: I75caa631162dc127a780095066195cbacc746d49
| * | | Merge "RevCommit: Better support invalid encoding headers"Shawn Pearce2016-01-115-56/+263
| |\ \ \ | | |/ / | |/| |
| | * | RevCommit: Better support invalid encoding headersShawn Pearce2016-01-115-56/+263
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this support we no longer need the 'utf-8' alias. UTF-8 will be automatically tried when the encoding header is not recognized and used if the character sequence cleanly decodes as UTF-8. Modernize some of the references to use StandardCharsets. Change-Id: I4c0c88750475560e1f2263180c4a98eb8febeca0
| * | | Remove deprecated Tree, TreeEntry, FileTreeEntry and friendsShawn Pearce2016-01-0910-1618/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These types were deprecated in 0.9.1 (aka 384a19eee07a2f). If anyone is still using them, its time to stop. Change-Id: I3f73347ba78c639e0c6a504812bc1a0702f829b1
| * | | Paths.pathCompare: Utility to sort paths from byte[]Shawn Pearce2016-01-0910-112/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consolidate copies of this function into one location. Add some unit tests to prevent bugs that were accidentally introduced while trying to make this refactoring. Change-Id: I82f64bbb8601ca2d8316ca57ae8119df32bb5c08
| * | | Add Paths utility classShawn Pearce2016-01-082-0/+139
| | | | | | | | | | | | | | | | | | | | | | | | Simple container for some path related utility functions. Change-Id: Ice2bec6ad12b1e2cea15988c01aa9dd4e016a849
| * | | Merge changes from topic 'reftree'Shawn Pearce2016-01-0711-1/+1159
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | * changes: debug-rebuild-ref-tree: Simple program to build a RefTree RefTree: Store references in a Git tree
| | * | | debug-rebuild-ref-tree: Simple program to build a RefTreeShawn Pearce2016-01-074-0/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This tool scans all references in the repository and writes out a new reference pointing to a single commit whose root tree is a RefTree containing the current refs of this repository. It alway skips storing the reference it will write to, avoiding the obvious cycle. Change-Id: I20b1eeb81c55dc49dd600eac3bf8f90297394113
| | * | | RefTree: Store references in a Git treeShawn Pearce2016-01-077-1/+1025
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A group of updates can be applied by updating the tree in one step, writing out a new root tree, and storing its SHA-1. If references are stored in RefTrees, comparing two repositories is a matter of checking if two SHA-1s are identical. Without RefTrees comparing two repositories requires listing all references and comparing the sets. Track the "refs/" directory as a root tree by storing references that point directly at an object as a GITLINK entry in the tree. For example "refs/heads/master" is written as "heads/master". Annotated tags also store their peeled value with ^{} suffix, using "tags/v1.0" and "tags/v1.0^{}" GITLINK entries. Symbolic references are written as SYMLINK entries with the blob of the symlink carrying the name of the symbolic reference target. HEAD is outside of "refs/" namespace so it is stored as a special "..HEAD" entry. This name is chosen because ".." is not valid in a reference name and it almost looks like "../HEAD" which names HEAD if the reader was inside of the "refs/" directory. A new Command type is required to handle symbolic references and peeled references. Change-Id: Id47e5d4d32149a9e500854147edd7d93c1041a39
| * | | Make sure CLIGitCommand and Main produce (almost) same resultsAndrey Loskutov2016-01-064-141/+231
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently execution of tests in pgm uses CLIGitCommand which re-implements few things from Main. Unfortunately this can results in a different test behavior compared to the real CLI runtime. The change let CLIGitCommand extend Main and only slightly modifies the runtime (stream redirection and undesired exit() termination). Change-Id: I87b7b61d1c84a89e5917610d84409f01be90b70b Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | | branch command: print help if requested, even if arguments are wrongAndrey Loskutov2016-01-063-4/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git branch -d -h reports an error (because of missing -d option value) but does not print the help as expected. To fix this, CmdLineParser must catch, print but do not propagate exceptions if help is requested. Bug: 484951 Change-Id: I51265ebe295f22da540792c6a1980b8bdb295a02 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | | Added CLIText.fatalError(String) API for testsAndrey Loskutov2016-01-066-16/+29
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | In different places (Main, TextBuiltin, CLIGitCommand) we report fatal errors and at same time want to check for fatal errors in the tests. Using common API simplifies the error testing and helps to navigate to the actual error check implementation. Change-Id: Iecde79beb33ea595171f168f46b0b10ab2f339bb Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | GitServletResponseTest: Fix testObjectCheckerExceptionShawn Pearce2016-01-061-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | The recent ObjectChecker changes to pass in AnyObjectId as part of the checkCommit method signature meant the override here was no longer throwing an exception as expected. Change-Id: I0383018b48426e25a0bc562387e8cd73cbe13129
| * | Merge "InMemoryRepository: Abort BatchRefUpdate if a command previously failed"Shawn Pearce2016-01-061-0/+5
| |\ \
| | * | InMemoryRepository: Abort BatchRefUpdate if a command previously failedShawn Pearce2016-01-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | If any command has already been marked as failing, fail the entire batch. Change-Id: I1692240841aa4f4cb252bdccbc6f11d9246929c1
| * | | DFS: Allow other RefDatabase implementationsShawn Pearce2016-01-063-9/+13
| |/ / | | | | | | | | | | | | | | | | | | Permit a DfsRepository implementation to use a different RefDatabase than DfsRefDatabase. Change-Id: Ia263285f547bde1943993cc994d0222185021a16
| * | buck: Make :jgit_src target work in cross-cell environmentDavid Ostrovsky2016-01-041-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This artifact is used from unzip utility in Gerrit Code Review build toolchain and thus the file must exist on the file system. Moreover, trying to use java_binary() didn't work either, as the zip layout was wrong: all files contained 'org.eclipse.jgit/src/' prefix. Change-Id: I00e3269a7a1a6c6d1fe7e60d1bf1c69b8e57d79d Signed-off-by: David Ostrovsky <david@ostrovsky.org>
| * | Merge changes I487a30fb,I82a01b5fShawn Pearce2016-01-035-3/+122
| |\ \ | | | | | | | | | | | | | | | | | | | | * changes: Ensure all http tests are run and fix broken tests buck: run http tests
| | * | Ensure all http tests are run and fix broken testsMatthias Sohn2016-01-022-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HttpClientTests were broken. This wasn't discovered since maven-surefire-plugin's by default only executes test classes matching **/*Test.java. Fix this by also including **/*.Tests.java and fix the failing tests. Change-Id: I487a30fb333de993a9f8d8fff491d3b0e7fb02cc Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * | buck: run http testsMatthias Sohn2016-01-023-0/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running tests using buck reveals that HttpClientTests are broken and weren't executed by Maven since these test classes don't match the maven-surefire-plugin's default for test classes **/*Test.java. Will be fixed in a follow-up change. Change-Id: I82a01b5fd3f0a930bec2423a29a256601dadc248 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | | Merge "buck: set Bundle-Version for :jgit_bin"Shawn Pearce2016-01-032-3/+37
| |\ \ \