Skip to main content
aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2016-01-21Prepare 4.3.0-SNAPSHOT buildsMatthias Sohn3-38/+38
Change-Id: Idcf0479529693b023042becd96698f9afd344bd4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-21Merge changes from topic 'reftree'Shawn Pearce1-4/+27
* changes: debug-rebuild-ref-tree: Copy HEAD into RefTree debug-rebuild-ref-tree: Add --enable flag to turn the database on RefTreeDatabase: Allow ORIG_HEAD, etc. on non-bare repositories RefTreeDatabase: Expose bootstrap refs in getAdditionalRefs
2016-01-20daemon: Add --ketch=LEADER flagShawn Pearce2-1/+47
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
2016-01-20Merge branch 'stable-4.2'David Pursehouse15-63/+70
* 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>
2016-01-19Add $NON-NLS to suppress "Non-externalized string literal" warningsDavid Pursehouse9-40/+40
Change-Id: I3e6f83ad2bc7d493e2c1ab5a8c60affa2b49c386 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-19Don't use deprecated constructors of CmdLineExceptionDavid Pursehouse6-22/+29
Change-Id: If01fa896537209821d6a7a262ee978572195a397 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-19Merge "Prepare 4.2.0-SNAPSHOT builds" into stable-4.2Matthias Sohn3-4/+4
2016-01-19Prepare 4.2.0-SNAPSHOT buildsMatthias Sohn3-4/+4
Change-Id: Ibe38a95bf36db0c0ed948280b28c416943ec0329 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-15debug-rebuild-ref-tree: Copy HEAD into RefTreeShawn Pearce1-4/+13
HEAD is not part of getRefs(ALL) and must be copied explicitly. This allows `jgit debug-rebuild-ref-tree --enable` to convert an existing repository to use RefTree with a local working tree: mkdir testRepo cd testRepo jgit init jgit debug-rebuild-ref-tree --enable touch a jgit add a jgit commit -m initial Change-Id: I46cbc2611b9ae683ef7319dc46af277925dfaee5
2016-01-15debug-rebuild-ref-tree: Add --enable flag to turn the database onShawn Pearce1-0/+14
Change-Id: Iad8ebdb0c4c0ad6dcd2b12dd56ffe1be6a20840f
2016-01-14RevParse: Remove superfluous semicolonDavid Pursehouse1-1/+1
Change-Id: I5975bc58d7933dafb3e7a8d891e9f6878b98a9a1 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-11FileRepository: Support extensions.refsBackendType = RefTreeShawn Pearce1-7/+22
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
2016-01-08Merge changes from topic 'reftree'Shawn Pearce4-0/+134
* changes: debug-rebuild-ref-tree: Simple program to build a RefTree RefTree: Store references in a Git tree
2016-01-07debug-rebuild-ref-tree: Simple program to build a RefTreeShawn Pearce4-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
2016-01-06Make sure CLIGitCommand and Main produce (almost) same resultsAndrey Loskutov1-35/+76
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>
2016-01-06branch command: print help if requested, even if arguments are wrongAndrey Loskutov2-4/+37
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>
2016-01-06Added CLIText.fatalError(String) API for testsAndrey Loskutov3-5/+18
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>
2016-01-03Merge "buck: set Bundle-Version for :jgit_bin"Shawn Pearce1-3/+28
2016-01-03buck: set Bundle-Version for :jgit_binShawn Pearce1-3/+28
Run git describe during the build to determine the lineage of this working directory and stamp this information into the binary. Change-Id: I0ad24125c31e4280ccf900bac4065924087b05aa
2016-01-02branch command: provide convenient and meaningful options helpAndrey Loskutov5-36/+154
Added tests for all options, fixed multi-valued options parsing. Bug: 484951 Change-Id: I5558589049544ea6c84932bc01f1f9df09e1f682 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2016-01-01clone: display progress messagesShawn Pearce1-5/+16
Also support -q/--quiet flag to disable progress. Change-Id: I979277502c990f6dec052d095461c996ff8fe577
2016-01-01buck: run testsShawn Pearce1-0/+1
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
2016-01-01buck: build standalone jgit binaryShawn Pearce1-0/+44
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
2015-12-29Sort "eager" path-like options to the end of the helpAndrey Loskutov1-0/+36
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>
2015-12-29reset command: provide convenient and meaningful options helpAndrey Loskutov2-5/+6
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>
2015-12-29status command: consume more then one argument after --Andrey Loskutov1-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>
2015-12-29repo command: properly name the required 'path' argumentAndrey Loskutov1-1/+1
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>
2015-12-29Don't treat command termination due '-h' option as a fatal errorAndrey Loskutov4-18/+157
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>
2015-12-29Provide a root cause for aborted commandsAndrey Loskutov2-1/+29
Change-Id: Iafaa03dbacbe7f1b2b074d3294db988b08fdb0d7 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2015-12-28Allow checkout paths without specifying branch nameAndrey Loskutov1-4/+3
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>
2015-12-18Remove unused import 'org.apache.commons.codec.binary'RĂ¼diger Herrmann1-2/+1
Change-Id: I7db35f4360e29d006d1e4e6ccfaa78ae598e3b4e Signed-off-by: RĂ¼diger Herrmann <ruediger.herrmann@gmx.de>
2015-12-15Fix push with jgit pgm failing with "unauthorized"Matthias Sohn3-1/+17
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>
2015-12-15Null-annotated Ref class and fixed related compiler errorsAndrey Loskutov2-4/+13
This change fixes all compiler errors in JGit and replaces possible NPE's with either appropriate exceptions, avoiding multiple "Nullable return" method calls or early returning from the method. Change-Id: I24c8a600ec962d61d5f40abf73eac4203e115240 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2015-12-14JGit v4.2.0.201512141825-rc1v4.2.0.201512141825-rc1Matthias Sohn3-4/+4
Change-Id: Id725ea888acd23793d37de2864ec0727160a2eaf Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-12-11Add remote command to JGit CLIKaloyan Raev4-0/+202
Supported subcommands are: - <none> (lists available remotes) - add - remove - set-url - update Supported options are: --verbose --push --prune Bug: 481316 Change-Id: I57c34ed6daabb7d308bc383b17c1ef4af433e714 Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-12-03Support atomic push in JGit clientShawn Pearce1-0/+4
This should mirror the behavior of `git push --atomic` where the client asks the server to apply all-or-nothing. Some JGit servers already support this based on a custom DFS backend. InMemoryRepository is extended to support atomic push for unit testing purposes. Local disk server side support inside of JGit is a more complex animal due to the excessive amount of file locking required to protect every reference as a loose reference. Change-Id: I15083fbe48447678e034afeffb4639572a32f50c
2015-11-25Null-annotated Repository class and fixed related compiler errorsAndrey Loskutov8-11/+33
org.eclipse.jgit.lib.Repository class is an example of the API which should be written with Java 8 java.util.Optional<T> type. Unfortunately this API is already released and widely used. The good clients are currently doing their best with checking return values for null and bad clients do not know how bad their code is. I've tried not to change any logic and to be as less intrusive as possible. Most of the JGit code was well prepared to this, only few classes needed some smaller fixes. This change fixes all compiler errors in JGit and replaces possible NPE's with either appropriate exceptions, avoiding multiple "Nullable return" method calls or early returning from the method. Because annotating getDirectory() and getFS() as Nullable would cause lot of additional changes in JGit and EGit they are postponed. Change-Id: Ie8369d2c9c5fac5ce83b3b1b9bc217d7b55502a3 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2015-11-19git rev-parse: Add --verify optionThomas Meyer3-3/+17
Add the --verify option to be more compatible with git Change-Id: I225a36ecc4711fd2eb9af67ca8fb79681d94c587 Signed-off-by: Thomas Meyer <thomas.mey@web.de>
2015-11-09Update dependencies to use the JGit-internal @NullableTerry Parker2-4/+3
Update the project-specific Eclipse settings to replace the use of the org.eclipse.jdt.annotation.Nullable class the new JGit-specific @Nullable annotation. I verified that Eclipse reports errors when the return value of a method annotated with @org.eclipse.jgit.annotations.Nullable is dereferenced without a null check. Also remove the Maven and MANIFEST.MF dependencies on org.eclipse.jdt.annotation. Eclipse null analysis uses three annotations: @Nullable, @NonNull and @NonNullByDefault. All three are updated in this patch because it is invalid to set the Eclipse preferences to empty values. So far only @Nullable has been introduced in org.eclipse.jgit.annotations. My personal preference is to follow the advice in Effective Java and avoid the null-return idiom, and to avoid passing null values in general. This sets the expectation is that arguments and return types are assumed non-null unless otherwise documented. If that is the expectation, then consistent application of @NonNull is redundant and hurts readability by cluttering the code, obscuring the occasional @Nullable annotation that really requires attention. If the JGit community decides there is value in using the @NonNull and @NonNullByDefault annotations we can add them--this change configures Eclipse to use them. Change-Id: I9af1b786d1b44b9b0d9c609480dc842df79bf698 Signed-off-by: Terry Parker <tparker@google.com>
2015-10-29reset command should support the -- <paths> parametersKaloyan Raev1-11/+24
Bug: 480750 Change-Id: Ia85b1aead03dcf2fcb50ce0391b656f7c60a08d4 Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
2015-10-05Merge "RepoCommand: Add setRecordRemoteBranch option to record upstream branch"Jonathan Nieder2-0/+5
2015-10-05RepoCommand: Add setRecordRemoteBranch option to record upstream branchStefan Beller2-0/+5
On a server also running Gerrit that is using RepoCommand to convert from an XML manifest to a git submodule superproject periodically, it would be handy to be able to use Gerrit's submodule subscription feature[1] to update the superproject automatically between RepoCommand runs as changes are merged in each subprojects. This requires setting the 'branch' field for each submodule so that Gerrit knows what branch to watch. Add an option to do that. Setting the branch field also is useful for plain Git users, since it allows them to use "git submodule update --remote" to manually update all submodules between RepoCommand runs. [1] https://gerrit-review.googlesource.com/Documentation/user-submodules.html Change-Id: I1a10861bcd0df3b3673fc2d481c8129b2bdac5f9 Signed-off-by: Stefan Beller <sbeller@google.com>
2015-10-01Merge branch 'stable-4.1'Matthias Sohn20-292/+320
* stable-4.1: pgm: Open RevWalk and TreeWalk in try-with-resource ant: Open Repository and Git in try-with-resource pgm: Create instances of Git in try-with-resource FanoutBucket: Create ObjectInserter.Formatter in try-with-resource Fix compiler warnings in DiffFormatter.writeGitLinkText Change-Id: I448ecc9a1334977d9f304dd61ea20c7a8e692b10 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-10-01pgm: Open RevWalk and TreeWalk in try-with-resourceDavid Pursehouse8-79/+87
To prevent potential resource leaks. Change-Id: I2039af04d9fb75405f8e13abf508623b7d4ef324 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2015-10-01pgm: Create instances of Git in try-with-resourceDavid Pursehouse14-215/+235
To prevent potential resource leak. Change-Id: I8ac4ae61193324849bafb46501a55f93c5029a4e Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2015-09-28Prepare 4.2.0-SNAPSHOT buildsMatthias Sohn3-35/+35
Change-Id: If559d3565b1f84c93a533e1ce18d5293605d1950 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-09-28Prepare 4.1.1-SNAPSHOT buildsMatthias Sohn3-35/+35
Change-Id: I035f3a8d0f0de86e8b8f00e668be5ce008402e82 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-09-28JGit v4.1.0.201509280440-rv4.1.0.201509280440-rMatthias Sohn3-4/+4
Change-Id: I9a536870b9f5c1247c52d6c976a954115982fa1c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-08-31Restore lazy Bundle-ActivationPolicy removed in 3a4a5a4eMatthias Sohn1-0/+1
This header was removed unintentionally from some bundles in 3a4a5a4e57f41c595ba950ea6f6680260669bf34. Restore it to ensure lazy activation of bundles. Change-Id: I1f841f978fb93278e3ec0533a01f1363510dd976 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-08-31Update uses-clauses in OSGi manifestsMatthias Sohn1-3/+6
In Bug 476164 it was reported that EGit doesn't start when the platform comes with jsch 0.1.51 while this version of EGit/JGit brings jsch 0.1.53. This could be caused by outdated uses-clauses. Hence recompute them using PDE tooling. Bug: 476164 Change-Id: I185ba097884ead9cd034eba842bd3bf34181a99b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>

Back to the top