Commit Graph

1973 Commits

Author SHA1 Message Date
Kevin Sawicki 3734db9282 Use object id provided by working tree iterator for submodules
The working tree iterator now supports providing an object id
for submodule entries and this value should be used instead
of recomputing it again in AddCommand.

Change-Id: I30082514c23fc65968bb78add5ad69a1ca95cf3a
2012-03-10 10:26:10 -08:00
Kevin Sawicki 5c18fcb81b Keep submodules in index that are missing in working directory
Submodules present in the index but missing from the working
directory should not be staged for deletion when AddCommand
is called with the update flag set to true.

This mirrors the behavior of CGit.  Submodules can still be
staged for deletion by running by using the RmCommand.

Change-Id: Iee508a67f9621269d1c28d422f88c6b8dd9f8e6e
2012-03-10 10:02:58 -08:00
Matthias Sohn d1bde974c1 Merge "Export all packages from org.eclipse.jgit.pgm" 2012-03-09 19:29:13 -05:00
Robin Rosenberg 9a9877da4e Merge "EolCanonicalizingInputStream: binary detection should be optional" 2012-03-09 15:52:11 -05:00
Robin Rosenberg 01ee87201f cleanup: Silence an unused-parameter warning
Change-Id: Ic0ee9c08642d4efc6ef1f2333ebe6614e9c2df87
2012-03-09 14:04:43 +01:00
Stefan Lay d725ecb80e Merge "Fix rebase > continue when nothing left to commit." 2012-03-09 08:04:20 -05:00
Markus Duft edc1fee033 Fix rebase > continue when nothing left to commit.
If after resolving all conflicts nothing is left to commit, return
an according result, so that downstreams (EGit, ...) can behave like
cgit, and display a nice message informing the user.

Currently, EGit displays a "HEAD advanced fast forward" message, which
is absolutely not helpful at all.

This is the basic API revamping required to get that state communicated
to the outside world (EGit).

Bug: 336812
Change-Id: If2665005cf54a5b51c0fe80bad019fa42b0205af
2012-03-09 13:56:37 +01:00
Robin Rosenberg 66e8cd4eec cleanup: Get rid of some unused-warnings
Change-Id: Ia3e82682781c6b5bc3141b3e27db67b93c3162cd
2012-03-09 13:30:20 +01:00
Robin Rosenberg c7f70c0558 cleanup: Remove unused parameter in ConsoleCredentialsProvider
Change-Id: I8d8ab54736c6d57e6211928def8632acb1f5b621
2012-03-09 13:30:19 +01:00
Robin Rosenberg 3cd7f09eec cleanup: Drop unused parameter on DhtPackParser
Change-Id: I8f2cd0a04cc95a02c49c16dade1b3509cba02e2d
2012-03-09 13:30:19 +01:00
Robin Rosenberg dd830f0a8d cleanup: Remove unneeded parameter to private method in RefUpdateTest
Change-Id: I45823b0c1ad5d249d539d7c8e1180ad7432abb3e
2012-03-09 13:30:19 +01:00
Robin Rosenberg 708febedaf cleanup: Remove unnecessary @SuppressWarnings
Change-Id: Ie22ac47e315bff76f224214bc042fc483eb01550
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2012-03-09 13:30:07 +01:00
Robin Rosenberg 48bd58b8ee Merge "Revert non-sense logic in IO.readFully" 2012-03-09 04:47:45 -05:00
Shawn O. Pearce c1ed9483ff Use readString() to trim trailing LF from first line
The fetch-pack/upload-pack stream usually has an LF at the
end of the first "want" line. Trim this when checking to
see if side-band or side-band-64k was used.

Perform the same trim for send-pack/receive-pack, as it is
harmless in this context to ignore an LF just before doing
an error report.

Change-Id: I6ef946bb6124fa72c52bd5320187eaac3ed906e7
2012-03-07 19:51:12 -08:00
Shawn Pearce 500e17e7d6 Merge changes I8277fd45,I7ac4e0ae,Ib475dfc0,Ib26adf95
* changes:
  Try to send HTTP error messages over sideband
  Extract the capability parsing logic in {Upload,Receive}Pack
  Make capability strings in BasePack{Fetch,Push}Connection public
  Fix a typo in "capabilities" in ReceivePack
2012-03-07 22:22:22 -05:00
Dave Borowitz 039c785d9f Try to send HTTP error messages over sideband
When a client POSTs to /git-{upload,receive}-pack, the first line
includes their client capabilities. As soon as the C git client sends
side-band(-64k), it goes into a state where it chokes on data not sent
in a valid sideband channel.

GitSmartHttpTools.sendError() is called early in the request, likely
before a {Upload,Receive}Pack handler is assigned or, even so, before it
has read the request. In some cases we must read the first line manually
within sendError() to tell whether sideband is needed.

