Commit Graph

2207 Commits

Author SHA1 Message Date
Robin Stocker 97b8115be4 Document that path parameters should use '/' as separator
Bug: 421600
Change-Id: I505d994518aa608aaa797252433b6c97e2def5b4
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-11-15 19:20:02 +01:00
Robin Stocker 04f19353fd Improve Javadoc for typeHint parameter
Link to an example type constant.

Change-Id: I214ab834fa02901a38e6048a94a5224b30c5d93f
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-11-14 11:12:29 +01:00
Colby Ranger f3b80f1a74 Do not update the ref hot bit when checking isIndexLoaded
DfsPackFile.isIndexLoaded() uses the DfsBlockCache.Ref.get() method
to check if the index loaded. However, using the get() method marks
a hot bit in the cache, which can cause the index to never be unloaded
and seem hotter than it really is. Add a has() method which only
checks if the value is not null and does not update the hot bit.

Change-Id: I7e9ed216f6e273e8f5d79ae573973197654419b4
2013-11-13 15:19:03 -08:00
Christian Halstrick 8da939221c Don't delete .idx file if .pack file can't be deleted
If during an garbage collection old packfiles are deleted it could
happen that on certain platforms the index file can be deleted but the
packfile can't be deleted (because someone locked the file). This led
to repositories with packfiles without corresponding index files. Those
zombie-packfiles potentially consume a lot of space on disk and it is
never tried to delete them again. Try to avoid this situation by
deleting packfiles first and don't try to delete the other files if we
can't delete the packfile. This gives us the chance to delete the
packfile during next GC.

This commit only improves the situation - there is still the chance for
orphan files during packfile deletion. We don't have an atomic delete
of multiple files .

Change-Id: I0a19ae630186f07d0cc7fe9df246fa1cedeca8f6
2013-11-13 08:59:43 +01:00
Matthias Sohn 05f308af48 Merge "Add missing @since tags" 2013-11-12 18:09:02 -05:00
Matthias Sohn b41b5d723e Add uses directives to ensure OSGi wires jgit bundles correctly
See
http://spring.io/blog/2008/10/20/understanding-the-osgi-uses-directive/

Bug: 420903
Change-Id: I3706a2b8f695d4ce0ee2333722ed7b8d31032f1e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-12 23:11:16 +01:00
Matthias Sohn 2765cc1871 Grant access to internal jgit package to org.eclipse.jgit.junit
This silences some discouraged access warnings issued since
TestRepository uses PackWriter which is in an internal package.

Change-Id: Ic9c4631e237c2fe1996c518328ecc2a9ab5c348b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-10 15:59:41 -05:00
Matthias Sohn d4a42f472a Remove duplicate package export
Change-Id: I185610f12069cd4ce1b27650581375b6b3019d2f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-10 15:59:04 -05:00
Matthias Sohn 7cae388118 Add missing @since tags
Change-Id: Ic4fabec818d6fe336d3256ddc95934271272914a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-09 01:16:46 +01:00
Stefan Lay 979e346711 Interactive Rebase: Do actions if there were conflicts
If a commit was marked for edit, reword, squash or fixup, but the
interactive rebase stopped because of a conflict, the step was not done
after conflict resolution. This is done now.

Change-Id: If8e7ccc50469165744f2b8a53d180f9ba0f72330
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-08 23:43:11 +01:00
Stefan Lay 18069ffe8c Rebase interactive should finish if last step is edit
When the last step was an edit step, rebase interactive did not finish
after continuing the rebase. Instead, it returned with the status
FAST_FORWARD.

Change-Id: Ib19857474ac089dfeaae665ad5e95c66c21099b0
2013-11-06 09:43:31 +01:00
Matthias Sohn 34fbd814d4 Merge changes I40f2311c,I3c419094
* changes:
  Add additional RebaseResult for editing commits
  Add Squash/Fixup support for rebase interactive in RebaseCommand
2013-11-05 17:03:35 -05:00
Shawn Pearce b8eac43c0f Merge changes I85470d1d,I43711486,Ie6ade781,Ic9ab2b6e,Iebe50933,Id6fac253,Ia6becf30,I2af8b0ac
* changes:
  Use absolute paths for file:// URIs in tests
  Use getPath() in FileResolverTest
  Extract protocol constants to a common class
  Move repeat() to utility class for tests
  Remove hardcoded target/trash from test cases
  Remove dependency on StatusCommandTest
  Remove dependency on DiffFormatterReflowTest
  Remove unnecessary import of BaseConnection in MessageWriter
