Commit Graph

2281 Commits

Author SHA1 Message Date
Robin Rosenberg 57333a8e93 Harmonize the JDT settings within JGit
Note the the settings are slightly less restrictive for test bundles.
-Also cleanup a couple of malformed javadocs
-Update compiler warnings/errors to include default values from Juno
-We now flag diagnosed null dereference as error. We didn't do that
 earlier because of some false positives.

Change-Id: I58386d63164e65d3d8d1998da3390d99bdc7381a
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-16 10:25:45 -08:00
Robin Stocker a2e691351f DirCacheEditor: Apply PathEdit for each stage
This behavior was defined in the Javadoc of PathEdit, but not actually
implemented.

It's necessary when one wants to use a PathEdit to check out a specific
stage in apply.

Bug: 390147
Change-Id: Iaed5cf60c554fc17e6c4d188caf4f0231da920d0
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-16 10:12:40 -08:00
Matthias Sohn 05a7113002 Add missing @since tags to mark API added in 2.2
Change-Id: I458167739210214fa54c4b3d62fac5abc82f96f7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-16 10:08:07 -08:00
Tomasz Zarna 318f3d4643 Add support for --no-ff while merging
Bug: 394432
Change-Id: I373128c0ba949f9b24248874f77f3d68b50ccfd1
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-16 11:04:13 +01:00
Tomasz Zarna cb0f0ad4cf Add a test for org.eclipse.jgit.pgm.Tag
The test checks if an error is thrown when trying to create the same tag
for the second time.

Change-Id: I4ed2f6c997587f0ea23bd26a32fb64a2d48a980e
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-15 16:28:02 -08:00
Tomasz Zarna 790126c145 Do not fail when checking out HEAD
Change-Id: I99f5467477ed53101121a5a5d8a0910c55758401
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-15 16:05:09 -08:00
Tomasz Zarna 074f9194dc Prefix an abnormal CLI command termination with 'fatal:'
Change-Id: I3d257666c6fbed7b238c575808f73ec518e811b9
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-15 15:45:35 -08:00
Chris Aniszczyk e73c6873c7 Merge "CommitCommand: Ensure unmerged paths are added correctly with setOnly" 2012-11-15 18:43:54 -05:00
Matthias Sohn 6a3b0668b7 Merge "Fix formatting in org.eclipse.jgit.pgm.CLIText" 2012-11-14 17:34:34 -05:00
Jonathan Nieder dfb8bd694c diff, log -p: do not use outs before it is initialized
Since commit caa362f20d (Check for write errors in standard out and
exit with error, 2012-09-14), running "jgit diff" results in a
NullPointerException:

| $ jgit diff
| java.lang.NullPointerException
|	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
|	at java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)
|	at org.eclipse.jgit.diff.DiffFormatter.format(DiffFormatter.java:688)
|	at org.eclipse.jgit.diff.DiffFormatter.format(DiffFormatter.java:630)
|	at org.eclipse.jgit.diff.DiffFormatter.format(DiffFormatter.java:616)
|	at org.eclipse.jgit.diff.DiffFormatter.format(DiffFormatter.java:600)
|	at org.eclipse.jgit.pgm.Diff.run(Diff.java:211)
|	at org.eclipse.jgit.pgm.TextBuiltin.execute(TextBuiltin.java:166)
|	at org.eclipse.jgit.pgm.Main.execute(Main.java:200)
|	at org.eclipse.jgit.pgm.Main.run(Main.java:120)
|	at org.eclipse.jgit.pgm.Main.main(Main.java:94)

That patch replaced most uses of System.out with a wrapper, with
changes like the following:

	 class Diff extends TextBuiltin {
		private final DiffFormatter diffFmt = new DiffFormatter( //
	-			new BufferedOutputStream(System.out));
	+			new BufferedOutputStream(outs));

outs is not set for TextBuiltin objects until init() has been run.
Moving the initialization to after the super.init() call gets
"jgit diff" and "jgit log -p" working well again.

Change-Id: I80fcf259c4fb733990bd16e52bcf94e66d820826
2012-11-14 12:14:20 -08:00
Robin Stocker 0f88d7b72f CommitCommand: Ensure unmerged paths are added correctly with setOnly
With bug 391855, PathEdit will be changed to apply an edit for each
stage. With that, CommitCommand would no longer work correctly when
committing an unmerged path.

This changes it to use a DirCacheBuilder which allows us to correctly
replace the entries for the three stages with one, which is not possible
with PathEdit.

Bug: 391859
Change-Id: I6dc180aec7e2cbf8d1e91f50482c95bc420f79de
2012-11-12 22:51:18 +01:00
Tomasz Zarna 77d98b7ed5 Fix formatting in org.eclipse.jgit.pgm.CLIText
Change-Id: Ia87f28fa440cb354bf591713c8aadbe3969edbf1
2012-11-11 23:45:28 +01:00
Robin Stocker 106e8b8762 Fix redundant null check warning in Repository
rev is always null because of `if (rev != null) return ...` above.

