summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | | | Rename files using NIO2 atomic renameMatthias Sohn2015-12-308-97/+112
| |_|/ |/| | | | | | | | | | | Bug: 319233 Change-Id: I5137212f5cd3195a52f90ed5e4ce3cf194a13efd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | ObjectChecker: use java.text.Normalizer directlyShawn Pearce2015-12-301-55/+2
| | | | | | | | | | | | | | | | | | | | | | | | Base Java version for JGit is now Java 7. The java.text.Normalizer class was available in Java 6. Reflection is no longer required to normalize strings for Mac OS X. Change-Id: I98e14b72629a7a729a2d40a3aa275932841274e8
* | | Merge changes I3db332bf,I614e7110,I37a4ccd6,I86b81e7f,Ic8b362e0, ...Shawn Pearce2015-12-301-1/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * changes: Sort "eager" path-like options to the end of the help reset command: provide convenient and meaningful options help commit command: allow to specify path(s) argument(s) status command: consume more then one argument after -- repo command: properly name the required 'path' argument Un-ignored existing CLI tests which run just fine on Java 7+ Don't treat command termination due '-h' option as a fatal error
| * | | commit command: allow to specify path(s) argument(s)Andrey Loskutov2015-12-291-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the command below: jgit commit a -m "added file a" which currently fails with: org.eclipse.jgit.api.errors.JGitInternalException: The combination of arguments --all and --only is not allowed Bug: 484973 Change-Id: I37a4ccd68101a66520ef99110f7aa0cbdcc8beba Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | | Unify fetch and receive ObjectChecker setupShawn Pearce2015-12-292-49/+36
| | | | | | | | | | | | | | | | | | | | | | | | This avoids duplication of code between receive-pack and fetch-pack paths. Separate methods are still required to check use of receive.fsckobjects vs. fetch.fsckobjects, both of which default to transfer.fsckobjects. Change-Id: I41193e093e981a79fc2f63914e273aaa44b82162
* | | PackWriter: use lib.ObjectIdSet to avoid wrapperShawn Pearce2015-12-298-50/+92
|/ / | | | | | | | | | | | | | | | | | | | | | | Hoist ObjectIdSet up to lib as part of the public API and add the interface to some common types like PackIndex and JGit custom ObjectId map types. This cleans up wrapper code in a number of places by allowing direct use of the types as an ObjectIdSet. Future commits can now rely on ObjectIdSet as a simple read-only type to check a set of objects from a number of storage options. Change-Id: Ib62b062421d475bd52abd6c84a73916ef36e084b
* | Simplify development of commands: added main() to CLIGitCommandAndrey Loskutov2015-12-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This will execute git commands (with arguments) specified on the command line, handy for developing/debugging a sequence of arbitrary git commands working on same repository. The git working dir path can be specified via Java system property "git_work_tree". If not specified, current directory will be used. Change-Id: I621a9ec198c31e28a383818efeb4b3f835ba1d6f Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | DirCacheEditor: Cleanup DeleteTree constructorShawn Pearce2015-12-281-4/+5
| | | | | | | | | | | | | | | | Neaten up formatting and avoid strings, which prevents the need for NLS comment tags. Instead check the last character using char literal, and append a char literal instead of a string. Change-Id: Ib68e017769a1f5c03200354a805769d585a48c8b
* | DirCacheEditor: Fix formatting to avoid , at start of lineShawn Pearce2015-12-281-3/+5
| | | | | | | | Change-Id: I1b1d614470c67fe4736fdc9c26ae26fb38dd58b5
* | Merge "AddCommand: Avoid unnecessary string conversions"Shawn Pearce2015-12-281-11/+17
|\ \
| * | AddCommand: Avoid unnecessary string conversionsShawn Pearce2015-12-231-11/+17
| | | | | | | | | | | | Change-Id: I13634caeccd9f675a86adfdfa94099b6fb75463a
* | | Merge "AddCommand: Cleanup conditional logic"Christian Halstrick2015-12-281-49/+54
|\| |
| * | AddCommand: Cleanup conditional logicShawn Pearce2015-12-231-49/+54
| | | | | | | | | | | | | | | | | | Unnest and simplify conditional logic for handling entries. Change-Id: I3093cab5f0edfaf3efbbd6c644e9c922edc67d38
* | | Close copy threads in case of errorsDmitry Neverov2015-12-241-1/+14
|/ / | | | | | | | | | | Bug: 484775 Change-Id: I3c7105188e615b6b994261f4ece0c8abc98eb444 Signed-off-by: Dmitry Neverov <dmitry.neverov@gmail.com>
* | Skip nested copyfiles in RepoCommand.Yuxuan 'fishy' Wang2015-12-222-1/+54
| | | | | | | | | | | | | | | | Similar to nested directories, nested copyfiles won't work with git submodule either. Change-Id: Idbe965ec20a682fca0432802858162f8238f05de Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
* | Checkout should be able to override modified symbolic linksAndrey Loskutov2015-12-171-1/+3
| | | | | | | | | | | | | | | | | | Handle existing symlink as a file, not as directory if deleting a file before creating (overriding) a symlink. Bug: 484491 Change-Id: I29dbf57d1daec2ba98454975b093e1d381d05196 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | Merge "ProgressSpinner: Simple busy wait entertainment"Shawn Pearce2015-12-161-0/+149
|\ \
| * | ProgressSpinner: Simple busy wait entertainmentShawn Pearce2015-12-161-0/+149
| | | | | | | | | | | | | | | | | | | | | Keep a user amused while the server does work by spinning a little ASCII-art object on a single line. Change-Id: Ie8f181d1aa606d4ae69e5d3ca4db387cea739f38
* | | Included cached deltas in delta packStatistics.James Kolb2015-12-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Previously, non-reuse deltas were only included in packStatistics if they were not cached by the deltaWindow. Change-Id: I7684d8214875f0a7569b34614f8a3ba341dbde9c Signed-off-by: James Kolb <jkolb@google.com>
* | | Merge changes Ib4d53bdd,I55bd512cJonathan Nieder2015-12-162-5/+8
|\ \ \ | | | | | | | | | | | | | | | | | | | | * changes: Do not let PathFilter.create("a/b") match 'a' unless 'a' is a subtree Add tests for PathFilterGroup.Single
| * | | Do not let PathFilter.create("a/b") match 'a' unless 'a' is a subtreeJonathan Nieder2015-12-152-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PathFilter and PathFilterGroup form JGit's implementation of git's path-limiting feature in commands like log and diff. To save time when traversing trees, a path specification foo/bar/baz tells the tree walker not to traverse unrelated trees like qux/. It does that by returning false from include when the tree walker is visiting qux and true when it is visiting foo. Unfortunately that test was implemented to be slightly over-eager: it doesn't only return true when asked whether to visit a subtree "foo" but when asked about a plain file "foo" as well. As a result, diffs and logs restricted to some-file/non-existing-suffix unexpectedly match against some-file: $ jgit log -- LICENSE/no-such-file commit 629fd0d594d242eab26161b0dac34f7576fd4d3d Author: Shawn O. Pearce <spearce@spearce.org> Date: Fri Jul 02 14:52:49 2010 -0700 Clean up LICENSE file [...] Fix it by checking against the entry's mode. Gitiles +log has the same bug and benefits from the same fix. Callers know not to worry about what subtrees are included in the tree walk because shouldBeRecursive() returns true in this case, so this behavior change should be safe. This also better matches the behavior of C git: $ empty=$(git mktree </dev/null) $ git diff-tree --abbrev $empty HEAD -- LICENSE/no-such-file $ git diff-tree --abbrev $empty HEAD -- tools/no-such-file :000000 040000 0000000... b62648d... A tools Bug: 484266 Change-Id: Ib4d53bddd8413a9548622c7b25b338d287d8889d
* | | | Merge "Fix InterruptTimer leak in BasePackConnection"Shawn Pearce2015-12-161-1/+3
|\ \ \ \
| * | | | Fix InterruptTimer leak in BasePackConnectionMatthias Sohn2015-12-161-1/+3
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When setting timeout on push, BasePackConnection creates a timer, which will be terminated when push finishes. But, when using SmartHttpPushConnection, it dropped the first timer created in the constructor and then created another timer in doPush. If new threads are created faster than the gc collects then this may stop the service if it's hitting the max process limit. Hence don't create a new timer if it already exists. Bug: 474947 Change-Id: I6746ffe4584ad919369afd5bdbba66fe736be314 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Merge "Refspec: loosen restrictions on wildcard "*""Shawn Pearce2015-12-151-4/+0
|\ \ \ \
| * | | | Refspec: loosen restrictions on wildcard "*"Marc Strapetz2015-10-211-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Git 2.6 wildcard restrictions for refspecs have been loosened: refspecs like "refs/heads/*foo:refs/heads/foo*" are valid now. See Git commit 8d3981ccbed9fc211b4e67105015179d9d2a5692 Change-Id: Icb78afbd282c425173b3a7bc10eadc4015689bb8 Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
* | | | | Merge "BaseRepositoryBuilder should trim CR from .git symref"Shawn Pearce2015-12-151-1/+2
|\ \ \ \ \
| * | | | | BaseRepositoryBuilder should trim CR from .git symrefMarc Strapetz2015-11-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I909c2892100da89f6670ffbf3442f11c9cb7b008 Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
* | | | | | Merge "Fix possible arithmetic overflow when setting a timeout"Shawn Pearce2015-12-151-1/+2
|\ \ \ \ \ \
| * | | | | | Fix possible arithmetic overflow when setting a timeoutChristian Halstrick2015-12-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BasePackPushConnection#readStringLongTimeout() was setting a timeout 10 times bigger than some other timeout or the pack transfer time. This could lead to negative integer values when we hit an arithmetic overflow. Add a check for this situation and set the timeout to Integer.MAX_VALUE when overflow happens. Bug: 484352 CC: Eugene Petrenko <eugene.petrenko@gmail.com> Change-Id: Ie2a86312c1bcb1ec3e6388fa490ab3c845d41808
* | | | | | | Merge "Accept UTF8 BOM with BlobBasedConfig"Shawn Pearce2015-12-151-1/+9
|\ \ \ \ \ \ \
| * | | | | | | Accept UTF8 BOM with BlobBasedConfigDoug Kelly2015-12-091-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In I1f5dc07182dbf6bba2a9f4807fdd25b475da4ead, FileBasedConfig got support for reading a configuration with UTF8 BOM. Apply the same support to BlobBasedConfig, to make SubmoduleWalk able to parse .gitmodules configurations with BOM. Change-Id: I25b5474779952fe2c076180b96fc2869eef190a8 Signed-off-by: Doug Kelly <dougk.ff7@gmail.com>
* | | | | | | | Merge "Bug 484342: Support @ in username in SSH url."Shawn Pearce2015-12-151-1/+1
|\ \ \ \ \ \ \ \ | |_|_|_|_|/ / / |/| | | | | | |
| * | | | | | | Bug 484342: Support @ in username in SSH url.Mike Gilbode2015-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I5795e925afff796488ba26c83694e806b76a374f Signed-off-by: Mike Gilbode <gilbode@gmail.com>
* | | | | | | | Fix push with jgit pgm failing with "unauthorized"Matthias Sohn2015-12-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pushing with JGit commandline to e.g. Github failed with "unauthorized" since HttpUrlConnection calls the configured authenticator implicitly. The problem is that during a push two requests are sent to the server, first a GET and then a POST (containing the pack data). The first GET request sent anonymously is rejected with 401 (unauthorized). When an Authenticator is installed the java.net classes will use the Authenticator to ask the user for credentials and retry the request. But this happens under the hood and JGit level code doesn't see that this happens. The next request is the POST but since JGit thinks the first GET request went through anonymously it doesn't add authentication headers to the POST request. This POST of course also fails with 401 but since this request contains a lot of body-data streamed from JGit (the pack file!) the java.net classes can't simply retry the request with authorization headers. The whole process fails. Fix this by using Apache httpclient which doesn't use Authenticator to retrieve credentials. Instead initialize TransportCommand to use the default credential provider if no other credentials provider was set explicitly. org.eclipse.jgit.pgm.Main sets this default for the JGit command line client. Change-Id: Ic4e0f8b60d4bd6e69d91eae0c7e1b44cdf851b00 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>