summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
Commit message (Collapse)AuthorAgeFilesLines
* Allow checkout paths without specifying branch nameAndrey Loskutov2015-12-281-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>
* 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>
* Fix push with jgit pgm failing with "unauthorized"Matthias Sohn2015-12-153-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>
* Null-annotated Ref class and fixed related compiler errorsAndrey Loskutov2015-12-152-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>
* Add remote command to JGit CLIKaloyan Raev2015-12-114-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>
* Support atomic push in JGit clientShawn Pearce2015-12-021-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
* Null-annotated Repository class and fixed related compiler errorsAndrey Loskutov2015-11-258-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>
* git rev-parse: Add --verify optionThomas Meyer2015-11-193-3/+17
| | | | | | | Add the --verify option to be more compatible with git Change-Id: I225a36ecc4711fd2eb9af67ca8fb79681d94c587 Signed-off-by: Thomas Meyer <thomas.mey@web.de>
* Update dependencies to use the JGit-internal @NullableTerry Parker2015-11-092-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>
* reset command should support the -- <paths> parametersKaloyan Raev2015-10-291-11/+24
| | | | | | Bug: 480750 Change-Id: Ia85b1aead03dcf2fcb50ce0391b656f7c60a08d4 Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
* Merge "RepoCommand: Add setRecordRemoteBranch option to record upstream branch"Jonathan Nieder2015-10-052-0/+5
|\
| * RepoCommand: Add setRecordRemoteBranch option to record upstream branchStefan Beller2015-10-052-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>
* | Merge branch 'stable-4.1'Matthias Sohn2015-10-0220-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>
| * pgm: Open RevWalk and TreeWalk in try-with-resourceDavid Pursehouse2015-10-018-79/+87
| | | | | | | | | | | | | | To prevent potential resource leaks. Change-Id: I2039af04d9fb75405f8e13abf508623b7d4ef324 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
| * pgm: Create instances of Git in try-with-resourceDavid Pursehouse2015-10-0114-215/+235
| | | | | | | | | | | | | | To prevent potential resource leak. Change-Id: I8ac4ae61193324849bafb46501a55f93c5029a4e Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* | Prepare 4.2.0-SNAPSHOT buildsMatthias Sohn2015-09-283-35/+35
|/ | | | | Change-Id: If559d3565b1f84c93a533e1ce18d5293605d1950 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Prepare 4.1.1-SNAPSHOT buildsMatthias Sohn2015-09-283-35/+35
| | | | | Change-Id: I035f3a8d0f0de86e8b8f00e668be5ce008402e82 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* JGit v4.1.0.201509280440-rv4.1.0.201509280440-rMatthias Sohn2015-09-283-4/+4
| | | | | Change-Id: I9a536870b9f5c1247c52d6c976a954115982fa1c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Restore lazy Bundle-ActivationPolicy removed in 3a4a5a4eMatthias Sohn2015-08-311-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>
* Update uses-clauses in OSGi manifestsMatthias Sohn2015-08-311-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>
* Enable annotation based NPE analysis in jgitAndrey Loskutov2015-08-202-4/+5
| | | | | | Bug: 470647 Change-Id: I14d1983bb7c208faeffee0504e0567e38d8a89f3 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Changed default log4j log level from "WARNING" to "WARN"Andrey Loskutov2015-08-111-1/+1
| | | | | | Bug: 474674 Change-Id: I8be8934cf6cb3ee60567b59f8e836475efb780ac Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Fix non-externalized string warning in Main.execute()Matthias Sohn2015-07-241-1/+1
| | | | Change-Id: Ib0404daaf485aa6c8dc6ba0b169b46fb800325e4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Honor also https_proxy environment variableChristian Halstrick2015-07-241-25/+31
| | | | | | | | | In addition to honor the http_proxy variable for setting a proxy for http JGit should also honor the https_proxy variable to set a similar proxy for https traffic Bug: 473365 Change-Id: I1002cb575e26cd842bf81ad751ec7c267b585ce2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'stable-4.0'Jonathan Nieder2015-06-031-10/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.0: Revert "Fix unchecked conversion warning in MergeFormatter" Delete deprecated TemporaryBuffer.LocalFile constructors Delete deprecated FileUtils.setExecute(File, boolean) Delete deprecated WorkingTreeIterator.isModified(DirCacheEntry, boolean) Delete deprecated UploadPackMayNotContinueException Delete deprecated TransferConfig.isFsckObjects() Delete deprecated TextBuiltin.out Delete deprecated Merger.getBaseCommit() Change-Id: Id23a39cc6a3cd122ff1738cb85b7451bbfd8af5f Signed-off-by: Jonathan Nieder <jrn@google.com>
| * Delete deprecated TextBuiltin.outMatthias Sohn2015-06-031-10/+0
| | | | | | | | Change-Id: I184c2f0e0203fa95e0a117391bae93da0d23a435 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Prepare post 4.0-RC3 buildsMatthias Sohn2015-06-023-4/+4
| | | | | | | | | | Change-Id: I74469f1243503098fb05b5ddec3fa609132debab Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * JGit v4.0.0.201506020755-rc3v4.0.0.201506020755-rc3Matthias Sohn2015-06-023-4/+4
| | | | | | | | | | Change-Id: I31c6177d19cba228aa67b2b5c3e0d82c38395cda Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Prepare post 4.0.0-rc2 buildsMatthias Sohn2015-05-263-4/+4
| | | | | | | | | | Change-Id: I3ba1bb0d7f220f88eb768a3137493f737aadf466 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * JGit v4.0.0.201505260635-rc2v4.0.0.201505260635-rc2Matthias Sohn2015-05-263-4/+4
| | | | | | | | | | Change-Id: I496743145da865f9631b46a432c65c1e63ccb501 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Prepare 4.1.0-SNAPSHOT buildsMatthias Sohn2015-06-033-35/+35
|/ | | | | Change-Id: I03d08b8e2d3400d4b5cdb4ab541b312870776843 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Replace deprecated release() methods by close()Matthias Sohn2015-05-2112-92/+60
| | | | | | | | See the discussion [1] in the Gerrit mailing list. [1] https://groups.google.com/forum/#!topic/repo-discuss/RRQT_xCqz4o Change-Id: I2c67384309c5c2e8511a7d0d4e088b4e95f819ff Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Expose disposeBody() on RevCommit and RevTagShawn Pearce2015-05-101-0/+1
| | | | | | | | | Applications that use a commit message once and do not need it again can free the body to save memory. Expose the disposeBody() methods to support this and use it in pgm.Log which only visits each commit once. Change-Id: I4142a0749c24f15386ee7fb119934a0432234de3
* Restore AwtCredentialsProvider to enable debugging pgm in EclipseMatthias Sohn2015-04-221-4/+46
| | | | | | | | | | | | In 6c1f7393882baf8464859136a70199ea96fcae0f the AWT based credentials provider was dropped because we don't support Java 5 any longer so we can always use the ConsoleCredentialsProvider which requires Java 6. This broke debugging org.eclipse.jgit.pgm since Eclipse doesn't support using a system console authenticator [1]. [1] see https://bugs.eclipse.org/bugs/show_bug.cgi?id=148831 Change-Id: Iba71001a7762e73d6579ba9dfa5a08ddaba777ea
* Include slf4j and log4j in jgit command lineMatthias Sohn2015-03-232-0/+24
| | | | | | | | | | | | | This enables the command line to log. Include log4j configuration to log warnings and errors to stderr. Exclude the dependencies which log4j 1.2.15 should have marked optional. See http://unitstep.net/blog/2009/05/18/resolving-log4j-1215-dependency-problems-in-maven-using-exclusions/ for details Change-Id: Ie730db4007fb7614fd7d130cd0858b1ac550066a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge bundle org.eclipse.jgit.java7 into org.eclipse.jgitMatthias Sohn2015-03-231-17/+0
| | | | | | | As we moved minimum Java version to 7 we don't need a separate bundle and feature for JGit features depending on Java 7 anymore. Change-Id: Ib5da61b0886ddbdea65298f1e8c6d65c9879ced1 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* CLI status should support --untracked-filesKaloyan Raev2015-03-124-11/+139
| | | | | | | | | | | | | | | | | | A special options handler is added to properly handle the short -u alias of the option. The "normal" mode is not supported by this patch, because this mode of listing untracked files is not supported by the org.eclipse.jgit.lib.IndexDiff class. This mode is not necessary for my use case. It can be added later if anyone really needs it. The StatusTest is updated to cover all possible combinations of the --porcelain and --untracked-files options. Bug: 459319 Change-Id: I305ac95739cfed0c16735e0987844e57fa27e236 Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add "--long" option to JGit describeChristian Halstrick2015-03-092-0/+6
| | | | | | | | | | | Native git supports "git describe --long". This will enforce returning a long description of a commit even if a tag is directly pointing to the commit (in contrast to just returning the tag name as it is now). This commit teaches JGits DescribeCommand and the describe command in the pgm package to support "--long". Bug: 460991 Change-Id: I65e179b79e89049c6deced3c71cb3ebb08ed0a8f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Move console classes to pgm bundleMatthias Sohn2015-02-107-68/+306
| | | | | | | | | Since we updated minimum Java version to Java 7 the console bundle doesn't need to be a separate bundle anymore. Move the contained classes to the pgm bundle which is using these classes. Change-Id: If8e6f2d7405fdfe6f4b178673b4ccf99c67d4b64 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Set minimum required Java version to Java 7Matthias Sohn2015-02-093-5/+5
| | | | | | Bug: 458475 Change-Id: Iea8f2236d4e6a94a8d14bb8cc685006ea3fd1bb7 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'stable-3.7'Matthias Sohn2015-02-042-3/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-3.7: Add option --orphan for checkout Prepare post 3.7.0.201502031740-rc1 builds JGit v3.7.0.201502031740-rc1 Support for the pre-commit hook Fix FileUtils.testRelativize_mixedCase which failed on Mac OS X Add a hook test Introduce hook support into the FS implementations If a pack isn't found on disk remove it from pack list Conflicts: org.eclipse.jgit.java7.test/META-INF/MANIFEST.MF Change-Id: I936acd24d47b911fa30ab29856094e1b2c6ac3db Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Add option --orphan for checkoutRüdiger Herrmann2015-02-042-3/+7
| | | | | | | | | | Change-Id: I546a93f3e147d8d6fc70094b22679c0d11cd8921 Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
| * Prepare post 3.7.0.201502031740-rc1 buildsMatthias Sohn2015-02-043-4/+4
| | | | | | | | Change-Id: Id3728e771a4441757de016cc9d68055f668126b0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * JGit v3.7.0.201502031740-rc1v3.7.0.201502031740-rc1Matthias Sohn2015-02-033-4/+4
| | | | | | | | | | Change-Id: Ia2ea65945b7e1d4120da3d6e6c9f6d5fdb642ae6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Prepare 4.0.0-SNAPSHOT buildsMatthias Sohn2015-01-273-34/+34
|/ | | | | Change-Id: I414ba8ccc82866d3107ba7083a567ea70c879bdf Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge "Make jgit.sh work on windows when JGIT_CLASSPATH is set"Shawn Pearce2015-01-271-2/+6
|\
| * Make jgit.sh work on windows when JGIT_CLASSPATH is setChristian Halstrick2014-12-011-2/+6
| | | | | | | | | | | | | | | | | | | | | | jgit.sh was concatenating classpath entries with ":". On Windows systems using "Git for Windows" this caused problems when JGIT_CLASSPATH was set. Find out whether we are running on a platform which name starts with "MINGW" ("Git for Windows" sets this) and use ";" as classpath separator in this case. Change-Id: I7e8fc2bee6513f587612accfc456a83d6277ef4a
* | [pgm] Prevent commands from writing progress to System.errRüdiger Herrmann2015-01-136-6/+6
| | | | | | | | | | | | | | | | | | Commands which report progress used to write to System.err. This is not desirable in cases where jgit.pgm is embedded. This change redirects progress output to the error stream that is configured by the command. Change-Id: I01fa5e167437e619448ac201fcb1cbf63bad96d7 Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | [pgm] Add missing help text for clone --bare optionMatthias Sohn2015-01-071-0/+1
| | | | | | | | | | Bug: 456695 Change-Id: Ib6005e8453ecc871a9b72227e2593a3823f56010 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Prepare 3.7.0-SNAPSHOT buildsMatthias Sohn2014-12-243-34/+34
| | | | | | | | | | Change-Id: Ib3e7b5f46ee1e27b9cf25b3b2d01d681a5c4904c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>