Change-Id: I8168aefd344e0c4b0c68caea1a3daee66c07173b
2012-11-08 14:18:21 +01:00
Colby Ranger f3a8d7413c Merge "Add the an event and listener for a dfs PackIndex being loaded." 2012-11-02 13:27:36 -04:00
Colby Ranger 034ff96674 Add the an event and listener for a dfs PackIndex being loaded.
The DfsPackFile will fire any static repository listeners on the event
just before the PackIndex is loaded.

Change-Id: Ie51098106bd5a1a32feae7d2dd068abf02b030ee
2012-11-02 09:33:01 -07:00
Tomasz Zarna 908d219dbd Add ReflogCommandTest#testAmendReflog
Add a test for reflog with an amend commit and add assertions for
branch comments

Change-Id: Ie44076ff1abf1f8954b85d8c74ac6cb41ab789cb
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-01 16:56:30 -07:00
Robin Stocker de2455af67 ResetCommand: Use DirCacheBuilder in resetIndex
With bug 391855, DirCacheEditor's PathEdit will be applied for each
stage. For an unmerged path, this would result in 3 equal entries for
the same path.

By using a DirCacheBuilder, the code is simpler and does not have the
above problem with unmerged paths.

Bug: 391860
Change-Id: I785deeaeb8474f8c7a7fbc9ef00d3131fac87e41
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-01 10:47:10 -07:00
Robin Stocker 3f1d56d6b7 ResetCommand: Correctly reset unmerged paths in resetIndexForPaths
The previous implementation used a PathEdit, which does not reset the
stage of the entry.

Bug: 391860
Change-Id: If26d3a35abfee85424ad69de724f06a28b6e9efb
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-01 10:33:50 -07:00
Shawn Pearce 8acaae802c Merge "Add isIndexLoaded() to DfsPackFile." 2012-11-01 13:07:23 -04:00
Shawn Pearce 69b2a9f539 Merge "[blame] Don't pass null to PersonIdent constructor" 2012-11-01 12:48:23 -04:00
Colby Ranger f6f8bcd9df Add isIndexLoaded() to DfsPackFile.
The method reports whether the index file for the pack has been loaded
and cached in memory.

Change-Id: Ifa8d63f737458e102cb3d28579c9711d46693d17
2012-11-01 09:07:52 -07:00
Robin Stocker b7f5ed5612 Add Javadoc description for packages
These appear as descriptions in the index, see here (currently empty):

http://download.eclipse.org/jgit/docs/latest/apidocs/

Change-Id: If7996deef30ae688bade8b3ad6b19547ca3d8b50
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-10-31 21:26:22 -07:00
Chris Aniszczyk cda5e861b9 Merge "Refactor ResolveMergerTest to allow testing multiple strategies" 2012-10-30 20:00:14 -04:00
Robin Stocker ecf97083e5 [blame] Don't pass null to PersonIdent constructor
The API was changed to not allow null values anymore with
I0ac994ae8e47789d38f7c6e6db55d482f0f1bac3, leading to an IAE.

Bug: 393054
Change-Id: If33560ae976b46a02ff75b2e4ec05c13a8ad2d41
2012-10-29 20:48:38 +01:00
Robin Stocker 54aceb1769 Pull up method for creating DirCacheEntry into RepositoryTestCase
Change-Id: I6e6522289553137df1a46ceeb52f461e9d25a290
2012-10-28 14:25:11 +01:00
Robin Rosenberg 81fa566295 Suppress resource warnings with Java 7
For streams that should not be closed, i.e. don't own an underlying
stream, and in-memory streams that do not need to be closed we just
suppress the warning. This mostly apply to test cases. GC is enough.

For streams with external resources (i.e. files) we add the necessary
call to close().

Change-Id: I4d883ba2e7d07f199fe57ccb3459ece00441a570
2012-10-25 15:17:23 -07:00
Shawn Pearce bc8794eb21 Merge "Extend Javadoc of CheckoutCommand and add examples" 2012-10-25 18:13:56 -04:00
Shawn Pearce 71ac75fea3 Merge "Add a check in fstick that the reference file exists" 2012-10-25 18:01:04 -04:00
Shawn Pearce 4e6e267b8a Merge "Fix for Iff768422c, use offset 0 when going back to work tree iterator" 2012-10-25 17:55:22 -04:00
Robin Rosenberg 243e14d051 Add a check in fstick that the reference file exists
This helps avoiding some stupid thinkos.

Change-Id: I5b386cd9c6bf0e11f270bb2b8cfaac66ce9b341b
2012-10-25 14:48:48 -07:00
Shawn Pearce cd61e85fa1 Merge "Don't allow null name or e-mail in PersonIdent" 2012-10-25 17:19:15 -04:00
Shawn Pearce 88eb017c6c Merge "Fix Javadoc formatting of org.eclipse.jgit.diff package" 2012-10-25 17:16:27 -04:00
Shawn O. Pearce 500becfc63 Merge "Simplify push error message when ref already exists" 2012-10-25 17:15:02 -04:00
Christian Halstrick 37ab3ffdaf Refactor ResolveMergerTest to allow testing multiple strategies
By making use of JUnit Theories and Datapoints ResolveMergerTests is now
capable to run the tests against multiple Merge strategies.