2013-11-05 12:41:12 -05:00
Stefan Lay cce2561e9f Add additional RebaseResult for editing commits
With the new RebaseResult.EDIT a client can now distinguish if rebase
stopped due to a conflict or because the commit was marked for edit in
an interactive rebase.

Change-Id: I40f2311cf43ed5f290dcda65a7bd85ba770a85f5
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2013-11-05 18:05:03 +01:00
Tobias Pfeifer 765896febb Add Squash/Fixup support for rebase interactive in RebaseCommand
The rebase command now supports squash and fixup. Both actions are not
allowed as the first step of the rebase.

In JGit, before any rebase step is performed, the next commit is
already cherry-picked. This commit keeps that behaviour. In case of
squash or fixup a soft reset to the parent is perfomed afterwards.

CQ: 7684
Bug: 396510
Change-Id: I3c4190940b4d7f19860e223d647fc78705e57203
Signed-off-by: Tobias Pfeifer <to.pfeifer@web.de>
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-05 18:05:02 +01:00
Matthias Sohn 6e3e5e4809 Declare that org.eclipse.jgit.transport uses com.jcraft.jsch
This should prevent class cast problems caused by jgit and egit bundles
wiring to different versions of com.jcraft.jsch.

Bug: 420903
Change-Id: Icabe40209ea07369e2b7eee31952d131aef3fbf1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-05 10:39:10 +01:00
Christian Halstrick b686fa45b6 Merge "testMaliciousPathEmpty fails on Windows" 2013-11-04 07:39:43 -05:00
Shawn Pearce b0dbb78e7d Extract protocol constants to a common class
This avoids the server from referencing the client code directly.

Change-Id: Ie6ade781b5a689646ad8b0b2988ef2b544412195
2013-11-01 19:57:47 -07:00
Shawn Pearce 3bc289bcfe Remove unnecessary import of BaseConnection in MessageWriter
Change-Id: I2af8b0ac0f9fbf2814eca23990ae527baf040539
2013-11-01 19:57:47 -07:00
Tobias Pfeifer da9db6b20c Enable to prepare interactive rebase and then start it explicitly
Add Operation.PROCESS_STEPS to RebaseCommand to enable starting
interactive rebase explicitly after rebase steps have been configured.

Change-Id: I2d6f0de82010ea6523fbce6fb4501e847bdcdddc
Signed-off-by: Tobias Pfeifer <to.pfeifer@web.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-01 23:43:59 +01:00
Robin Rosenberg 98bc384d2b testMaliciousPathEmpty fails on Windows
Checking of spaces at the end of the file name caused the
test to fail for Windows only.

Bug: 396662
Change-Id: I47bcccb0fa32ce606276c3f30d454851d115ca11
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2013-11-01 16:43:46 +01:00
Tobias Pfeifer baab84836a Parse commitId and shortMessage of a commented out line in rebase todo
A rebase todo file consists of regular non-comment action lines and
comment lines. In case that a regular action line has been commented out
(i.e. prefixed with a hash '#'), the RebaseTodoLine that is representing
this line should hold the values for commitId and shortMessage even
though it's a comment line. This allows to switch between comment and
non-comment easily even after the file has been persisted and reread.

Change-Id: I56ec2ba08eaf3772e2d74d937dd496209a744d4b
Signed-off-by: Tobias Pfeifer <to.pfeifer@web.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-31 14:25:29 +01:00
Christian Halstrick c3873b584f Enhance reading of git-rebase-todo formatted files
Reading and writing files formatted like the git-rebase-todo files was
hidden in the RebaseCommand. Certain constructs (like leading tabs and
spaces) have not been handled as in native git. Also the upcoming
rebase interactive feature in EGit needs reading/writing these files
independently from a RebaseCommand.

Therefore reading and writing those files has been moved to the
Repository class. RebaseCommand gets smaller because of that and doesn't
have to deal with reading/writing files.

Additional tests for empty todo-list files, or files containing comments
have been added.

Change-Id: I323f3619952fecdf28ddf50139a88e0bea34f5ba
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Also-by: Tobias Pfeifer <to.pfeifer@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-31 14:22:20 +01:00
Michael Nelson 9e9f00df9e Support extension of TransportHttp
This allows subclasses to configure the HTTP connection (for example,
to add headers to the request).

Bug: 400724
Change-Id: I6f9d699e158a7b9d813c8fa8d273992a28994e41
Signed-off-by: Michael Nelson <michael.nelson@tasktop.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-10-26 18:20:27 -04:00
Matthias Sohn 72c7618571 Add / fix @since tags
Change-Id: I1e5bea968b3c79df4f600b75fde5b547ebadde36
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-24 08:32:47 +02:00
Robin Stocker 09711a4bb9 Make sure SystemReader is reset after test is run
Otherwise the MockSystemReader from the test setup is active for other
tests.

