aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* buck: build standalone jgit binaryShawn Pearce2015-12-315-0/+105
| | | | | | | | | | Construct the java_application JAR wrapped with the shell script header. This is enough to clone a repository over HTTPs: $ buck build :jgit_bin $ buck-out/gen/jgit_bin/jgit_bin clone https://... Change-Id: I4aceb4e77b2ec9be76a32ec93d94f2dafe9acce6
* Implement Buck driven buildDavid Ostrovsky2015-12-319-0/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Make sure tests don't blindly continue if a command is "silently" failedAndrey Loskutov2015-12-3110-29/+59
| | | | | | | | | | | | | | | | | | | | | | Make the default execute() function fail fast on first command printed "fatal: " to output. Introduced executeUnchecked() for few tests which wanted to test fatal output. Change-Id: I5b09aad9443515636811fc4d00bf8b8b9587a626 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | 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-3017-47/+437
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * | Sort "eager" path-like options to the end of the helpAndrey Loskutov2015-12-293-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "--" path option (and all other similar options consuming all remaining arguments) should be placed at the end of the command line help. Currently jgit reset -h shows this: jgit reset [commit-ish] [path ... ...] [-- path ... ...] [--hard] [--help (-h)] [--mixed] [--soft] After the patch the help shows this: jgit reset [commit-ish] [path ... ...] [--hard] [--help (-h)] [--mixed] [--soft] [-- path ... ...] Bug: 484951 Change-Id: I3db332bf293ca8d6bfaab0d546cd35af689bd46e Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | reset command: provide convenient and meaningful options helpAndrey Loskutov2015-12-293-10/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the jgit "reset" command line options help from this: jgit reset name [VAL ...] [-- path ... ...] [--hard] [--help (-h)] [--mixed] [--soft] name : Reset current HEAD to the specified state [...] to this: jgit reset [commit-ish] [path ... ...] [-- path ... ...] [--hard] [--help (-h)] [--mixed] [--soft] commit-ish : Reset to given reference name [...] Bug: 484951 Change-Id: I614e71101b4f9f46ef8f02379d1a9d135f3292d2 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | commit command: allow to specify path(s) argument(s)Andrey Loskutov2015-12-292-1/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | status command: consume more then one argument after --Andrey Loskutov2015-12-291-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | See bug 484951 comment 4: "jgit status -- a b" doesn't work and complains that "b" is not an allowed argument Bug: 484951 Change-Id: I86b81e7f2bab6e928bb8e973bd50c8f4b9c6fecf Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | repo command: properly name the required 'path' argumentAndrey Loskutov2015-12-292-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes point 4 in bug 484951, where "jgit repo" or "jgit repo -h" dumps a stack trace. Bug: 484951 Change-Id: Ic8b362e07a40ad923dc9acde0c0983a1e7932a02 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | Un-ignored existing CLI tests which run just fine on Java 7+Andrey Loskutov2015-12-292-13/+2
| | | | | | | | | | | | | | | Change-Id: I5ef334a49fb2d88d5e856b443687f3dcb126a77a Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | Don't treat command termination due '-h' option as a fatal errorAndrey Loskutov2015-12-296-20/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signal early command termination due '-h' or '--help' option via TerminatedByHelpException. This allows tests using CLIGitCommand differentiate between unexpected command parsing errors and expected command cancellation "on help" (which also allows validation of expected/unexpected help messages). Additional side-effect: jgit supports now git style of handling help option: any unexpected command line options before help are reported as errors, but after help ignored. Bug: 484951 Change-Id: If45c41c0d32895ab6822a7ff9d851877dcef5771 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-299-62/+95
|/ / | | | | | | | | | | | | | | | | | | | | | | 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
* | Provide a root cause for aborted commandsAndrey Loskutov2015-12-292-1/+29
| | | | | | | | Change-Id: Iafaa03dbacbe7f1b2b074d3294db988b08fdb0d7 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | Simplify development of commands: added main() to CLIGitCommandAndrey Loskutov2015-12-284-2/+44
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Allow checkout paths without specifying branch nameAndrey Loskutov2015-12-283-4/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JGit CLI should allow to do this: checkout -- <path> Currently, even if "a" is a valid path in the git repo, jgit CLI can't checkout it: $jgit checkout -- a error: pathspec 'a' did not match any file(s) known to git. The fix also fixes at same time "unnamed" zombie "[VAL ...]" argument shown on the command line. Before fix: $jgit -h jgit checkout name [VAL ...] [-- path ... ...] [--force (-f)] [--help (-h)] [--orphan] [-b] After fix: $jgit -h jgit checkout [name] [-- path ... ...] [--force (-f)] [--help (-h)] [--orphan] [-b] Bug: 475765 Change-Id: I2b0e77959a72e4aac68452dc3846adaa745b0831 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | | 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-223-2/+60
| | | | | | | | | | | | | | | | 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>
* | Remove unused import 'org.apache.commons.codec.binary'RĂ¼diger Herrmann2015-12-181-2/+1
| | | | | | | | | | Change-Id: I7db35f4360e29d006d1e4e6ccfaa78ae598e3b4e Signed-off-by: RĂ¼diger Herrmann <ruediger.herrmann@gmx.de>
* | Checkout should be able to override modified symbolic linksAndrey Loskutov2015-12-173-9/+86
| | | | | | | | | | | | | | | | | | 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-162-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | 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-163-38/+125
|\ \ \ | | | | | | | | | | | | | | | | | | | | * 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-153-11/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Add tests for PathFilterGroup.SingleJonathan Nieder2015-12-151-33/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expand the existing PathFilterGroup tests to check which paths the tree entry matches. This expands test coverage by ensuring that PathFilterGroup's simpler code path to match against a single PathFilter works correctly. While at it, move the check on tree entry d/e/f/g.y into two separate tests: one to check that it doesn't match any of the configured paths, and another to check that it does not throw StopWalkException to end the walk early. Change-Id: I55bd512cd049fc2018659e2f86a4b8650f171fda
* | | | 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 "Fix NPE in HttpSupport"Shawn Pearce2015-12-161-13/+14
|\ \ \ \
| * | | | Fix NPE in HttpSupportMatthias Sohn2015-12-161-13/+14
| |/ / / | | | | | | | | | | | | | | | | Bug: 483366 Change-Id: I107f1b44e0e6371e3cfbd1cc18a970412e1fc679 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Merge "Refspec: loosen restrictions on wildcard "*""Shawn Pearce2015-12-152-19/+35
|\ \ \ \
| * | | | Refspec: loosen restrictions on wildcard "*"Marc Strapetz2015-10-212-19/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>