Change-Id: I8277fd45a4ec3b71fa8f87404b4f5d1a09e0f384
2012-03-07 15:04:45 -08:00
Dave Borowitz d2787d481e Extract the capability parsing logic in {Upload,Receive}Pack
Change-Id: I7ac4e0ae98872a74b01162b5ca936fb15e2f8cff
2012-03-07 12:53:49 -08:00
Dave Borowitz 2b0044f222 Make capability strings in BasePack{Fetch,Push}Connection public
Change-Id: Ib475dfc087705ea40e1db37ec9ef28a67fde6d72
2012-03-07 12:52:47 -08:00
Dave Borowitz eea8581da5 Fix a typo in "capabilities" in ReceivePack
Change-Id: Ib26adf954dcb90403be9d6ed3b7a425a724c67d0
2012-03-07 12:52:45 -08:00
Tomasz Zarna c638f72b41 Export all packages from org.eclipse.jgit.pgm
Change-Id: I90565c8626aa5ab58ed3ff1dafa8bd21c9a79c62
2012-03-07 18:41:45 +01:00
Tomasz Zarna 90d002c15f Remove ambiguous CheckoutConflictException
Checkout command should throw o.e.j.api.errors.CheckoutConflictException
which is a GitAPIException not o.e.j.errors.CheckoutConflictException.
PullCommand should rethrow the API exception as a JGitInternalException.

Bug: 356922
Change-Id: I865c4905997d9834c85a97fbe7287604daf99075
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-03-06 22:43:25 +01:00
Christian Halstrick e05300b21d Merge "Check connection's error stream before reading from it" 2012-03-06 09:26:38 -05:00
Shawn O. Pearce 8b1eee47d2 Ignore /target
Maven seems to be creating target/antrun/build-main.xml.
This isn't a tracked file. Elsewhere we blanket ignore
/target inside of each plugin/component directory so do
the same at the top level.

Change-Id: Id799ac6da65e6789e48e28efbdb455153b34ff2e
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-03-05 21:11:57 -08:00
Kevin Sawicki fb2113d766 Reuse Git object created in setUp
Removes unneeded calls to Git.wrap in test cases where a valid
Git object already exists as an instance variable.

Change-Id: Id0e032d7886dfa6a3288321503a02743413f707d
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-03-05 21:06:35 -08:00
Kevin Sawicki 9e4b4fc41c Set person and message on stash ref update
This will be the message and person used for the commit
of stashed working directory changes.

Bug: 372884
Change-Id: I2501b080f6b94e826cf7dba3fd526ae5c1d969d1
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-03-05 20:59:44 -08:00
Kevin Sawicki 8db5414dcf Return command from StashCreateCommand setters
Previously were void which made them inconsistent with
the fluid setter pattern used in other commands.

Change-Id: Idb81dfc7bb097306f0c5d6e34f91a2bbab501668
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-03-05 20:53:59 -08:00
Kevin Sawicki 9908c203a5 Support insteadOf and pushInsteadOf URL replacement
Bug: 346873
Change-Id: I4116328f93f411da56a633bc32fd064b2ac083f2
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-03-05 20:46:26 -08:00
Chris Aniszczyk db29665e64 Merge "Quickfix for AutoCRLF handling" 2012-03-05 23:44:45 -05:00
Kevin Sawicki 2c6187697c Check connection's error stream before reading from it
HttpURLConnection.getErrorStream can return null which is
currently not guarded against and will throw an NPE preventing
the actual error response code from bubbling up.

Change-Id: I04fb8dbda16b7df3b82fc579088a303b2fd21e87
2012-03-05 17:22:22 -08:00
Tomasz Zarna eedd77a97b RawText#getEOL() does the same thing as RawText#getLineDelimiter()
The duplication has been introduced when merging
I08e1369e142bb19f42a8d7bbb5a7d062cc8533fc and
I18adc63596f4657516ccc6d704a561924c79d445. The former should have been
manually rebased. It also missed a copyright update in ApplyCommandTest.

Change-Id: I18fe6108220f964524fb16b719604222aa7abee6
2012-03-05 12:59:10 +01:00
Christian Halstrick c71fff4ce2 Merge "Update example code for obtaining a locked DirCache" 2012-03-05 03:46:53 -05:00
Tomasz Zarna 92f90eb229 Add ApplyCommand to JGit API
Bug: 361548
CQ: 6243
Change-Id: I08e1369e142bb19f42a8d7bbb5a7d062cc8533fc
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-03-04 21:29:01 -08:00
Robin Rosenberg 8e1bc46061 Merge "Remove null access warning in DirCacheCheckout" 2012-03-04 13:06:59 -05:00
Robin Rosenberg 88fe2836ed Quickfix for AutoCRLF handling
CRLF only works for small files, where small is the size of the
buffer, i.e. about 8K. This QD fix reallocates the buffer to be
large enough.

Bug: 369780
Change-Id: Ifc34ad204fbf5986b257a5c616e4a8c601e8261a
2012-03-03 08:22:48 +01:00
Matthias Sohn e0910edf7c Include eclipse.inf
Commit 9169e7f9ec failed to add
org.eclipse.jgit/META-INF/eclipse.inf in order to fix bug 372845 since
JGit is not yet built by Tycho. Hence explicitly including it.