Change-Id: I7caf693bd692d06936e29efd4dc4aabb48c1c39b
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-10-22 00:37:56 +02:00
Matthias Sohn b15c617d0f Describe HEAD if no explicit target was set
Change-Id: I5a5a238709df813ec07278bb3b4f9ea5c85c0883
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-11 00:12:44 +02:00
Matthias Sohn 3c2c8b47ff Allow to set target of DescribeCommand
Change-Id: I04805ce20cc203f5e491406c39b71e7017553b37
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-11 00:11:00 +02:00
Colby Ranger 06ddee1c3f Fix ServiceMayNotContinueException constructors for Java 1.5
IOException did not add a (String, Throwable) constructor until 1.5.
Instead use the String super constructor and initCause to initialize
the exception.

Fixes bug 418889

Change-Id: Ide735ecfc7d04884981b79b57a4275863ce17006
2013-10-08 10:16:45 -07:00
Colby Ranger a27529c822 Add constructors that take Throwable to ServiceMayNotContinueException.
ServiceMayNotContinueException usually wraps an underlying exception.
Add convenience constructors that take Throwable. In the case a
string is not provided, the message defaults to "internal server error",
since it may be reported to the client.

Change-Id: I15dc20306826c352f69e88afb7ed6927c12b6c1f
2013-10-07 17:31:06 -04:00
Colby Ranger 5218f7b33a Propagate IOException where possible when getting refs.
Currently, Repository.getAllRefs() and Repository.getTags() silently
ignores an IOException and instead returns an empty map. Repository
is a public API and as such cannot be changed until the next major
revision change. Where possible, update the internal jgit APIs to
use the RefDatabase directly, since it propagates the error.

Change-Id: I4e4537d8bd0fa772f388262684c5c4ca1929dc4c
2013-10-07 11:32:54 -07:00
Matthias Sohn 7995d87713 Prepare 3.2.0-SNAPSHOT builds
Change-Id: Iac6cf7a5bb6146ee3fe38abe8020fc3fc4217584
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-03 18:21:31 +02:00
Matthias Sohn fdc80f7cad Merge branch 'stable-3.1'
* stable-3.1:
  Prepare post 3.1.0 builds
  JGit v3.1.0.201310021548-r
  Fix order of commits in rebase todo file header
  Prepare post 3.1.0 RC1 builds
  JGit v3.1.0.201309270735-rc1
  Attempt to fix graph layout when new heads are introduced
  Prepare re-signing pgm's ueberjar to avoid SecurityException
  Use full branch name when getting ref in BranchTrackingStatus

Change-Id: Ida30175d0c058048cbe4b563aae7f85cd008db29
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-03 17:39:33 +02:00
Matthias Sohn da6e87bc37 Prepare post 3.1.0 builds
Change-Id: I306a3d40c6ddb88a16d17f09a60e3d19b0716962
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-03 17:29:00 +02:00
Matthias Sohn 16ca725b35 JGit v3.1.0.201310021548-r
Change-Id: I2170b13047d5eab7565f47f9feb1680e03b1ba09
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-02 22:09:19 +02:00
Matthias Sohn 0be59ab033 Merge "Added the git-describe implementation" 2013-10-02 15:45:22 -04:00
Stefan Lay c6aba99668 Fix order of commits in rebase todo file header
Change-Id: I0e41d89bbd4fc01ad3b3d05a45ee60af853bfae7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-29 22:17:44 +02:00
Matthias Sohn 5a2a2222ef Prepare post 3.1.0 RC1 builds
Change-Id: I060f2082ccd0c91905b6b29a49cc633a0b51a1f2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-27 15:54:40 +02:00
Matthias Sohn 6f0681eb9f JGit v3.1.0.201309270735-rc1
Change-Id: I48202dd461110da25f9bc159c938311fff0669e0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-27 13:34:51 +02:00
Kohsuke Kawaguchi f045a68a78 Added the git-describe implementation
CQ: 7609
Bug: 339246
Change-Id: I689bc0578ce3a430b9800ad84122e221c69829f4
Signed-off-by: Kohsuke Kawaguchi <kk@kohsuke.org>
Also-By: Robin Stocker<robin@nibor.org>
Also-By: Matthias Sohn <matthias.sohn@sap.com>
Also-By: Christian Halstrick <christian.halstrick@sap.com>
2013-09-27 12:37:36 +02:00
Robin Rosenberg a065a06c2a Attempt to fix graph layout when new heads are introduced
Sometime the new commit is no allocated onto a new lane leading to
the commit being drawn on the wrong branch and something that looks
like a merge.

