summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* branch command: provide convenient and meaningful options helpAndrey Loskutov2016-01-026-44/+330
| | | | | | | Added tests for all options, fixed multi-valued options parsing. Bug: 484951 Change-Id: I5558589049544ea6c84932bc01f1f9df09e1f682 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Simplify pgm tests: allow varargs and trim output for toString()Andrey Loskutov2016-01-022-24/+27
| | | | | Change-Id: Ia5bcd9e560b90cf872fef75c2800c889ef1cc85a Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Fixed few locale dependent pgm testsAndrey Loskutov2016-01-024-5/+75
| | | | | | See https://dev.eclipse.org/mhonarc/lists/jgit-dev/msg03040.html Change-Id: If51f3c750684d82cb6443f1578636c9f5ca56e2b Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* buck: set vm_args for testsShawn Pearce2016-01-012-0/+2
| | | | | | | | Maven pom files force the local encoding to UTF-8 to ensure there are no differences between machines. They also set the JVM max heap to 256m. Match both in Buck so that results are consistent. Change-Id: Ice5476dd09352a444a0c97aa0dc28806fddf2ab4
* buck: pin to stable versionShawn Pearce2016-01-011-0/+1
| | | | | | | | Like with Gerrit, pin JGit to a single version of Buck that is known to work with current Buck files and JUnit tests. Notably a more recent version of Buck used by Gerrit (01a0c54d827) fails WalkEncryptionTest. Change-Id: I6b94c332e4bde97a1910f48cf12eb8698f97d540
* Merge changes from topic 'add-df'Shawn Pearce2016-01-0114-23/+638
|\ | | | | | | | | | | | | * 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-293-0/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-296-13/+246
| | | | | | | | | | | | | | | | | | | | | | 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-297-10/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | clone: display progress messagesShawn Pearce2015-12-311-5/+16
| | | | | | | | | | | | Also support -q/--quiet flag to disable progress. Change-Id: I979277502c990f6dec052d095461c996ff8fe577
* | buck: run testsShawn Pearce2015-12-315-1/+160
| | | | | | | | | | | | | | | | | | | | | | | | Compile each test in its own java_test() target so they can run in parallel, reducing total time spent testing on large machines. $ buck test --all [-] PROCESSING BUCK FILES...FINISHED 0.3s [100%] [-] BUILDING...FINISHED 2.9s [100%] (351/383 JOBS, 351 UPDATED, 0.0% CACHE MISS) [-] TESTING...FINISHED 98.1s (3360 PASS/15 SKIP/0 FAIL) Change-Id: I8d6541268315089299f933ed23d785b1b3431133
* | 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