aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
Commit message (Collapse)AuthorAgeFilesLines
* daemon: Add --ketch=LEADER flagShawn Pearce2016-01-193-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Experimental flag to turn on the KetchLeader within this daemon JVM. This is a manually elected leader process, set from the command line. Remote followers for each repository are configured per-repository using remote sections with ketch-type = FULL. For example: Manually elected leader's $GIT_DIR/config: [ketch] name = A [remote "A"] ketch-type = FULL [remote "B"] url = git://127.0.0.1:9421/sample.git ketch-type = FULL [remote "C"] url = git://127.0.0.1:9422/sample.git ketch-type = FULL Replica B and C daemons: git daemon \ --export-all \ --enable=receive-pack \ --listen=127.0.0.1 --port=9421 \ --base-path=$HOME/ketch_test/follower_one \ $HOME/ketch_test/follower_one & git daemon \ --export-all \ --enable=receive-pack \ --listen=127.0.0.1 --port=9422 \ --base-path=$HOME/ketch_test/follower_two \ $HOME/ketch_test/follower_two & Change-Id: I165f85970a77e16b5263115290d685d8a00566f5
* Ketch: Intercept push and route it through KetchShawn Pearce2016-01-194-1/+166
| | | | | | | Capture commands and pass to the in-process KetchLeader, allowing it to replicate to followers. Change-Id: I25dfeb2a93821af65354337f391480a72bae2210
* Ketch: Simple map of running leader instancesShawn Pearce2016-01-191-0/+126
| | | | | | Supports use in basic daemons where RepositoryCache is also effective. Change-Id: Ia736b32c2c710b5a802233badc0d30818de763cd
* Ketch: Basic replication systemShawn Pearce2016-01-1922-0/+4672
| | | | | | | | | | | | | | | | | | Git Ketch is a multi-master Git repository management system. Writes are successful only if a majority of participant servers agree. Acked writes are durable against server failures as a majority of the participants store all required objects. Git Ketch is modeled on the Raft Consensus Algorithm[1]. A ketch sailing vessel is faster and more nimble than a raft. It can also carry more source codes. Git Ketch front-loads replication costs, which vaguely resembles a ketch sailing vessel's distinguishing feature of the main mast on the front of the ship. [1] https://raft.github.io/ Change-Id: Ib378dab068961fc7de624cd96030266660b64fb4
* Merge branch 'stable-4.2'David Pursehouse2016-01-202-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * Add $NON-NLS to suppress "Non-externalized string literal" warningsDavid Pursehouse2016-01-191-1/+1
| | | | | | | | | | Change-Id: I3e6f83ad2bc7d493e2c1ab5a8c60affa2b49c386 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
| * Prepare 4.2.0-SNAPSHOT buildsMatthias Sohn2016-01-193-4/+4
| | | | | | | | | | Change-Id: Ibe38a95bf36db0c0ed948280b28c416943ec0329 Signed-off-by: Matthias Sohn <matthias.sohn@sap.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-153-4/+4
| | | | | | | | | | Change-Id: Id725ea888acd23793d37de2864ec0727160a2eaf Signed-off-by: Matthias Sohn <matthias.sohn@sap.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-194-44/+38
|\ \
| * | Transport: Implement AutoCloseableShawn Pearce2016-01-194-44/+38
| | | | | | | | | | | | | | | | | | | | | | | | 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-196-1154/+40
|\ \ \ | | | | | | | | | | | | | | | | | | | | * 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-195-1154/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-155-0/+1144
|\ \
| * | Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and friends"Shawn Pearce2016-01-155-0/+1144
| | | | | | | | | | | | | | | | | | | | | | | | 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-123-28/+27
|\ \ \
| * | | PackWriter: Declare preparePack object sets as @NonNullShawn Pearce2016-01-123-28/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-112-5/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-119-4/+1252
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-113-56/+139
|\ \ \ | |/ / |/| |
| * | RevCommit: Better support invalid encoding headersShawn Pearce2016-01-113-56/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-095-1144/+0
| | | | | | | | | | | | | | | | | | | | | 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-097-111/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-081-0/+77
| | | | | | | | | | | | | | | | | | Simple container for some path related utility functions. Change-Id: Ice2bec6ad12b1e2cea15988c01aa9dd4e016a849
* | | RefTree: Store references in a Git treeShawn Pearce2016-01-075-1/+721
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | 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
* | Merge changes Idaed9310,I62bd7c0bMatthias Sohn2016-01-038-168/+705
|\ \ | | | | | | | | | | | | | | | * changes: ObjectChecker: honor some git-core fsck.* options ObjectChecker: allow some objects to skip errors
| * | ObjectChecker: honor some git-core fsck.* optionsShawn Pearce2015-12-306-175/+476
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Accept some of the same section keys that fsck does in git-core, allowing repositories to skip over specific kinds of acceptable broken objects, e.g.: [fsck] duplicateEntries = ignore zeroPaddedFilemode = ignore The zeroPaddedFilemode = ignore is a synonym for the JGit specific allowLeadingZeroFileMode = true. Only accept the JGit key if git-core key was not specified. Change-Id: Idaed9310e2a5ce5511670ead1aaea2b30aac903c
| * | ObjectChecker: allow some objects to skip errorsShawn Pearce2015-12-305-55/+291
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some ancient objects may be broken, but in a relatively harmless way. Allow the ObjectChecker caller to whitelist specific objects that are going to fail checks, but that have been reviewed by a human and decided the objects are OK enough to permit continued use of. This avoids needing to rewrite history to scrub the broken objects out. Honor the git-core fsck.skipList configuration setting when receiving a push or fetching from a remote repository. Change-Id: I62bd7c0b0848981f73dd7c752860fd02794233a6
* | | Merge changes from topic 'add-df'Shawn Pearce2016-01-0111-18/+435
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * changes: DirCache: Do not create duplicate tree entries DirCacheEditor: Replace file-with-tree and tree-with-file AddCommand: Use NameConflictTreeWalk to identify file-dir changes
| * | | DirCache: Do not create duplicate tree entriesShawn Pearce2015-12-292-0/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a file (e.g. "A") and a subtree file (e.g. "A/foo.c") both appear in the DirCache this cache should not be written out as a tree object. The "A" file and "A" subtree conflict with each other in the same tree and will fail fsck. Detect this condition during DirCacheBuilder and DirCacheEditor finish() so the application can be halted early before it updates a DirCache that might later write an invalid tree structure. Change-Id: I95660787e88df336297949b383f4c5fda52e75f5
| * | | DirCacheEditor: Replace file-with-tree and tree-with-fileShawn Pearce2015-12-294-9/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a PathEdit tries to store a file where a subtree was, or a subtree where a file was, replace the entry in the DirCache with the new name(s). This supports switching between file and tree entry types using a DirCacheEditor. Add new unit tests to cover the conditions where these can happen. Change-Id: Ie843d9388825f9e3d918a5666aa04e47cd6306e7
| * | | AddCommand: Use NameConflictTreeWalk to identify file-dir changesShawn Pearce2015-12-296-9/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding a path that already exists but is changing type such as from symlink to subdirectory requires a NameConflictTreeWalk to match up the two different entry types that share the same name. NameConflictTreeWalk needs a bug fix to pop conflicting entries when PathFilterGroup aborts the walk early so that it does not allow DirCacheBuilderIterator to copy conflicting entries into the output cache. Change-Id: I61b49cbe949ca8b4b98f9eb6dbe7b1f82eabb724
* | | | Fix "remote: Counting objects: ..." formattingShawn Pearce2015-12-311-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trailing whitespace is usually removed in properties files so JGitText did not supply a space between : and the remote message. Ensure the space exists at runtime by reading the localized string and appending a space if it is missing. Messages should be dynamically fetched and not held in a static class variable, as they can be changed using thread locals. Change-Id: If6a3707d64094253b1a5304fbfafcf195db7497a
* | | | Implement Buck driven buildDavid Ostrovsky2015-12-311-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Today there are plenty of modern build tool systems available in the wild (in no particular order): * http://bazel.io * https://pantsbuild.github.io * http://shakebuild.com * https://ninja-build.org * https://buckbuild.com The attributes, that all these build tools have in common, are: * reliable * correct * very fast * reproducible It must not always be the other build tool, this project is currently using. Or, quoting Gerrit Code Review maintainer here: "Friends, don't let friends use <the other build tool system>!" This change is non-complete implementation of JGit build in Buck, needed by Gerrit Code Review to replace its dependency with standlone JGit cell. This is very useful when a developer is working on both projects and is trying to integrate changes made in JGit in Gerrit. The supported workflow is: $ cd jgit $ emacs <hack> $ cd ../gerrit $ buck build --config repositories.jgit=../jgit gerrit With --config repositories.jgit=../jgit jgit cell is routed through JGit development tree. To build jgit, issue: $ buck build //:jgit [-] PROCESSING BUCK FILES...FINISHED 0,0s Yes, you can't measure no-op build time, given that Buck daemon is used. Change-Id: I301a71b19fba35a5093d8cc64d4ba970c2877a44 Signed-off-by: David Ostrovsky <david@ostrovsky.org>
* | | | Merge "Fix encoding problem from curl repostory on github"Shawn Pearce2015-12-301-0/+1
|\ \ \ \
| * | | | Fix encoding problem from curl repostory on githubEryk Szymanski2015-12-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pushing curl repository to gerrit fails with a message: remote: error: internal error while processing changes java.nio.charset.IllegalCharsetNameException: 'utf8' curl repository url: https://github.com/bagder/curl.git To avoid this problem encodingAliases in RawParseUtils have been extended to contain "'utf8'" (single quoted utf8) string. Change-Id: I40f613cfdcabf0dc9455bee45116ab8d8c7dd6ee Signed-off-by: Eryk Szymanski <eryksz@gmail.com>
* | | | | Merge "Fix hanging fetch via SSH"Shawn Pearce2015-12-301-5/+17
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | Fix hanging fetch via SSHDmitry Neverov2015-08-241-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signaling the need to flush() only via the interrupted status of a copying thread doesn't work realiably with jsch. The write() method of com.jcraft.jsch.Session catches the InterruptedException in several places. As a result StreamCopyThread can easily miss the interrupt if it was interrupted during the dst.write() or dst.flush() call. When it happens, StreamCopyThread will not send some data to the remote side and will not get the response back, because remote side will wait for more data from us. The flushCount field incremented during flush() method guarantees we don't miss flush() even if jsch catches InterruptedException in dst.write() or dst.flush() calls. Checking the flushCount after dst.write() is needed because dst.write() can clear interrupt status, in this case the next blocking src.read() won't throw an exception and we will not call flush(). Flush is performed only after src.read() was blocked and thrown an InterruptedIOException exception, this guarantees that we flush all the data available in src so far (src.read() doesn't block while more is available). FlushCount is reset to 0 only when there were no flush() calls since last blocked read, that means we flushed all data available in src. If there were flush() calls, the interrupt status is restored, so next blocked read will throw InterruptedException and we will flush() again. Change-Id: I692b226edaff502f06235ec05da9052b5fe6478a Signed-off-by: Dmitry Neverov <dmitry.neverov@gmail.com>