Change-Id: Ifa0075e0a2aca7576ef268291b73fa2f4d79b591
2012-10-25 17:48:39 +02:00
Christian Halstrick b7d2c9a446 Merge "AbstractTreeIterator: Add toString with entry path" 2012-10-22 07:11:01 -04:00
Robin Stocker ad52ec5207 StashCreateCommand: Abort in case of unmerged paths
Bug: 391861
Change-Id: I5f8ffe072c08c8ca2ca6be6b6afa67c8e16a63b6
2012-10-22 11:14:40 +02:00
Robin Stocker f54b74225c AbstractTreeIterator: Add toString with entry path
Helps when debugging tree walking code.

Change-Id: I7ba3846a028a1538787a7d4fbf50f7c487cae6c7
2012-10-20 20:12:25 +02:00
Matthias Sohn 1ff82ca6d0 Update packaging build to use Tycho 0.16
Change-Id: Ie5c2f9d4a3b64fc43d310bec45685970cb227237
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-10-19 21:35:13 +02:00
Robin Stocker 8572526765 Extend Javadoc of CheckoutCommand and add examples
Otherwise one has to look at the source to find out how to use the
command.

Change-Id: I074325bf2147aeb6f738a9346a9bb8fc49968929
2012-10-18 14:08:36 +02:00
Shawn O. Pearce 99e9a3bdc6 Simplify push error message when ref already exists
If a client attempts to create a branch that already exists on the
remote side, tell them "already exists" rather than repeat lots of
information about the reference. Previously the error looked like:

  ! [remote rejected] tags/1.3.1 -> 1.3.1 (Ref Ref[refs/tags/1.3.1=e3857ee05...] already exists)

Now it will simply say:

  ! [remote rejected] tags/1.3.1 -> 1.3.1 (already exists)

Change-Id: I96fc67ca8b650052de6e662449a3c5bc8bbc010b
2012-10-17 18:04:25 -07:00
Robin Stocker ac81ab4878 Fix Javadoc formatting of org.eclipse.jgit.diff package
Without explicit <p> elements, Javadoc joins all paragraph, resulting in
unreadable Javadoc output, e.g. see here:

http://download.eclipse.org/jgit/docs/jgit-2.1.0.201209190230-r/apidocs/org/eclipse/jgit/diff/MyersDiff.html

Also, <pre> is needed to preserve pre-formatted content.

The reflowing of text was automatically done on save.

Change-Id: Ia02dd6d759ae066700098e22669ef925e3c813b5
2012-10-17 22:09:16 +02:00
Matthias Sohn 52d6482a5b Update jgit's last release version for API change reports
Change-Id: I04b1e8a2d3aa49c45bd7846fa87b9acfa57f8fda
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-10-16 11:37:44 +02:00
Christian Halstrick 5fc7bd783b Merge "Add a hint on the purpose of JGitInternalException to the constructor" 2012-10-14 17:06:20 -04:00
Robin Rosenberg 47a9b996c7 Add a hint on the purpose of JGitInternalException to the constructor
In code review we often see uses of JGitInternalException where a high
level GitAPIException would be more appropriate. Hopefully the word
low-level in the constructor comment will lead to fewer such cases.

Change-Id: Id5ec7897535f6c5c5f0bd153fe0ff15c65083474
2012-10-14 20:55:14 +02:00
Robin Stocker c8ed4a5006 RevWalk: Add link to parseHeaders/parseBody in Javadoc of lookupCommit
Change-Id: I7765d1a69d19968ebad603025a9c686f17633ebd
2012-10-13 21:25:29 +02:00
Robin Stocker 6dadc801bd Don't allow null name or e-mail in PersonIdent
toExternalString, equals and hashCode don't expect them to be null, so
explicitly disallow it in the constructor.

Also fix the documentation of setAuthor and setCommitter in
CommitCommand when specifying name and email as separate arguments.

Bug: 352984
Change-Id: I0ac994ae8e47789d38f7c6e6db55d482f0f1bac3
2012-10-13 18:40:46 +02:00
Matthias Sohn 14164e040c Merge "Make BlameGenerator comments more clear" 2012-10-09 16:51:34 -04:00
Robin Stocker 79f33419ec CommitCommand: Use original author on amend if author is not set
This way, callers don't have to parse author ident of HEAD themselves.

Bug: 362391
Change-Id: I383a817e6ed4707d637c52c007bc7b57728e6c85
2012-10-08 00:31:27 +02:00
Robin Stocker c96b40d592 CommitCommand: Don't allow amending on initial commit
Change-Id: I27b13510eb6756da21d0d359d76031da4a875e28
2012-10-08 00:31:26 +02:00
Matthias Sohn 6da9473fe3 Merge "Add --squash option to org.eclipse.jgit.pgm.Merge" 2012-10-07 17:52:58 -04:00