The drawback is that this also changes existing valid graphs.

Bug: 368927
Change-Id: Ic8a8247c8a53be802c1be83850ed766b902ca646
2013-09-26 14:06:39 +02:00
Jonathan Nieder 8a51c4453d Do not close ArchiveOutputStream on error
If we encounter an I/O error while writing an archive (for example due
to the reader of an HTTP stream closing the connection), the result is
an archive with unclosed entries, causing
TarArchiveOutputStream.finish() to throw IOException("This archives
contains unclosed entries"), hiding the IOException that caused the
early termination.

The unclosed entries are fine: the same exception that occured in the
first place will probably prevent closing the entries before finishing
this partial archive that should be discarded anyway.

It would be nicer to call TarArchiveOutputStream.finish and leave the
underlying OutputStream unclosed --- all callers close it already ---
but that would be a more invasive change so we hold off for now.

Change-Id: I328ced19aa8a1888e5353cdbb6106a85fd72d5d7
Signed-off-by: Jonathan Nieder <jrn@google.com>
2013-09-23 17:31:27 -07:00
Robin Stocker aa4bbc67b3 Use full branch name when getting ref in BranchTrackingStatus
In case there is both a tag and branch called "foo", the tag is returned
if calling getRef with the short name. By using refs/heads/foo, the
branch is returned.

Bug: 417158
Change-Id: I86b4f83955586bb24774fd621f5012499cf67909
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-20 14:48:55 +02:00
Colby Ranger 570bba5e7a Ignore bitmap indexes that do not match the pack checksum
If `git gc` creates a new pack with the same file name, the
pack checksum may not match that in the .bitmap. Fix the PackFile
implementaion to silently ignore invalid bitmap indexes.

Fixes Issue https://code.google.com/p/gerrit/issues/detail?id=2131

Change-Id: I378673c00de32385ba90f4b639cb812f9574a216
2013-09-19 14:53:01 -07:00
Colby Ranger 7dc6c553c0 Remove unneeded packs when compacting with no new objects
Previously, the DfsPackCompactor exited without pruning the existing
packs, when no new packs were created.

Change-Id: I5e3b6f8c789706c7a982e6ae93cf7c3d4346797c
2013-09-16 11:56:02 -07:00
Robin Stocker 02bd26e5a6 ResetCommand: Allow reset on unborn branch when ref not specified
In C Git 1.8.2, "git reset" now also works on an unborn branch (no HEAD
yet) if no explicit ref was specified. In that case, it is treated as a
reset to an empty tree.

This can be useful for callers because "unborn branch" no longer has to
be special-cased to "git rm --cached".

Bug: 414870
Change-Id: Ied750116f767518ae4d48823cf00752b049a8477
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-13 15:13:12 +02:00
Matthias Sohn 4b8a848a47 Merge branch 'stable-3.0'
* stable-3.0:
  Prepare post 3.0.2 builds
  JGit v3.0.2.201311090911-r

Change-Id: I99a7d1072285646f7fcd4169225c1fd249ad5e37
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-11 23:30:05 +02:00
Matthias Sohn 3af38b4fee Prepare post 3.0.2 builds
Change-Id: Ie1bd951a2cb35d069c94dab4a62507115913764f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-11 16:54:32 +02:00
Matthias Sohn da3041ae73 JGit v3.0.2.201311090911-r
Change-Id: Ifaae2e3e2f1bb0504bf9e6d59983086ac19a540b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-11 15:15:00 +02:00
Robin Stocker 52ab578cd7 Don't treat "/" as valid ignore pattern
This matches the behavior of C Git.

Bug: 415767
Change-Id: Ifa6500f3f6a033da40c48287630b77c47b15f4a0
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-09-09 17:05:17 -04:00
Shawn Pearce c2a9f9e742 Merge "Remove unnecessary inflate stride in DfsBlock" 2013-09-04 19:13:55 -04:00
Shawn Pearce aa8d5ac26c Remove unnecessary inflate stride in DfsBlock
OpenJDK 7 does not benefit from using an inflate stride on the input
array. The implementation of java.util.zip.Inflater supplies the
entire input byte[] to libz, with no regards for the bounds supplied.
Slicing at 512 byte increments in DfsBlock no longer has any benefit.

In OpenJDK 6 the native portion of Inflater used GetByteArrayRegion
to obtain a copy of the input buffer for libz. In this use case
supplying a small stride made sense, it avoided allocating space
for and copying data past the end of the object's compressed stream.

In OpenJDK 7 the native code uses GetPrimitiveArrayCritical,
which tries to avoid copying by freezing Java garbage collection
and accessing the byte[] contents in place. On OpenJDK 7 derived
JVMs it is likely more efficient to supply the entire DfsBlock.

Since OpenJDK 5 and 6 are deprecated and replaced by OpenJDK 7
it is reasonable to suggest any consumers running JGit with DFS
support use an OpenJDK 7 derived JVM. However, JGit still targets
local filesystem support on Java 5, so it is still not reasonble to
apply this same simplification to the internal.storage.file package.

See: JDK-6751338 (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6751338)
Change-Id: Ib248b6d383da5c8aa887d9c355a0df6f3e2247a5
2013-09-04 14:54:50 -07:00
Matthias Sohn ff09a3633d Merge branch 'stable-3.0'
* stable-3.0:
  Prepare post 3.0.2-rc2 builds
  JGit v3.0.2.201309041250-rc2
  Uncomment eclipse-jar-signer plugin
  Update build to use CBI jarsigner plugin
  Update maven plugins
  Update to Orbit Kepler SR1 release R20130827064939

Change-Id: Iaa8bba21c300dd1de2b91a77cddf6727fbc66340
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-04 22:45:53 +02:00
Matthias Sohn 4eefa881b3 Prepare post 3.0.2-rc2 builds
Change-Id: I0e4020326c6443ba7157c18b345160cf9e1e88a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-04 19:34:56 +02:00
Matthias Sohn 7c37177952 JGit v3.0.2.201309041250-rc2
Change-Id: Ie18ced75f573f140969af2a7d9edb45c76523715
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-04 18:55:13 +02:00
Matthias Sohn b97a35d7cf Update build to use CBI jarsigner plugin
The dash signing plugin has been retired hence we need to update our
build to use the CBI jarsigner plugin for signing build results.

Pack test classes to enable signing them.

Also re-enable pack200 for bundle org.eclipse.jgit.

WORKAROUND: there is no easy way to run tests with maven-surefire-plugin
from signed test-jar so for a quick workaround we will have to add a
build step on Hudson so that we can run tests before signing:
- first step will do "clean, verify" to compile and run tests
- second step will do "install, deploy" with profile "eclipse-sign" and
  use -DskipTests=true to skip tests since they would hit a
  SecurityException when unsigned test classes are in same package as
  signed classes under test
- third step will do "clean, install, deploy" on packaging reactor to
  build features and p2 repository with profile "eclipse-sign" to sign
  and pack200 all bundles.

TODO: Tycho doesn't suport picking up pack200 artifacts via
pomDependencies hence we need to find a way to copy them manually and
use tycho-extra's tycho-p2-extras-plugin:publish-features-and-bundles
to generate the missing p2 metadata.

Change-Id: Iec2c5ab3027a3e3f9ecc0d2f99193385177d9025
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-04 16:06:02 +02:00
Robin Stocker f68ffb48eb LogCommand: Remove outdated TODO and improve docs
Change-Id: I368be12e7bdc3c711e9f474ead312006513764b7
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-08-25 10:42:40 -04:00
Robin Rosenberg 99d981ce35 Update reflog like C Git during rebase (non-interactive)
Bug: 346350
Change-Id: I119766a00bc52a810c51cffaa19207cb8555ca22
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-08-21 14:44:48 +02:00
Christian Halstrick bd57789735 Make sure checkout is not deleting folders outside the workingtree
There was a chance that jgit deletes symbolic links which point to the
folder on top of the working tree. Make sure not to touch these
resources.

Thanks to Cedric Darloy who reported this bug on
http://www.eclipse.org/forums/index.php/m/776910/#msg_776910 and to
Ondrej Vrabec who reported bug 412489.

Bug: 412489
Change-Id: I81735ba0394ef6794e9b2b8bdd8bd7e8b9c6460f
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-08-21 14:44:47 +02:00
Robin Stocker c128100800 Fix bugs in TreeWalk#isPathSuffix used by PathSuffixFilter
* It didn't check the first character in the pattern due to a off-by-one
  error. Spotted by James Roper.
* It returned true even when pattern was longer than current path, e.g.
  it returned that ".txt" is suffix of "txt".

Bug: 411999
Change-Id: I9fbcd68a11fb57cc49956b70c387a47271a0424f
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-08-21 14:44:47 +02:00
Hiroshi Tomita 781b0b5735 Check parentFile is not null
parentFile becomes null when f is relative path, such as ".".

This patch avoids NullPointerException in such case.

Change-Id: I4752674b1daab6eedd7c3650c7749462810eaffd
Signed-off-by: Hiroshi Tomita <tomykaira@gmail.com>
2013-08-21 14:44:47 +02:00
Hiroshi Tomita 27c1c51079 Update HEAD in cherry-picking several commits
Without update, index is wrongly detected to be dirty
when picking the second commit.

Change-Id: Idf47ecb33e8bd38340d760806d629f67be92d2d5
Signed-off-by: Hiroshi Tomita <tomykaira@gmail.com>
Bug: 411963
2013-08-21 14:44:47 +02:00
Alex Rukhlin 81db591034 Fix HTTP response processing for WWW-Authenticate headers
The original code was able to process only one WWW-Authenticate
header in an HTTP response, and if this header was not one of
two expected, authentication failed regardless of that there
could be other headers in the response.

All WWW-Authenticate headers in an HTTP response have to be
browsed to find one of supported, i.e. Basic or Digest.
By that if both are present, the Digest one should be used
as more preferable.

Bug: 357719
Change-Id: Icf601a41fec63f7d40308f3c85aaa4f71a7c095b
Signed-off-by: Alex Rukhlin <arukhlin@microsoft.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-08-21 14:44:47 +02:00
Dave Borowitz bbea37a9e3 Don't skip want validation when the client sends no haves
Change-Id: I5e80b3befca5cf1dcb06075862d6d48e6491cc0f
2013-08-21 14:44:46 +02:00
Robin Rosenberg ec2202f563 Recognize CRLF when parsing the short message of a commit or tag
Bug: 400707
Change-Id: I9b09bb88528af465018fc0278f5441f7e6b75986
2013-08-21 14:44:46 +02:00
Matthias Sohn fdd1ac930e Prepare 3.0.2-SNAPSHOT builds
Change-Id: I3287609a90f068017cc62f4fd7738651e0663081
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-08-19 01:39:41 +02:00
Robin Stocker 9b26e4bffb Enable LsRemoteCommand to work without local repository
It's supported by C Git and can be useful.

Bug: 413388
Change-Id: I12c6c10e791cc09ee271d89eb8b8d32f53e385db
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-08-13 00:04:37 +02:00
Robin Stocker 6fb8d2345b Add missing @since tag for replaceLineBreaksWithSpace
Change-Id: Ibd9d9ba609a2cd7707b985cdb07405dce0422aab
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-08-12 21:34:50 +02:00
Matthias Sohn 7baeffc581 Allow the command line bundle to access internal jgit packages
Change-Id: Id1e11a21fdcbd8cb0f2f8c22e7ab253e8df65d2f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-08-11 00:51:42 +02:00
Robin Rosenberg c58405b0c3 Merge "Recognize CRLF when parsing the short message of a commit or tag" 2013-08-10 18:31:01 -04:00
Robin Rosenberg b6e5189c4e Merge "Added characters to be escaped in file name patterns" 2013-08-10 17:32:20 -04:00
Lars Vogel 594408e522 Add missing @since tags
Change-Id: I9754e2124c0fe6ad2dbde5597c3ed10f1c3efef5
Signed-off-by: Lars Vogel <Lars.Vogel@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-08-10 01:23:27 +02:00
Colby Ranger ae1f46989c Advertise capabilities with no refs in upload service.
With reference hiding, it is possible for a repository to appear
empty when all refs are hidden. This causes capabilities to not be
advertised either, since they are published with the first reference,
breaking fetch by SHA1 support.

Always advertise the capabilites by publishing the symbolic capabilities
reference when the repository has no references to advertise (similar to
the receive service).

Change-Id: I8060e430ee03571dc51239e702864c85e888505c
2013-08-08 11:10:40 -04:00
Shawn Pearce 15adcefb73 Allow UploadPack requests with no options
UploadPack can be invoked with no capabilities selected by the
client if the client is an ancient version of Git that nobody in
their right mind should still be using. Or if the client is very
broken and does not want to use any of the newer features added to
the protocol since its inception.

Change-Id: I3baa6f90e6a41a37a8eab8449a3cc41f4efcb91a
2013-08-07 15:44:02 -07:00
Colby Ranger 69761dbcdd Send no-progress option with NullProgressMonitor.
The NullProgressMonitor does not report progress anywhere. Inform the
server not to send progress by enabling the no-progress capability.

Change-Id: Id18dbc754c814d1a5534a284c947030bf201c569
2013-08-05 14:56:17 -07:00
Shawn Pearce ffb2600dd5 Merge "Change RequestValidator parameter to ObjectId list" 2013-08-02 18:15:19 -04:00
Greg Hill 1471fb4e0f Change RequestValidator parameter to ObjectId list
Instead of RevObject list, this allows a custom request validator to be called
on SHA-1's corresponding to objects that may not exist in repository storage

Change-Id: I19bb667beff0d0c144150a61d7a1dc6c9703be7f
Signed-off-by: Greg Hill <greghill@google.com>
2013-08-02 12:42:54 -07:00
Christian Trutz f677b07b98 Add setter for ProgressMonitor to StatusCommand
This is useful if Git.status() is a long running command.

Change-Id: I6bdbf347a688043d549c1f091fb4a264a6c7024e
Signed-off-by: Christian Trutz <christian.trutz@gmail.com>
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-07-28 16:01:46 +02:00
Robin Stocker a76a4acf87 Implement open(URIish) for TransportLocal
Can be used for listing remote refs for a repository on the file system
without having a local repository.

Bug: 413400
Change-Id: I397f5092c5eafb62236e9f9e74d9183f56903cc6
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-07-21 22:27:46 -05:00
Robin Stocker 8b6bbf094f Fix NPE in openFetch on Transport without local repository
Setting the walk and other fields to null will result in NPEs when the
user e.g. calls fetch on the connection, but at least the advertised
refs can be read like that without having a local repository.

Bug: 413389
Change-Id: I39c8363e81a1c7e6cb3412ba88542ead669e69ed
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-07-21 22:15:31 -05:00
Robin Rosenberg a2b33a8ac3 Add NON-NLS comments for some obviously untranslatable strings
Change-Id: I2d1076b46695dac84961b8ae663bfc5cb123b3a3
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-07-21 22:06:34 -05:00
Robin Rosenberg 60e01cff2f Update reflog like C Git during rebase (non-interactive)
Bug: 346350
Change-Id: I119766a00bc52a810c51cffaa19207cb8555ca22
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-07-21 21:54:41 -05:00
Robin Stocker 7033179440 Improve documentation of PathSuffixFilter
Change-Id: I1077dbb1f10c7cc687c0d1b8a8e8f763ca96977c
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-07-21 21:47:00 -05:00
Christian Halstrick 06dd0e9e27 Add path option to StatusCommand
Allow filtering of the status. Only files which match given paths are
inspected and only their state is reported.

Change-Id: I3c4b1b46bf297cd4ebdb4997cfa14c8752a36411
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-07-21 21:39:53 -05:00
Robin Stocker f5be93d003 Fix MERGED_NOT_COMMITTED toString
It had a typo (commited) and was not in the style of the others.

Change-Id: Ia1be1c70b13bb2f3da80c8e8239c5f254070fe60
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-07-18 20:05:29 +02:00
Matthias Sohn 459fd7d4bb Merge "Add missing @since tags" 2013-07-12 18:09:22 -04:00
Christian Halstrick de00ec94d8 Merge "Fix bugs in TreeWalk#isPathSuffix used by PathSuffixFilter" 2013-07-11 02:32:37 -04:00
Matthias Sohn 58a5b6d0c6 Add missing @since tags
Change-Id: I6f672249d7ca014c63fb939cd0836689eb27ab90
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-07-11 00:18:48 +02:00
Christian Halstrick f45288e7c4 Add tests for DirCacheCheckout and symlinks
DirCacheCheckout had a bug when the parentdirectory of a worktree was a
symlink. DirCacheCheckout was deleting those symlinks under certain
conditions. This was fixed in I81735ba0394ef6794e9b2b8bdd8bd7e8b9c6460f
without a test because previously it was hard to setup tests containing
symlinks.

BUG: 412489
Change-Id: I2513166af519d6fc01d1eae3976ad6cff6f98530
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-07-10 23:12:31 +02:00
Dave Borowitz 4af82ed04c Merge changes If386fe25,I52a17499,Id12e7f00,I264e028a,I0d52af8a,I0d0cc4f8
* changes:
  UploadPack: allow custom RequestValidator instances
  UploadPack: refactor want validation
  UploadPack: set RefFilter from TransportConfig
  UploadPack: configure RequestPolicy with TransportConfig
  UploadPack: advertise allow-tip-sha1-in-want
  Add RequestPolicy.TIP to allow fetching non-advertised ref tips
2013-07-10 14:50:41 -04:00
Christian Halstrick 4b1f368033 Make sure checkout is not deleting folders outside the workingtree
There was a chance that jgit deletes symbolic links which point to the
folder on top of the working tree. Make sure not to touch these
resources.

Thanks to Cedric Darloy who reported this bug on
http://www.eclipse.org/forums/index.php/m/776910/#msg_776910 and to
Ondrej Vrabec who reported bug 412489.

Bug: 412489
Change-Id: I81735ba0394ef6794e9b2b8bdd8bd7e8b9c6460f
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-07-10 11:38:03 +02:00
Robin Stocker 56ee811780 Fix bugs in TreeWalk#isPathSuffix used by PathSuffixFilter
* It didn't check the first character in the pattern due to a off-by-one
  error. Spotted by James Roper.
* It returned true even when pattern was longer than current path, e.g.
  it returned that ".txt" is suffix of "txt".

Bug: 411999
Change-Id: I9fbcd68a11fb57cc49956b70c387a47271a0424f
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-07-08 10:53:50 +02:00
Hiroshi Tomita 8e307cde56 Check parentFile is not null
parentFile becomes null when f is relative path, such as ".".

This patch avoids NullPointerException in such case.

Change-Id: I4752674b1daab6eedd7c3650c7749462810eaffd
Signed-off-by: Hiroshi Tomita <tomykaira@gmail.com>
2013-07-05 09:09:04 +09:00
Dave Borowitz 360d8624ca UploadPack: allow custom RequestValidator instances
Make the existing concrete implementations public as well so custom
implementations may delegate to them where appropriate. Treat all custom
implementations as providing allow-tip-sha1 in want.

Change-Id: If386fe25c0d3b4551a97c16a22350714453b03e9
2013-07-03 15:44:42 -07:00
Dave Borowitz 68ccc5d213 UploadPack: refactor want validation
Associate each RequestPolicy with an implementation of a
RequestValidator interface that contains the validation logic. The
checkWants method is only called if there are wants that were not
advertised, since clients may always request any advertised want
according to the git protocol. Calling the method only once at the
end of parsing the want list also means policy implementations can be
stateful, unlike the previous switch statement inside a loop.

For the special handling of unidirectional pipes, simply check
isBiDirectional() and delegate to other implementations if necessary.

Change-Id: I52a174999ac3a5aca46d3469cb0b81edd1710580
2013-07-03 15:14:29 -07:00
Dave Borowitz e74751769e UploadPack: set RefFilter from TransportConfig
Teach TransportConfig to respect uploadpack.hiderefs, which is new in
C git 1.8.2.

Change-Id: Id12e7f00b9a60258e996410f67fa10616459f53f
2013-07-03 15:10:39 -07:00
Dave Borowitz e599af1900 UploadPack: configure RequestPolicy with TransportConfig
C git 1.8.2 supports setting the equivalent of RequestPolicy.TIP with
uploadpack.allowtipsha1. Parse this into TransportConfig and use it
from UploadPack. An explicitly set RequestPolicy overrides the config,
and the policy may still be upgraded on a unidirectional connection to
avoid races.

Defer figuring out the effective RequestPolicy to later in the
process. This is a minor semantic change to fix a bug: previously,
calling setRequestPolicy(ADVERTISED) _after_ calling
setBiDirectionalPipe(true) would have reintroduced the race condition
otherwise fixed by 01888db892.

Change-Id: I264e028a76574434cecb34904d9f5944b290df78
2013-07-03 15:09:55 -07:00
Dave Borowitz b4b84a84bd UploadPack: advertise allow-tip-sha1-in-want
This protocol capability, new in C git 1.8.2, corresponds to
RequestPolicy.TIP, so advertise it if that request policy was set.

Change-Id: I0d52af8a7747e951a87f060a5124f822ce1b2b26
2013-07-03 15:09:55 -07:00
Dave Borowitz fee679b587 Add RequestPolicy.TIP to allow fetching non-advertised ref tips
Users of UploadPack may set a custom RefFilter or AdvertisedRefsHook
that limits which refs are advertised, but clients may learn of a
SHA-1 that the server should have as a ref tip through some
alternative means. Support serving such objects from the server side
with a new RequestPolicy.

As with ADVERTISED, we need a special relaxed RequestPolicy to allow
commits reachable from the set of valid tips for unidirectional
connections.

Change-Id: I0d0cc4f8ee04d265e5be8221b9384afb1b374315
2013-07-03 15:09:55 -07:00
Robin Stocker 21b3a16ab7 Merge "Update HEAD in cherry-picking several commits" 2013-07-02 07:12:32 -04:00