Bug: 372845
Change-Id: I6cb12327a237d69fbfe3d5e77d8a6ad7de442ad5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-03-03 00:53:00 +01:00
Kevin Sawicki d364fb2d4f Remove null access warning in DirCacheCheckout
Initially fill in the current DirCacheEntry field guarding 
against a null index tree and use that variable instead of
calling getDirCacheEntry() on a possibly null DirCacheBuildIterator.

Change-Id: I16f388a16636aefdb07d66dae5d05655009e2a0e
2012-03-02 15:01:13 -08:00
Kevin Sawicki 014d759d35 Update example code for obtaining a locked DirCache
Previous example was calling a method that no longer exists
on DirCache.

Change-Id: I864842c58df4f116b318dc4a150b789745769a0d
2012-03-02 12:49:38 -08:00
Tomasz Zarna 9c7371a8c4 Allow to get end-of-line characters for a RawText
Bug: 370320
Change-Id: I18adc63596f4657516ccc6d704a561924c79d445
Signed-off-by: Kevin Sawicki <kevin@github.com>
2012-03-02 12:06:09 -08:00
Sascha Scholz a1f877e312 Load .gitmodules config before adding values to it
This prevents existing entries from being cleared when the
.gitmodules config is saved after the new submodule configuration
is added.

Change-Id: I66841f5e758a7527e2e6e25cf1318e5fea91a909
Signed-off-by: Kevin Sawicki <kevin@github.com>
2012-03-02 09:31:09 -08:00
Christian Halstrick 1515d7b7d5 Merge "Exclude org.eclipse.jgit from pack200 packing" 2012-03-02 11:03:14 -05:00
Christian Halstrick 3083146d13 Merge "Reuse existing modes and ids" 2012-03-02 03:46:03 -05:00
Matthias Sohn 9169e7f9ec Exclude org.eclipse.jgit from pack200 packing
It seems pack200 became unable to correctly pack the bundle
org.eclipse.jgit (see bug 372845). Hence mark it to be excluded from
this packing step following the workaround which worked for
org.eclipse.jst.jsf.core (bug 335806).

Bug: 372845
Change-Id: I2e3d20645ac49125472ddc235afbe9f3c7480caf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-03-02 09:11:18 +01:00
Dave Borowitz d023f2c78b Extract filterCommands as a static method on ReceiveCommand
Change-Id: I24501f95185878d09b54562e48cb4e7e45dd3968
2012-02-29 19:09:24 -08:00
Dave Borowitz 903e1b81d4 Remove PreUploadHook.onPreAdvertiseRefs
AdvertiseRefsHook.advertiseRefs subsumes this behavior.

Change-Id: Id2d1ebb2503c9ba79eda58aaea2fd76ec233427f
2012-02-29 19:09:24 -08:00
Dave Borowitz 9d41dbd958 Add an AdvertiseRefsHookChain, similar to the other hook chains
Change-Id: I3bb0dc86047fe0446d18e0055f714092a658d228
2012-02-29 19:09:23 -08:00
Dave Borowitz 1f2022e3a7 Modify refs in UploadPack/ReceivePack using a hook interface
This is intended to replace the RefFilter interface (but does not yet,
for backwards compatibility). That interface required lots of extra
scanning and copying in filter cases such as only advertising a subtree
of the refs directory. Instead, provide a hook that can be executed
right before ref advertisement, using the public methods on
UploadPack/ReceivePack to explicitly set the map of advertised refs.

Change-Id: I0067019a191c8148af2cfb71a675f2258c5af0ca
2012-02-29 19:09:23 -08:00
Dave Borowitz 7acd333e7d Fix a typo referring to RevFilter as RefFilter
Change-Id: I173efca7540b522d386216d1bd229e9a061263b2
2012-02-29 19:09:23 -08:00
Dave Borowitz bb8f0bec4a Minor javadoc wording fixes in ReceivePack
Change-Id: I5b409ef39aee890bcd7d4277e36b85ac4dc48281
2012-02-29 19:09:23 -08:00
Dave Borowitz 27cbdaf497 Expose an OutputStream from ReceivePack for sending client messages
Callers may want to format and flush their own output, for example in a
PreReceiveHook that creates its own TextProgressMonitor. The actual
underlying msgOut can change over the lifetime of ReceivePack, so we
implement a small wrapper.

Change-Id: I57b6d6cad2542aaa93dcadc06cb3e933e81bcd3d
2012-02-29 19:09:23 -08:00
Dave Borowitz 4a01f47e82 Allow creating ReceiveCommands with a specified type
This allows callers who know in advance whether a command is UPDATE or
UPDATE_NONFASTFORWARD to specify this in the constructor rather than
with a separate method call.

Change-Id: Iae483594a4ff370ff75d17a7b0648c5590b3d1bd
2012-02-29 19:09:22 -08:00