summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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
|\ \
| * | buck: set Bundle-Version for :jgit_binShawn Pearce2016-01-032-3/+37
| | | | | | | | | | | | | | | | | | | | | Run git describe during the build to determine the lineage of this working directory and stamp this information into the binary. Change-Id: I0ad24125c31e4280ccf900bac4065924087b05aa
* | | Merge changes Idaed9310,I62bd7c0bMatthias Sohn2016-01-0310-1049/+1279
|\ \ \ | | | | | | | | | | | | | | | | | | | | * changes: ObjectChecker: honor some git-core fsck.* options ObjectChecker: allow some objects to skip errors
| * | | ObjectChecker: honor some git-core fsck.* optionsShawn Pearce2015-12-307-202/+597
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-307-930/+765
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | 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>