Commit Graph

1224 Commits

Author SHA1 Message Date
Stefan Lay f86a488e32 Implement rebase.autostash
This feature was introduced in native git with version 1.8.4.

Bug: 422951
Change-Id: I42f194174d64d7ada6631e2156c2a7bf93b5e91c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-04 22:02:22 +01:00
Christian Halstrick 77432969d3 Merge "More helpful InvalidPathException messages (include reason)" 2013-12-04 03:23:56 -05:00
Robin Stocker e0502ebb03 More helpful InvalidPathException messages (include reason)
Instead of just a generic "Invalid path: $path", add a reason for the
cases where it's not obvious what the problem is (e.g. "aux" being
reserved on Windows).

Bug: 413915
Change-Id: Ia6436bd2560e4f049c92d9aac907cb87348605e0
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-12-03 23:10:05 +01:00
Robin Stocker f4dae204a6 Fix IgnoreRule#isMatch returning wrong result due to missing reset
The matcher has to be reset before using it, as was already done in the
other cases.

Bug: 423039
Change-Id: I87abaa7ad7f0aac8651db6e88d41427cacb4d776
Also-by: Ondrej Vrabec <ovrabec@netbeans.org>
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-12-03 22:30:14 +01:00
Robin Stocker 7dc8a4f089 Fix exception on conflicts with recursive merge
When there are conflicts with a recursive merge, the conflicting paths
are stored in unmergedPaths (field in ResolveMerger). Later, when the
MergeResult is constructed in MergeCommand, getBaseCommit is called,
which computes the merge base a second time.

In case of RecursiveMerger, getBaseCommit merges the multiple merge
bases into one. It does this not by creating a new ResolveMerger but
instead calling mergeTrees. The problem with mergeTrees is that at the
end, it checks if unmergedPaths is non-empty and returns false in that
case.

Because unmergedPaths was already non-empty because of the real merge,
it thinks that there were conflicts when computing the merge base again,
when there really were none.

This can be fixed by storing the base commit when computing it and then
returning that instead of computing it a second time.

Note that another possible fix would be to just use a new ResolveMerger
for merging the merge bases instead. This would also remove the need to
remember the old value of dircache, inCore and workingTreeIterator (see
RecursiveMerger#getBaseCommit).

Bug: 419641
Change-Id: Ib2ebf4e177498c22a9098aa225e3cfcf16bbd958
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-12-03 21:05:37 +01:00
Stefan Lay 591998c2d6 Do not allow non-ff-rebase if there are uncommitted changes
With this change jgit checks for uncommitted changes before a rebase is
started. This is also done by native git. One reason is that an abort
would override such changes. The check is skipped for a non-interactive
rebase when it will result in a fast-forward. In this case there can be
only checkout conflicts but no merge conflicts, so there cannot be an
abort which overrides uncommitted changes.

Bug: 422352
Change-Id: I1e0b59b2a4d80a686b67a6729e441924362b1236
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-02 09:45:15 +01:00
Christian Halstrick af40635aba Fix handling of file/folder conflicts during a checkout
JGit was not handling certain file/folder conflicts during a checkout
correctly. This was reported by Axel Richard in
http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02358.html.
This commit fixes this problem.

Still JGit behaves intentionally different than native git.
If HEAD contains a tree, and workingtree, Index and Merge contain a file
with same content ... then JGit allows a conflict free checkout of
Merge. Native git always complains that it doesn't want to overwrite
local changes. But there is no need to update the working tree because
Index and Merge are already equal.

A shell script which shows how native git behaves can be found here.
https://gist.github.com/chalstrick/7694959#file-gistfile1-sh

Change-Id: Ifd6a68974d61cd4fa23bc575f3a40773db66cafc
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2013-11-29 22:32:36 +01:00
Stefan Lay dcd0dd4d9e Fix applying stash on other commit
Applying a stash on another commit failed because the merge base for the
cherry-pick of the stashed index state was not corectly set.

Bug: 422684
Change-Id: I9355352b2b9a7abefa3248ca3c17a9301177d0d6
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2013-11-29 10:36:53 -05:00
Shawn Pearce 53616a85ef Break up GCTest to run in parallel
Separate some sections of the GC tests into different test classes.
Individual classes permits running in parallel under Buck, reducing
test latency if there are sufficient CPUs available.

Change-Id: I5eb177f78efd4aa8ac857d0d8b1a1fd81ca07790
2013-11-24 11:37:49 +01:00
Shawn Pearce 531d577658 Modify T0004_PackReaderTest to use existing pack
Instead of making a new PackFile from a resource, lookup
the existing PackFile that was already created by the base
class SampleDataRepositoryTestCase.

Change-Id: Ib5da18c832ae0cb29703706b99e99503f5cc819d
2013-11-24 05:27:21 -05:00
Shawn Pearce d54d19740a Move SampleDataRepositoryTestCase to org.eclipse.jgit.test
This class requires resources which are private to another
bundle. Move the class next to its resources, removing an
odd cross bundle dependency.

Change-Id: I30d5568b09ea5fb3bd3bb60b602f149c0867f49a
2013-11-24 05:27:14 -05:00
Matthias Sohn 7f7dd171df Cache SimpleDateFormat in GitDateParser per locale
Otherwise switching to another locale yields wrong results when parsing
date strings in GitDateParser. Since the MockSystemReader explicitly
uses english locale the tests need to specify the locale to be used when
parsing date strings.

Bug: 420772
Change-Id: I313ef6b1e9ef3bfb43d929ce34712ebd21f2cd9c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-23 22:06:08 -05:00
Stefan Lay 8339a07e83 Fix FIXUP error for blank lines in interactive rebase
Empty lines of discarded commit messages were added to the commit
message because they were not commented out properly.

Bug: 422246
Change-Id: I263e8a6b30a3392d8b4f09c0695505068a0a485d
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2013-11-22 16:50:44 -05:00
Stefan Lay 4feace2b9e Fix parsing Rebase todo lines when commit message is missing
Bug: 422253
Change-Id: I9739b16c91d2df31a481360a712d3479a4eeee2e
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2013-11-21 14:47:24 +01:00
Christian Halstrick 7dce16018e Add close() method to API
The API in org.eclipse.jgit.api does allow to open repositories but it
did not allow to close them. This commit fixes this and allows
API users to close a repository without having to use lower-level
classes.

Bug: 420502
Change-Id: I866225cc8534ae5916113fa24eb1c7513fd4472e
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-20 00:16:39 +01: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 f1c086f692 [findBugs] Remove nonsense call
Result of c.containsAll(c)  is always true for any collection c.

Change-Id: I853cbb44bdc03e2b54229bb9c36ae42e02dcc4d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-10 16:01:09 -05:00
Matthias Sohn 1ec72e9a1c Remove unnecessary @SuppressWarnings("null")
Change-Id: I5bddcdab2c5cc92622144a7b207bad90cb601609
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-10 16:00:12 -05:00
Matthias Sohn b6cf49b2bd Don't import non-existing package org.eclipse.jgit.java7
Change-Id: Idc48cb1995050913498d2bad97a8e6e330dee94c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-10 00:01:51 +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 35331a916a Also use MockSystemReader in GitDateParserBadlyFormattedTest
All tests should use MockSystemReader to isolate them from the
underlying platform specifics.

GitDateParserBadlyFormattedTest wasn't using MockSystemReader which
induced Bug 420772 as a side effect since GitDateParser caches
SimpleDateFormat instances without regarding their locale. This will be
fixed in another change

Bug: 420772
Change-Id: I798e55d05730a71bb0326f80aea5488541d6c1f2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-05 09:29:13 +01:00
Christian Halstrick b686fa45b6 Merge "testMaliciousPathEmpty fails on Windows" 2013-11-04 07:39:43 -05:00
Shawn Pearce 75cfa03e16 Use absolute paths for file:// URIs in tests
When run under Buck the repository paths may be relative.  Request
an absolute path to construct the URI, as relative paths are not
supported in file:// style URIs.

Change-Id: I85470d1db2f4e80cba30f1559c0d99bdfa8ac410
2013-11-01 19:57:47 -07:00
Shawn Pearce 1c4216e4bc Move repeat() to utility class for tests
Avoid depending on AutoCRLFOutputStreamTest from within another
test such as AutoCRLFInputStreamTest. Breaking the dependency up
allows the test classes to be built and executed in parallel.

Change-Id: Ic9ab2b6ec74ac87ff4adda8a802ae343dd2a6235
2013-11-01 19:57:47 -07:00
Shawn Pearce cc3ec72734 Remove hardcoded target/trash from test cases
Buck does not create a target directory for the build output, this
is Maven specific and the project unit tests should not rely on it.

Instead follow the pattern used by org.eclipse.jgit.test which is to
create a temporary directory in the system temporary folder, and
configure the Maven surefire plugin to use the target directory.

Change-Id: Iebe5093332343a90f51080614e083aac0d29c26d
2013-11-01 19:57:47 -07:00
Shawn Pearce e59b324095 Remove dependency on StatusCommandTest
Move the set constructor function to a Sets utility class,
allowing the tests to compile in parallel.

Change-Id: Id6fac2533fab8d423f949c892f199af2491a450b
2013-11-01 19:57:47 -07:00
Shawn Pearce 5f9656c404 Remove dependency on DiffFormatterReflowTest
Reference the resource from the root of the CLASSPATH, allowing the
test classes to be compiled in parallel with no dependencies.

Change-Id: Ia6becf30ccfe93b8585b82293d9a4863b0cf837e
2013-11-01 19:57:47 -07: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
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 a0cef63f6d Merge "Fix failed tests when the tmp directory is a symlink" 2013-10-19 18:14:46 -04:00
Robin Rosenberg 068e2df1ce Fix failed tests when the tmp directory is a symlink
On Mac OS X /tmp is by default a symbolic link.

Change-Id: I0913ee5ee8db5c5918a9e41abbbfe125b6c70783
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-20 00:13:58 +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 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 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
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
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
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 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
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
Robin Stocker c222b18808 Refactor PathSuffixFilterTest to remove duplication
Makes it possible to add new test cases without copying lots of lines.

Change-Id: I66db3bc0cbd18fb5a07748905c60384b86b1c162
Signed-off-by: Robin Stocker <robin@nibor.org>
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
Robin Rosenberg 8a7f4864d8 Fix tests for OS X when the tmpdir is the default /tmp
/tmp is a symbolic link and some tests break when the path
gets canonicalized by JGit or Jetty. Allow Jetty to serve
symlinks by setting init parameter "aliases" to true [1].

[1] http://wiki.eclipse.org/Jetty/Howto/How_to_serve_symbolically_linked_files

Change-Id: I45359a40435e8a33def6e0bb6784b4d8637793ac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
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 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
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 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
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 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
Robin Stocker 12326ddead Refactor PathSuffixFilterTest to remove duplication
Makes it possible to add new test cases without copying lots of lines.

Change-Id: I66db3bc0cbd18fb5a07748905c60384b86b1c162
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-07-08 10:53:39 +02:00
Robin Stocker 21b3a16ab7 Merge "Update HEAD in cherry-picking several commits" 2013-07-02 07:12:32 -04:00
Hiroshi Tomita 6845bb5b3e 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-07-01 22:37:48 +09:00
Colby Ranger 903fb9c739 Implement get nth offset in PackIndex.
Currently, the offset can only be retrieved by ObjectId or iterating all
of the entries. Add a method to lookup the offset by position in the
index sorted by SHA1.

Change-Id: I45e9ac8b752d1dab47b202753a1dcca7122b958e
2013-06-28 15:36:20 -07:00
Alex Rukhlin 98dd6e6abd 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-06-23 23:45:42 +02:00
Dave Borowitz b646578d89 Add a method to DfsOutputStream to read as an InputStream
Change-Id: I0ec1f17a88bc14f22c10f9bc8d6f5b5118410e3a
2013-06-19 09:36:10 -07:00
Robin Rosenberg 7f43d04986 Fix tests for OS X when the tmpdir is the default /tmp
/tmp is a symbolic link and some tests break when the path
gets canonicalized by JGit or Jetty. Allow Jetty to serve
symlinks by setting init parameter "aliases" to true [1].

[1] http://wiki.eclipse.org/Jetty/Howto/How_to_serve_symbolically_linked_files

Change-Id: I45359a40435e8a33def6e0bb6784b4d8637793ac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-16 23:32:37 +02:00
Robin Stocker 01ebfa6c17 Disable warning about assigning to parameter
See change I08bed4275af9ec52aa4d7054067ac82f6a3c9781, where fixing such
warning lead to complaints.

If fixing is not wanted, disable it instead.

Change-Id: If31d4028fa1c6377a11e83ed5688b45701cec68b
2013-06-15 15:11:54 +02:00
Robin Rosenberg b0ffacf122 Recognize CRLF when parsing the short message of a commit or tag
Bug: 400707
Change-Id: I9b09bb88528af465018fc0278f5441f7e6b75986
2013-06-14 19:52:29 -04:00
Matthias Sohn 4b68f2a532 Merge "document empty blocks in StashApplyCommandTest" 2013-06-14 18:57:59 -04:00
Tomasz Zarna 28ab9b8393 document empty blocks in StashApplyCommandTest
Change-Id: I5b49bd00b00b86584b912fc5f503abf29db0f56e
2013-06-13 10:25:43 -04:00
Matthias Sohn 6b9c0d1232 Prepare 3.1.0-SNAPSHOT builds
Change-Id: I7490a7c9558423c03e3c167ad55b9a98be9d99d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-13 16:13:32 +02:00
Matthias Sohn 2cd3a2df56 Merge branch 'stable-3.0'
* stable-3.0:
  Prepare post 3.0.0.201306101825-r builds
  JGit v3.0.0.201306101825-r
  Make JGit test work with both hamcrest 1.1 (juno) and 1.3 (kepler)
  Fix version.sh to not overwrite ${project.version}
  Prepare post 3.0.0 RC3 builds
  JGit v3.0.0.201306040240-rc3

Change-Id: I5b1db1f5b69bad1136dd21b956e798f63b1ba0ee
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-13 15:51:44 +02:00
Matthias Sohn 01f6d91476 Prepare post 3.0.0.201306101825-r builds
Change-Id: I299cf1addc0987ffe39140d2216ab6a98e95ce52
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-13 15:48:41 +02:00
Matthias Sohn f384644774 JGit v3.0.0.201306101825-r
Change-Id: Ie8deab94c6263b5198f0bcb4533b1cfb3f5724b1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-11 00:56:27 +02:00
Robin Rosenberg b83c269369 Make JGit test work with both hamcrest 1.1 (juno) and 1.3 (kepler)
The hamcrest library has moved things around. This problem applies only
to the test, not plugin runtime.

Change-Id: I5b97f356d8595dbdc9e91d157558e40561a6a30d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-09 00:50:51 +02:00
Matthias Sohn bf388c2e32 Prepare post 3.0.0 RC3 builds
Change-Id: I008d55e2ef0aac9d1877b05ba73e3cf26335d430
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-04 13:54:39 +02:00
Matthias Sohn a898836eac JGit v3.0.0.201306040240-rc3
Change-Id: I8b782e9ebe03e5f72611a21a76d80c6b20cb7845
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-04 09:02:36 +02:00
Matthias Sohn 658401c8ef Merge branch 'stable-3.0'
* stable-3.0:
  Prepare post 3.0.0-rc2 builds
  JGit v3.0.0.201305281830-rc2
  Support refspecs with wildcard in middle (not only at end)
  Fix multiple bugs in RawSubStringPattern used by MessageRevFilter
  Handle short branch/tag name for setBranch in CloneCommand
  Add missing Bundle-Localization header
  Apply tree filter marks when pairing DiffEntry for renames
  Improve feature names to become understandable by end users
  Update kepler orbit version to R20130517111416
  Fix BatchRefUpdate progress-monitoring so it doesn't count twice
  Fix AnyObjectId's generic type declaration of Comparable
  Fix DiffFormatter NPEs for DiffEntry without content change
  Fix CommitCommand not to destroy repo
  Fix the parameters to an exception
  Prepare post 3.0.0 M7 builds
  JGit v3.0.0.201305080800-m7

Change-Id: Ia8441c9796f01497e0d90e672c0aaf60520a0098
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-29 12:28:10 +02:00
Matthias Sohn 0603519aad Prepare post 3.0.0-rc2 builds
Change-Id: Ic46832bcde80d0bf74c16cb094abd76b00552d14
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-29 10:37:17 +02:00
Matthias Sohn 30fad6758f JGit v3.0.0.201305281830-rc2
Change-Id: I490ad8cc7590f70783d3fbd6dd6f0e0446ae5afe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-29 00:49:12 +02:00
Robin Stocker a51899c203 Support refspecs with wildcard in middle (not only at end)
The following refspec, which can be used to fetch GitHub pull requests,
is supported by C Git but was not yet by JGit:

  +refs/pull/*/head:refs/remotes/origin/pr/*

The reason is that the wildcard in the source is in the middle.

This change also includes more validation (e.g. "refs//heads" is not
valid) and test cases.

Bug: 405099
Change-Id: I9bcef7785a0762ed0a98ca95a0bdf8879d5702aa
2013-05-28 05:33:03 -04:00
Robin Stocker ec97912762 Fix multiple bugs in RawSubStringPattern used by MessageRevFilter
* Match at end of input was not handled correctly.
* When more than one character matched but not all, the next character
  was not considered as a match start (e.g. pattern "abab" didn't match
  input "abaabab").

Bug: 409144
Change-Id: Ia44682c618bfbb927f5567c194227421d222a160
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-28 01:40:13 +02:00
Robin Stocker 7bb2a1b844 Handle short branch/tag name for setBranch in CloneCommand
Before, it was not clear from the documentation what kind of branch name
was accepted. Users specifying "branch" (instead of "refs/heads/branch")
got no error message and ended up with a repository without HEAD and no
checkout.

With this, CloneCommand now tries "$branch", then "refs/heads/$branch"
and then "refs/tags/$branch". C Git only does the last two, but for
compatibility we should still allow "refs/heads/branch".

Bug: 390994
Change-Id: I4be13144f2a21a6583e0942f0c7c40da32f2247a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-26 01:25:10 +02:00
Roberto Tyley b4b3999f82 Fix BatchRefUpdate progress-monitoring so it doesn't count twice
I was seeing output like this while running The BFG:

Updating references:    200% (374/187)

...issue sneaked in with 5cf53fda I think.

The update call is also moved to the end of the loop, as update() is
only supposed to be called after work has been done ("Denote that some
work units have been completed").

Change-Id: I1620fa75be16dc80df44745d0e123ea512762e31
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-05-19 13:20:47 +02:00
Robin Stocker 92189b2df4 Fix DiffFormatter NPEs for DiffEntry without content change
DiffEntry.getOldId() returns null for a diff without an index line (e.g.
only mode changed, rename without content change).

Bug: 407743
Change-Id: I42eac87421f2a53c985af260a253338f578492bc
2013-05-15 12:23:40 +02:00
Christian Halstrick c93a593302 Fix CommitCommand not to destroy repo
There was a severe bug in CommitCommand which could corrupt
repos. When merging an annotated tag the JGit MergeCommand writes
correctly the ID of the tag (and not the id of the commit the tag was
pointing to) into MERGE_HEAD. Native git does the same. But
CommitCommand was reading this file and trusting blindly that it will
contain only IDs of commits. Then the CommitCommand created a
commit which has as parent a non-commit object (the tag object). That's
so corrupt that even native git gives up when you call "git log" in
such a repo.

To reproduce that with EGit simply right-click on a tag in the
Repository View and select Merge. The result was a corrupt repo!

Bug: 336291
Change-Id: I24cd5de19ce6ca7b68b4052c9e73dcc6d207b57c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-11 22:45:29 +02:00
Shawn Pearce 36144e12d8 Fix hardcoded use of target/trash in LocalDiskRepositoryTestCase
`pwd`/target is only valid in Maven Reactor builds where Maven
has moved into the project directory and created a target for
the build output. Most other build systems do not use "target"
and may not even perform a directory change between test suites.

Rewrite LocalDiskRepositoryTestCase's temporary directory code
to use the system specified location and create new unique names.
This prevents fixes between concurrently running tests and allows
the caller to specify the root using java.io.tmpdir.

Update the surefire command lines to use target within each project as
the system temporary directory during unit testing, preventing JGit's
own test suite from writing to /tmp or somewhere like C:\tmp.

Change-Id: I9e8431f6ddfc16fee89f677bcce67c99cfb56782
2013-05-08 17:59:34 -07:00
Matthias Sohn 4800ac50f9 Prepare post 3.0.0 M7 builds
Change-Id: I062c44529c7ae2f960d3c64a0923a45d2dc8a863
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-08 22:26:47 +02:00
Matthias Sohn 00108d01ff JGit v3.0.0.201305080800-m7
Change-Id: I377b174993862918a117f54e6cba4733dfc2307c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-08 13:58:26 +02:00
Matthias Sohn d7cc6eb002 Move org.eclipse.jgit.pgm's resource bundle to internal package
Translatable texts aren't API and shouldn't require maintenance of
@since tags to prevent API warnings.

Change-Id: I228ff37f17c0e792a6bc188c463a0d19138e88ac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-06 23:48:19 +02:00
Shawn Pearce 75e1bdb3c1 Merge "URIish: Allow multiple slashes in paths" 2013-05-05 12:51:44 -04:00
Dave Borowitz b0326235e1 Remove unused repository field from RevWalk
The comment about legacy Tag and Object types no longer applies,
though prior to Idb273d5a92849b42935ac14eed73b796b80aad50 the field
was still being used by RewriteTreeFilter.

Change-Id: I9ee5da8f8a3b61c9cf543817c03117ee0609dd8f
2013-05-05 11:48:41 -04:00
Shawn Pearce a626f9fd66 Merge "Require a DiffConfig when creating a FollowFilter" 2013-05-05 11:47:53 -04:00
Dave Borowitz 0bdf030b26 Require a DiffConfig when creating a FollowFilter
The various rename detection options are an inherent part of the
filter, similar to the path being followed.

This fixes a potential NPE when a RevWalk with a FollowFilter is
created without a Repository, since the old code path tried to get
the DiffConfig from the RevWalk's possibly-missing repository.

Change-Id: Idb273d5a92849b42935ac14eed73b796b80aad50
2013-05-05 08:41:09 -07:00
Robin Rosenberg dd3181603e Extend the FS class for Java7
The most important difference is that in Java7 we have symbolic links
and for most operations in the work tree we want to operate on the link
itself rather than the link target, which the old File methods generally
do.

We also add support for the hidden attribute, which only makes sense
on Windows and exists, just since there are claims that Files.exists
is faster the File.exists.

A new bundle is only activated when run with a Java7 execution
environment. It is implemented as a fragment.

Tycho currently has no way to conditionally include optional features
based on the java version used to run the build, this means with this
change the jgit packaging build always needs to be run using java 7.

Change-Id: I3d6580d6fa7b22f60d7e54ab236898ed44954ffd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-05-04 02:01:56 +02:00
Robin Rosenberg b8e763fc19 TagCommand should be able to create unannotated tags too
Using the low level API's is just too cumbersome.

Change-Id: Id5b9f560ee095d6db0b2ea5b26aef3e53021626e
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-05-03 15:36:27 +02:00
Robin Stocker e8f720335f Add test for RefUpdate delete without HEAD
Bug: 406722
Change-Id: I555fb366ee64d885de2a71a67cf00833f4c62561
2013-05-03 09:18:09 -04:00
Robin Stocker f448d62d29 Update tags on fetch if --tags or tag refspec specified
When either --tags or a tag ref is explicitly specified on fetch, C Git
updates existing local tags if they are different.

Before this change, JGit returned REJECTED in such a case. Now it
updates it and returns FORCED.

Example:

    % mkdir a
    % cd a
    % git init -q
    % touch test.txt
    % git add test.txt
    % git commit -q -m 'Initial'
    % git tag v1
    % cd ..
    % git clone -q a b
    % cd a
    % echo Test > test.txt
    % git commit -q -a -m 'Second'
    % git tag -f v1
    Updated tag 'v1' (was bc85c08)
    % cd ../b
    % git fetch --tags
     - [tag update]      v1         -> v1

Bug: 388095
Change-Id: I5d5494c2ad1a2cdb8e9e614d3de445289734edfe
2013-05-01 16:02:01 +02:00
Robin Stocker 68b378a4b5 Only fetch tags that do not exist locally with auto-follow
This corresponds to what C Git does, quoting from the fetch man page:

  This is done by first fetching from the remote using the given
  <refspec>s, and if the repository has objects that are pointed by
  remote tags that it does not yet have, then fetch those missing tags.

Before, JGit would also fetch tags that exist locally but point to a
different object, resulting in REJECTED results for these.

Also add some test cases to cover more cases.

Bug: 388095
Change-Id: Ib03d2d82e9c4b60179d626cfd5174be1da6388b2
Also-by: Stefan Lay <stefan.lay@sap.com>
2013-05-01 16:00:42 +02:00
Robin Stocker 8bd1e86bb7 Abort before delete in FileUtils.delete EMPTY_DIRECTORIES_ONLY|RECURSIVE
Depending on the order in which items are traversed for RECURSIVE, an
empty directory may come first before detecting that there is a file and
aborting.

This fixes it by traversing files first.

Bug: 405558
Change-Id: I638b7da58e33ffeb0fee172b96f4c823943d29e9
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-04-29 01:00:35 +02:00
Robin Rosenberg 687b887c68 Merge "Make the Reflog a public API again" 2013-04-27 08:56:37 -04:00
Robin Stocker 23e3fb135b URIish: Allow multiple slashes in paths
It's also allowed by C Git.

Change-Id: Ie0a0d1f57d84e70fd5ef50b7844d22fea43d0e08
2013-04-27 14:35:12 +02:00
Robin Rosenberg 9dcd8c2c90 Make the Reflog a public API again
Change-Id: I8ced7098da5b345fd9af2fdfafd1ef6a44ccee0d
2013-04-26 00:57:17 +02:00
Shawn Pearce 1b4320f1fa Revert "Add tests for FileUtils.delete and EMPTY_DIREECTORIES_ONLY"
This reverts commit 7aa54967a2.
The unit test dependend upon the specific order of names that
listFiles() returned members in. The order is completely undefined
and may differ even on different versions of Linux based systems.

A proper unit test for this code would have considered both cases,
where the deletion function was able to remove an empty subdirectory,
or fail to remove a subdirectory because a file was still present
within. This is not such a test.

Change-Id: Ib0a706fea01e4b1ed8c8e859247d247a1279b4bc
2013-04-19 12:04:47 -07:00
Robin Stocker 1080cc5a0d IndexDiff: Provide stage state for conflicting entries
Adds a new method getConflictingStageStates() which returns a
Map<String, StageState> (path to stage state). StageState is an enum for
all possible stage combinations (BOTH_DELETED, ADDED_BY_US, ...).

This can be used to implement the conflict text for unmerged paths in
output of "git status" or in EGit for decorations/hints.

Bug: 403697
Change-Id: Ib461640a43111b7df4a0debe92ff69b82171329c
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2013-04-19 10:05:06 -05:00
Robin Rosenberg 1c40d83f52 Merge "A deleted work tree file is not a conflict when merge wants to delete it" 2013-04-19 07:39:39 -04:00
Robin Rosenberg f37e25e2c3 Merge "Untracked files should not be included in stash" 2013-04-19 07:36:29 -04:00
Matthias Sohn 427db940ca Do not export package org.eclipse.jgit from jgit tests
Commit 3344b93c erroneously exported the package org.eclipse.jgit.lib
from the org.eclipse.jgit.test bundle which made this a split package
since the bundle org.eclipse.jgit exports the same package. 

Split packages are evil in general and most probably caused the build
cycle errors observed recently when importing the jgit projects in
Eclipse [1].

[1] http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02012.html

Change-Id: I89919e56b928acdbff0b90e3919808025a8562c6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-04-19 09:23:24 +02:00
Robin Rosenberg 7a42b7fb95 Untracked files should not be included in stash
The previous code stashed untracked files and left them
in the work tree.

Bug: 403282
Change-Id: I71727addb2b55fb8e409cae2b6af8138b1ff7ef1
2013-04-18 23:19:15 +02:00
Robin Rosenberg 526b6266a5 Remove some unnecessary dependencies on FileRepostory
Change-Id: Ib6ee3a2874a7e2240aa68f4ac32d00c4d1fab5ae
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2013-04-18 15:33:50 -05:00
Robin Rosenberg 6e90671a51 Merge "Remove unused dependencies" 2013-04-18 16:29:35 -04:00
Robin Stocker 78fca8a099 Improve test coverage of AutoCRLF(In|Out)putStream
Bug: 405672
Change-Id: I3894e98617fcee16dc2ac9853c203c62eb30c3ab
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2013-04-18 14:58:51 -05:00
Robin Rosenberg 4c638be79f Fix boundary conditions in AutoCRLFOutputStream
This fixes some problems with inputs around the size of the internal
buffer in AutoCRLFOutputStream (8000).

Tests supplied by Robin Stocker.

Bug: 405672
Change-Id: I6147897290392b3bfd4040e8006da39c302a3d49
2013-04-14 19:53:48 +02:00
Robin Rosenberg 4955301fac Merge "Consider working tree changes when stashing newly added files" 2013-04-11 02:06:54 -04:00
Shawn Pearce b5cbfa0146 Merge changes Ideecc472,I2b12788a,I6cb9382d,I12cd3326,I200baa0b,I05626f2e,I65e45422
* changes:
  Increase PackOutputStream copy buffer to 64 KiB
  Tighten object header writing in PackOutuptStream
  Skip main thread test in ThreadSafeProgressMonitor
  Declare members of PackOutputStream final
  Always allocate the PackOutputStream copyBuffer
  Disable CRC32 computation when no PackIndex will be created
  Steal work from delta threads to rebalance CPU load
2013-04-10 20:56:13 -04:00
Robin Rosenberg 8272f65730 Merge "LogCommand.all(): filter out refs that do not refer to commit objects" 2013-04-10 17:30:18 -04:00
Robin Rosenberg ad2ffc576b Merge "LogCommand.all(), peel references before using them" 2013-04-10 17:29:58 -04:00
Shawn Pearce d01fe32795 Skip main thread test in ThreadSafeProgressMonitor
update(int) is only invoked from a worker thread, in JGit's case
this is DeltaTask. The Javadoc of TSPM suggests update should only
ever be used by a worker thread.

Skip the main thread check, saving some cycles on each run of the
progress monitor.

Change-Id: I6cb9382d71b4cb3f8e8981c7ac382da25304dfcb
2013-04-10 12:59:11 -07:00
Robin Rosenberg 1bede91db2 Consider working tree changes when stashing newly added files
Bug: 402396
Change-Id: I50ff707c0c9abcab3f98eea21aaa6e824f7af63a
2013-04-09 21:28:15 +02:00
Matthias Sohn 135a78cfcb Remove unused dependencies
Change-Id: I3cd161ac360a2e2635bffe309725a41c9527694e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-04-09 16:57:54 +02:00
Matthias Sohn 011f7fd27d Fix plugin provider names to conform with release train requirement
According to release train requirements [1] the provider name for all
artifacts of Eclipse projects is "Eclipse <project name>".

[1] http://wiki.eclipse.org/Development_Resources/HOWTO/Release_Reviews#Checklist

Change-Id: I8445070d1d96896d378bfc49ed062a5e7e0f201f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-04-08 23:05:36 +02:00
Robin Rosenberg cc00feaa8d A deleted work tree file is not a conflict when merge wants to delete it
Bug: 405199
Change-Id: I4b2ef3dc432d2fad8a6fabd1c8aec407b5c8c5ac
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2013-04-08 22:43:39 +02:00
Gustav Karlsson b3e9626743 Added characters to be escaped in file name patterns
Originally, characters could not be escaped in FileNameMatcher patterns.
This breaks file name matching when escaped brackets "\[" and "\]" are
used in the pattern. A fix has been implemented to allow for any
character to be escaped by prepending it with a '\'

Bug: 340715
Change-Id: Ie46fd211931fa09ef3a6a712bd1da3d7fb64c5e3
Signed-off-by: Gustav Karlsson <gustav.karlsson@tieto.com>
2013-04-06 18:23:33 +02:00
Tomasz Zarna 5453585773 Add the no-commit option to MergeCommand
Added also tests and the associated option for the command line Merge
command.

Bug: 335091
Change-Id: Ie321c572284a6f64765a81674089fc408a10d059
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-04-04 15:11:49 +02:00
Christian Halstrick 81b601de53 Merge "Fix PathFilterGroup not to throw StopWalkException too early" 2013-04-04 03:42:25 -04:00
Christian Halstrick ac0481039d Merge "Indicate initial commit on a branch in the reflog" 2013-04-04 03:41:56 -04:00
Robin Rosenberg c9a94dc1ee Fix PathFilterGroup not to throw StopWalkException too early
Due to the Git internal sort order a directory is sorted as if it ended
with a '/', this means that the path filter didn't set the last possible
matching entry to the correct value. In the reported issue we had the
following filters.

	org.eclipse.jgit.console
	org.eclipse.jgit

As an optimization we throw a StopWalkException when the walked tree
passes the last possible filter, which was this:
	org.eclipse.jgit.console

Due to the git sorting order, the tree was processed in this order:
	org.eclipse.jgit.console
	org.eclipse.jgit.test
	org.eclipse.jgit

At org.eclipse.jgit.test we threw the StopWalkException preventing the
walk from completing successfully.

A correct last possible match should be:
	org.eclipse.jgit/

For simplicit we define it as:
	org/eclipse/jgit/

This filter would be the maximum if we also had e.g. org and org.eclipse
in the filter, but that would require more work so we simply replace all
characters lower than '/' by a slash.

We believe the possible extra walking does not not warrant the extra
analysis.

Bug: 362430
Change-Id: I4869019ea57ca07d4dff6bfa8e81725f56596d9f
2013-04-03 14:07:23 -04:00
Robin Rosenberg 65027d8bb4 Indicate initial commit on a branch in the reflog
Bug: 393463
Change-Id: I4733d6f719bc0dc694e7a6a6ad2092de6364898c
2013-04-02 21:57:17 +02:00
Arthur Baars 35be98fb8f LogCommand.all(): filter out refs that do not refer to commit objects
1. I have authored 100% of the content I'm contributing,
 2. I have the rights to donate the content to Eclipse,
 3. I contribute the content under the EDL

Change-Id: I48b1828e0b1304f76276ec07ebac7ee9f521b194
2013-03-31 15:36:47 +01:00
Arthur Baars 2b9c440fd1 LogCommand.all(), peel references before using them
Problem:
LogCommand.all() throws an IncorrectObjectTypeException when
there are tag references, and the repository does not contain
the file "packed-refs". It seems that the references were not properly
peeled before being added to the markStart() method.

Solution:
Call getRepository().peel() on every Ref that has isPeeled()==false
in LogCommand.all() .

Added test case for LogCommand.all() on repo with a tag.

 1. I have authored 100% of the content I'm contributing,
 2. I have the rights to donate the content to Eclipse,
 3. I contribute the content under the EDL

Bug: 402025
Change-Id: Idb8881eeb6ccce8530f2837b25296e8e83636eb7
2013-03-31 15:36:47 +01:00
Robin Rosenberg 5cf53fdacf Speed up clone/fetch with large number of refs
Instead of re-reading all refs after each update, execute
the deletes first, then read all refs once and perform
the check for conflicting ref names in memory.

Change-Id: I17d0b3ccc27f868c8497607d8e57bf7082e65ba3
2013-03-30 13:36:44 +01:00
Andreas König d9d3439617 Fixed parsing of URI with a IPv6-address
Allowed ipv6-address in a uri like:
  http://[::1]:8080/repo.git

Change-Id: Ia00a20f694b2e9314892df77f9b11f551bb1d34e
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2013-03-27 10:44:13 -04:00
Robin Rosenberg d0e92885e9 Extend FileUtils.rename to common git semantics
Unlike the OS or Java rename this method will (on *nix) try (on Windows)
replace the target with the source provided the target does not exist,
the target does exist and is a file, or if it is a directory which only
contains directories. In the latter case the directory hierarchy will be
deleted.
If the initial rename fails and the target is an existing file the the
target file will be deleted first and then the rename is retried.

Change-Id: Iae75c49c85445ada7795246a02ce02f7c248d956
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2013-03-26 00:48:00 +01:00
Robin Rosenberg 7aa54967a2 Add tests for FileUtils.delete and EMPTY_DIREECTORIES_ONLY
Change-Id: I54a46c29df5eafc7739a6ef29e5dc80fa2f6d9ba
2013-03-24 00:49:23 +01:00
Shawn Pearce 9aee4e0a26 Merge changes If98b0b97,I7c9c09b4
* changes:
  Add convenience factory method for most used builder pattern
  Don't use internal type FileRepository in public API
2013-03-21 03:52:33 -04:00
André Dietisheim a31920555f Allow users to show server messages while pushing
Allow users to provide their OutputStream (via Transport#
push(monitor, refUpdates, out)) so that server messages can be written
to it (in SideBandInputStream) while they're coming in.

CQ: 7065
Bug: 398404
Change-Id: I670782784b38702d52bca98203909aca0496d1c0
Signed-off-by: Andre Dietisheim <andre.dietisheim@gmail.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-03-21 00:30:30 +01:00
Matthias Sohn d35586a431 Don't use internal type FileRepository in public API
Change-Id: I7c9c09b4f190fa7cb830563bcdf2071407ee2ce0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-03-20 00:44:24 +01:00
Christian Halstrick bd5e4eabc2 Fix GC for FileRepo in case packfile renames fail
Only on Windows the rename operation which renames temporary Packfiles
(and index-files and bitmap-files) sometime fails. This happens only
when renaming a temporary Packfile to a Packfile which already exists.
Such situations occur if you run GC twice on a repo without modifying
the repo inbetween.

In such situations there was bug in GC which led to a corrupted repo
whithout any packfiles anymore. This commit fixes the problem by
introducing a utility method which renames a file and throws an
IOException if it fails. This method also takes care to repeat a
failing rename if our FS class has found out we are running on a
platform with a unreliable File.renameTo() method.

I am searching for a better solution because even with this utility
method in hand a GC on a already GC'ed repo will fail on Windows. But
at least with this fix we will not produce corrupted repos anymore.

Bug: 389305
Change-Id: Iac1ab3e0b8c419c90404f2e2f3559672eb8f6d28
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-03-19 14:28:24 +01:00
Christian Halstrick 67b98d5d40 Make GC more robust against corrupt reflogs
With JGit it is possible to write reflog entries where new objectid and
old objectid is null. Such reflogs cause FileRepository GC to crash
because it doesn't expect the new objectid to be null. One case where
this happened is in Gerrit's allProjects repo. In the same way as we
expect the old objectid to be potentially null we should also ignore
null values in the new objectid column.

Change-Id: Icf666c7ef803179b84306ca8deb602369b8df16e
2013-03-19 11:23:45 +01:00
Shawn Pearce f32b861243 JGit 3.0: move internal classes into an internal subpackage
This breaks all existing callers once. Applications are not supposed
to build against the internal storage API unless they can accept API
churn and make necessary updates as versions change.

Change-Id: I2ab1327c202ef2003565e1b0770a583970e432e9
2013-03-18 09:30:43 -07:00
Robin Stocker 0e9f1cf57d Support aborting non-interactive rebase started from C Git
Continuing is trickier, as .git/rebase-apply contains no message file
and no git-rebase-todo.

Bug: 336820
Change-Id: I4eb87c850078ca187b38b81cc91c92afb1176945
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-03-16 23:32:13 +01:00
Dave Borowitz bba74ba2e0 NameRevCommand: Don't use merge cost for first parent
Treat first parent traversals as 1 and higher parents as MERGE_COST,
to match git name-rev. Allow overriding the merge cost during tests to
avoid creating 2^16 commits on the fly.

Change-Id: I0175e0c3ab1abe6722e4241abe2f106d1fe92a69
2013-03-15 08:58:14 -07:00
Robin Rosenberg 0adcbba149 Merge "A folder does not constitute a dirty work tree" 2013-03-15 11:33:08 -04:00
Dave Borowitz 8e2a24a3b6 NameRevCommand: Use ~ notation for first parents of merges
Prefer ~(N+1) to ^1~N. Although both are correct, the former is
cleaner and matches "git name-rev".

Change-Id: I772001a219e5eb346f5552c92e6d98c70b2cfa98
2013-03-14 09:35:00 -07:00
Dave Borowitz d2a6c4b955 Allow adding single refs or all tags to NameRevCommand
Change-Id: I90e85bc835d11278631afd0e801425a292578bba
2013-03-13 12:28:58 -07:00
Shawn Pearce ef91da3605 Merge "Add a NameRevCommand for describing IDs in terms of refnames" 2013-03-11 18:33:55 -04:00
Dave Borowitz 30ba407a9a Add a NameRevCommand for describing IDs in terms of refnames
The walk logic does not use RevWalk because it needs to walk all paths
to each of the requested commits, keeping track of each path along which
the commit was found in the RevCommit subclass. From these paths, a
single "best" path is chosen based on the total path length, with a
penalty applied for paths that traverse merges.

This functionality parallels "git name-rev".

Change-Id: I92bfb47dd16c898313d2ee525395609c3bf72ebe
2013-03-11 12:47:28 -07:00
Robin Rosenberg 3cd089f04c A folder does not constitute a dirty work tree
This fixes two cases:
- A folder without tracked content exist both in the workdir and merged
commit, as long as there names within that folder does not conflict.
- An empty folder structure exists with the same name as a file in the
merged commit.

Bug: 402834
Change-Id: I4c5b9f11313dd1665fcbdae2d0755fdb64deb3ef
2013-03-10 16:53:23 +01:00
Robin Rosenberg 3ad454497c Do not cherry-pick merge commits during rebase
Rebase computes the list of commits that are included in
the merges, just like Git does, so do not try to include
the merge commits. Re-recreating merges during rebase is
a bit more complicated and might be a useful future extension,
but for now just linearize during rebase.

Change-Id: I61239d265f395e5ead580df2528e46393dc6bdbd
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-03-08 16:40:19 +01:00
Robin Rosenberg 08d5ede281 Extend FileUtils.delete with option to delete empty directories only
The new option EMPTY_DIRECTORIES_ONLY will make delete() only delete
empty directories. Any attempt to delete files will fail. Can be
combined with RECURSIVE to wipe out entire tree structures and
IGNORE_ERRORS to silently ignore any files or non-empty directories.

Change-Id: Icaa9a30e5302ee5c0ba23daad11c7b93e26b7445
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-03-08 16:26:10 +01:00
Colby Ranger 3b325917a5 Added read/write support for pack bitmap index.
A pack bitmap index is an additional index of compressed
bitmaps of the object graph. Furthermore, a logical API of the index
functionality is included, as it is expected to be used by the
PackWriter.

Compressed bitmaps are created using the javaewah library, which is a
word-aligned compressed variant of the Java bitset class based on
run-length encoding. The library only works with positive integer
values. Thus, the maximum number of ObjectIds in a pack file that
this index can currently support is limited to Integer.MAX_VALUE.

Every ObjectId is given an integer mapping. The integer is the
position of the ObjectId in the complete ObjectId list, sorted
by offset, for the pack file. That integer is what the bitmaps
use to reference the ObjectId. Currently, the new index format can
only be used with pack files that contain a complete closure of the
object graph e.g. the result of a garbage collection.

The index file includes four bitmaps for the Git object types i.e.
commits, trees, blobs, and tags. In addition, a collection of
bitmaps keyed by an ObjectId is also included. The bitmap for each entry
in the collection represents the full closure of ObjectIds reachable
from the keyed ObjectId (including the keyed ObjectId itself). The
bitmaps are further compressed by XORing the current bitmaps against
prior bitmaps in the index, and selecting the smallest representation.
The XOR'd bitmap and offset from the current entry to the position
of the bitmap to XOR against is the actual representation of the entry
in the index file. Each entry contains one byte, which is currently
used to note whether the bitmap should be blindly reused.

Change-Id: Id328724bf6b4c8366a088233098c18643edcf40f
2013-03-05 11:09:44 -08:00
Roberto Tyley a46b042905 Fix corrupted CloneCommand bare-repo fetch-refspec (#402031)
CloneCommand has been creating fetch refspecs like this on bare clones:

[remote "origin"]
        url = ssh://example.com/my-repo.git
        fetch = +refs/heads/*:refs/heads//*

As you can see, the destination ref pattern has a superfluous slash.

It looks like this behaviour has always been the case for CloneCommand,
at least since cc2197ed when code catering to bare-clone fetch refspecs
was added. That was released with JGit v1.0 almost 2 years ago, so
there will probably be some bare repos in the wild which will have been
cloned with JGit and have these corrupted refspecs.

The effect of the corrupted fetch refspec is quite interesting. Up to
and including JGit 2.0, the corrupt refspec was tolerated and fetches
would work as intended with no indication to the user that anything was
amiss. With JGit 2.1, a change was introduced which made JGit less
tolerant, and fetches now attempt to update the non-existing ref
"refs/heads//master". No exception is raised, but the real ref -
"refs/heads/master" - is not updated.

This behaviour was noticed by a user of Agit (which does bare clones by
default and recently updated from JGit v2.0 to v2.2), reported here:

https://github.com/rtyley/agit/issues/92


If you run C-Git fetch on a bare-repo cloned by JGit, it flat-out
rejects the refspec (checked against v1.7.10.4):

fatal: Invalid refspec '+refs/heads/*:refs/heads//*'

Incidentally, C-Git does not create an explicit fetch refspec at all
when performing a bare clone - the full remote config generated by C-Git
looks like this:

[remote "origin"]
        url = ssh://example.com/my-repo.git

Using JGit on such a repository works fine, so omitting the fetch
refspec entirely is also an option.

Change-Id: I14b0d359dc69b8908f68e02cea7a756ac34bf881
2013-03-04 00:03:20 +00:00
Colby Ranger 4a317a1790 Include supported extensions in PackFile constructor.
Previously a PackFile class was assumed to only support a .pack and .idx
file. Update the constructor to enumerate the supported extensions for
the pack file. This will allow the bitmap code to only be executed if
the bitmap extension file is known to exist.

Change-Id: Ie59041dffec5f60d7ea2771026ffd945106bd4bf
2013-02-28 11:35:07 -08:00
George C. Young ab99b78ca0 Implement recursive merge strategy
Extend ResolveMerger with RecursiveMerger to merge two tips
that have up to 200 bases.

Bug: 380314
CQ: 6854
Change-Id: I6292bb7bda55c0242a448a94956f2d6a94fddbaa
Also-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-22 23:51:50 +01:00
Matthias Sohn c033f016c9 Merge branch 'stable-2.3'
* stable-2.3:
  Prepare 2.3.2-SNAPSHOT builds
  JGit v2.3.1.201302201838-r
  Accept Change-Id even if footer contains not well-formed entries
  Fix false positives in hashing used by PathFilterGroup

Change-Id: I5882aa3b482d6bcd40a45bed51e5ab03f018a5bc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-21 02:34:17 +01:00
Matthias Sohn 49ec6c1b3b Prepare 2.3.2-SNAPSHOT builds
Change-Id: I51a8a53194928416b1aef1f3fce0ce66aadceca4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-21 02:13:15 +01:00
Matthias Sohn 63dceceb0e JGit v2.3.1.201302201838-r
Change-Id: I0d79873137ad4042ecc2a0210fe1f6305608b851
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-21 01:00:08 +01:00
Matthias Sohn 301df23d9b Merge "Accept Change-Id even if footer contains not well-formed entries" into stable-2.3 2013-02-20 18:35:44 -05:00
Stefan Lay 3b41fcbd96 Accept Change-Id even if footer contains not well-formed entries
Instead of only looking for a Change-Id in the last section if it 
consists only of well-formed "key: value" lines replace the last
occurrence of a valid Change-Id line in the last section. Some tools
require footer lines e.g. without a colon.

Gerrit doesn't accept Change-Id lines in the footer if the Change-Id
line doesn't start at the beginning of the line.

Bug: 400818
Change-Id: Icce54872adc8c566994beea848448a2f7ca87085
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-20 23:49:43 +01:00
Robin Stocker 5d7b722f6e Fix false positives in hashing used by PathFilterGroup
The ByteArraySet failed to check the length of the entry correctly leading
to matches where no match should be.

Bug: 401249
Change-Id: I925bc48d9cafcdf13e1a797bb09fc2555eb270c5
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2013-02-20 00:37:57 +01:00
Matthias Sohn ba6ae0c7ec Prepare 2.4.0-SNAPSHOT builds
Change-Id: I4ab2baeb5d598d40d5dadfccdfe75152a1b9b7bf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-14 00:59:25 +01:00
Matthias Sohn 9a5f4b46cc Prepare post 2.3.0.201302130906 builds
Change-Id: Ia11b4000557d0cf235c4e33cda4539cab25fef47
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-13 23:08:30 +01:00
Matthias Sohn 19d6cadeff JGit v2.3.0.201302130906
Change-Id: If2e5fcbc01c2a7f058ef13d60b0bba5f77300d52
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-13 15:24:41 +01:00
Dave Borowitz 51d0e1f26e Fix Config.fromText to not skip a last line with no newline
Change-Id: Id6da6ff19296410806282bb7419fd8455e8c5475
2013-02-08 11:36:50 -08:00
Matthias Sohn e9cf705c6e Prepare post 2.3rc1 builds
Change-Id: I5c7daa5a735bfc2ecb9adc11c392b94d235102b6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-06 16:10:20 +01:00
Matthias Sohn ea060dd8e7 JGit v2.3.0.201302060400-rc1
Change-Id: Id1f1d174375f7399cee4c2eb23368d4dbb4c384a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-06 14:12:51 +01:00
Robin Stocker 60d538fe51 Add getConflictingNames to RefDatabase
This has the same logic as isNameConflicting, but instead of only
returning a boolean, it returns a collection of names that conflict.

It will be used in EGit to provide a better message to the user when
validating a ref name, see Ibea9984121ae88c488858b8a8e73b593195b15e0.

Existing implementations of isNameConflicting could be rewritten like
this:

  return !getConflictingNames(name).isEmpty();

But I'm not sure about that, as isNameConflicting can be implemented in
a faster way than getConflictingNames.

Change-Id: I11e0ba2f300adb8b3612943c304ba68bbe73db8a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-06 08:48:54 +01:00
Robin Rosenberg 767be14f34 Move base test classes to the junit bundle for reuse for Java 7 tests
Change-Id: Iedb54eb9d8396bc3ae66d8754c1527fd9ca655f9
2013-02-04 07:24:56 +01:00
Robin Rosenberg 75c011cd20 Remove PathFilterGroupTest2
The test is not very useful for regression testing in its current form

Change-Id: I19d1a29ff693397ac795d414b83411f32fae56d8
2013-01-30 21:03:01 +01:00
Robin Rosenberg 69123920dd Remove debug printouts from PathFilterGroupTest
Change-Id: I4767e53efafe48d447ebe399fb2f8617072950ea
2013-01-30 19:46:19 +01:00
Robin Rosenberg 878e78b307 Fix stash apply using merge logic
Instead of the complicated strange stuff, implement staah
apply as cherry-pick.

Provided there are no conflicts and it is requested that
the index should be applied, perform yet another cherry-pick,
but discard tha results thereof it that would result in conflicts.

Bug: 376035
Change-Id: I553f3a753e0124b102a51f8edbb53ddeff2912e2
2013-01-30 11:38:19 -05:00
Robin Rosenberg eb60932930 Fix Check for FF_ONLY merges again
Added more FF-mode tests

Change-Id: I33eed5737d9411cc1cf214da62ce719916a1b736
2013-01-29 08:05:00 +01:00
Robin Rosenberg 83032e9f66 Merge "Check for FF_ONLY merges correctly" 2013-01-28 19:02:18 -05:00
Robin Rosenberg ee413067fd Merge changes Ife0cc2da,If38507ef
* changes:
  Speed up PathFilterGroup for large sets of paths
  Add test case for PathFilterGroup
2013-01-28 19:00:00 -05:00
Robin Rosenberg 642ff2cd7d Check for FF_ONLY merges correctly
Bug: 398192
Change-Id: I1253c0ea0632185bbf9f77e32f13ba5842a6e18e
2013-01-29 00:48:56 +01:00
Matthias Sohn 33bc4f7c05 Merge changes I25204d9e,Ia10d76e9
* changes:
  Attempt to stabilize GCTest
  Attempt to stabilize FileTreeIterator test on Windows
2013-01-24 15:57:11 -05:00
Robin Rosenberg e522d95a51 Attempt to stabilize GCTest
File system time stamps and System.currentTimeMillis() may not
necessarily be running on the same clock so add some slack.

Bug: 396662
Change-Id: I25204d9e3181e15368da2902447518c6ce205017
2013-01-23 08:27:12 +01:00
Robin Rosenberg db34152794 Attempt to stabilize FileTreeIterator test on Windows
My guess is that the higher resolution of timestamps provided by Java on
Windows causes this test to occasionally fail.

Bug: 396662
Change-Id: Ia10d76e95fe6156c7ad05972619160e461606805
2013-01-23 07:55:28 +01:00
Robin Stocker 75ddf2a0f4 Enable marking entries using TreeFilters in DiffEntry
This adds a new optional TreeFilter[] argument to DiffEntry.scan. All
filters will be checked during the scan to determine if an entry should
be "marked" with regard to that filter.

After having called scan, the user can then call isMarked(int) on the
entries to find out whether they matched the TreeFilter with the passed
index.

An example use case for this is in the file diff viewer of EGit's
History view, where we'd like to highlight entries that are matching the
current filter.

See EGit change I03da4b38d1591495cb290909f0e4c6e52270e97f.

Bug: 393610
Change-Id: Icf911fe6fca131b2567514f54d66636a44561af1
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-01-23 00:24:54 +01:00
Robin Rosenberg 522fc6a9c6 Speed up PathFilterGroup for large sets of paths
The ByteArraySet is a distorted copy of ObjectIdSubclassMap.

Bug: 397185
Change-Id: Ife0cc2da6cc46431be94a6b14f64f6adbe983afb
2013-01-21 15:54:56 +01:00
Robin Rosenberg 05180574a9 Add test case for PathFilterGroup
This is needed to prepare for optimization.

Bug: 397185
Change-Id: If38507ef8cc5a161353cc07bf7cd1922f54d1f8a
2013-01-21 02:32:33 +01:00
Robin Rosenberg 910a69d4c8 Merge "Improve handling of checkout conflicts" 2013-01-20 14:01:38 -05:00
Robin Rosenberg 9f7b97c90a Merge changes I7e7fae12,I87ecca00
* changes:
  Add conflicts message before footer
  Only replace the ChangeId in the footer, not in the body
2013-01-19 11:54:21 -05:00
Stefan Lay 215a74eceb Add conflicts message before footer
In case of a conflict during cherry-pick or revert the commit message
was amended after the footer. This made the footer invalid. Many users
do not understand that they have to edit the commit message in order to
make it valid again.

Change-Id: I7e7fae125129e2a0d8950510550acda766531835
Bug: 367416
2013-01-19 11:38:33 -05:00
Stefan Lay 1ca7c581a3 Only replace the ChangeId in the footer, not in the body
Additionally expose methods to find the first footer line and to find
the position of the ChangeId footer in the commit message in order to
enable reuse of these methods introduced for the fix.

Change-Id: I87ecca009ca3bff1ca0de3c436ebd95736bf5a10
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2013-01-19 17:37:09 +01:00
Robin Rosenberg ab439eed6e Merge "Fix patch application WRT windows line endings." 2013-01-19 11:20:27 -05:00
Markus Duft 3d18f65af1 Fix patch application WRT windows line endings.
Previously the result of an application would have been \r\r\n in the
case of windows line endings, as RawText does not touch the \r, and
ApplyCommand adds "\r\n" if this is the ending of the first line in the
target file. Only always adding \n should be ok, since \r\n would be the
result if the file and the patch include windows line endings.

Also add according test.

Change-Id: Ibd4c4948d81bd1c511ecf5fd6c906444930d236e
2013-01-19 13:29:02 +01:00
Colby Ranger 38b503601a Merge "Update DfsGarbageCollector to not read back a pack index." 2013-01-18 19:38:08 -05:00
Colby Ranger 7c58f6282a Update DfsGarbageCollector to not read back a pack index.
Previously, the Dfs GC excluded objects from packs by passing a
previously written index to the PackWriter. Reading back a file on
Dfs is slow. Instead, allow the PackWriter to expose the objects
included in a pack and forward that to invocations of excludeObjects() .

Change-Id: I377cb4ab07f62cf790505e1eeb0b2efe81897c79
2013-01-18 16:22:10 -08:00
Robin Rosenberg de390e1480 Merge "Define a tree filter for user-visible changes between two indexes" 2013-01-18 19:07:30 -05:00
Tomasz Zarna 6a8da4c134 Add additional FastForwardMode enums for different config contexts
FastForwardMode is represented by different strings depending on context 
it is set or get from. E.g. FastForwardMode.FF_ONLY for
branch.<name>.mergeoptions is "--ff-only" but for merge.ff it is "only".

Change-Id: I39ae93578e4783de80ebf4af29ae23b3936eec47
2013-01-18 12:04:17 +01:00
Robin Rosenberg 5213f6e2e8 Define a tree filter for user-visible changes between two indexes
The primary purpose of the filter is to detect an index change that
could possibly lead to a change in what files are visible in the staging
view and decorations. Besides what TreeFilter.ANY_DIFF does for trees in
general, this filter also looks at the assume-valid (CE_VALID) flag to
see whether changes should be ignored or not.

Change-Id: I13e9ed4ae62dc3851204fba598239edce07ca977
2013-01-15 19:13:46 -05:00
Roberto Tyley 5dcc8693d7 Fix concurrent creation of fan-out object directories
If multiple threads attempted to insert loose objects into the same new
fan-out directory, the creation of that directory was subject to a race
condition that could lead to an unnecessary IOException being thrown -
because an inserter could not 'create' a directory that had just been
generated by a different thread. All we require is that the directory
does indeed *exist*, so not being able to _create_ it is not actually a
fatal problem. Setting 'skipExisting' to 'true' on the call to mkdir()
fixes the issue.

I found this issue as a real world occurrence while working on The BFG
Repo Cleaner (https://github.com/rtyley/bfg-repo-cleaner), a tool which
concurrently performs a lot of object creation.

In order to demonstrate the problem here I've added a small test case
which reliably reproduces the issue on the few different hardware
systems I've tried. The error thrown when the race-condition arises is
this:

java.io.IOException: Creating directory /home/roberto/repo.git/objects/e6 failed
at org.eclipse.jgit.util.FileUtils.mkdir(FileUtils.java:182)
at org.eclipse.jgit.storage.file.ObjectDirectory.insertUnpackedObject(ObjectDirectory.java:590)
at org.eclipse.jgit.storage.file.ObjectDirectoryInserter.insertOneObject(ObjectDirectoryInserter.java:113)
at org.eclipse.jgit.storage.file.ObjectDirectoryInserter.insert(ObjectDirectoryInserter.java:91)
at org.eclipse.jgit.lib.ObjectInserter.insert(ObjectInserter.java:329)

Change-Id: I88eac49bc600c56ba9ad290e6133d8a7113125ab
2013-01-13 18:59:59 -05:00
Markus Duft baf7ca9cc0 Improve handling of checkout conflicts
This converts a checkout conflict exception into a RebaseResult /
MergeResult containing the conflicting paths, which enables EGit (or
others) to handle the situation in a user-friendly way

Change-Id: I48d9bdcc1e98095576513a54a225a42409f301f3
2013-01-11 20:32:44 -05:00
Shawn Pearce 912ef3da19 Accept '-' instead of space in enum config values
This is necessary because some versions of JGit containing
the flawed c98abc9c05 were
used in the wild and wrote bad configuration files. We now
must accept this value in addition to the preferred case.

Change-Id: I3ed5451735658df6381532499130e5186805024a
2013-01-11 14:52:13 -08:00
Shawn Pearce 50eab4aa48 Revert "Add additional FastForwardMode enums for different config contexts"
This reverts commit c98abc9c05.

Change-Id: I1d2a0de81eb17860ee36b6d3d3c00959b880fb85
2013-01-11 14:39:51 -08:00
Shawn Pearce 5630686655 Fix enum parsing from Config files
Change-Id: Ib0b86ceab070d46903de7b55f2fd441714855141
2013-01-11 14:09:02 -08:00
Colby Ranger 8a63474518 Merge changes Ifc8fc3e5,I7c403b50
* changes:
  Remove packIndex field from FileObjDatabase openPack method.
  Update DfsObjDatabase API to open/write by pack extension.
2013-01-10 17:17:22 -05:00
Colby Ranger 82ecfb3e31 Remove packIndex field from FileObjDatabase openPack method.
Previously, the FileObjDatabase required both the pack file path and
index file path to be passed to openPack().  A future change to add
a bitmap index will add a .bitmap file parallel to the pack file
(similar to the .idx file). Update the PackFile to support
automatically loading pack index extensions based on the pack file
path.

Change-Id: Ifc8fc3e57f4afa177ba5a88df87334dbfa799f01
2013-01-10 14:02:28 -08:00
Dave Borowitz 891a2d75e7 Peel tags during resolve of foo^
Once we start talking about parents of tags, we are in the commit
graph, so treat all objects from this point as commits. This fixes
spurious IncorrectObjectTypeExceptions on resolving expressions like
tag^^.

Change-Id: I29ece1fdb49c9c5b9ca415efcd1876bc72e97120
2013-01-10 10:56:37 -08:00
Robin Rosenberg e74cfeb673 Delete the iplog generator, cont'd
Change-Id: I1f5e8dad3f61fde0d0573817d10e25a7384885d2
2013-01-09 19:33:32 +01:00
Matthias Sohn 850e5bc24e Delete the iplog generator
It stopped working when we moved to the Eclipse foundation's Gerrit
server since it doesn't use the Gerrit internal user store but LDAP.
Instead, since 2.0, we use the Eclipse foundation's automatic IP log
generator [1] to generate IP logs for releasing jgit and egit.

[1] http://www.eclipse.org/projects/ip_log_selector.php

Change-Id: I98dc65efb62909bc0258e6c680df0c93a57e9677
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-01-09 14:21:40 +01:00
Tomasz Zarna 928286ad8f Return info about config subsection when trying to get an invalid enum
Change-Id: Id4a72a68bdbd485619f4801683d38ad98f9841a2
2013-01-08 06:26:36 -05:00
Tomasz Zarna c98abc9c05 Add additional FastForwardMode enums for different config contexts
FastForwardMode should be represented by different enums depending on
context it is set or get from. E.g. FastForwardMode.FF_ONLY for
branch.<name>.mergeoptions is "--ff-only" but for merge.ff it is "only".

Change-Id: I3ecc16d48e715b81320b73ffae4caf3558f965f2
2013-01-06 19:12:10 -05:00
Robin Rosenberg 5c49b93191 Ignore removed files with an assume-valid index entry
Bug: 347067
Change-Id: I5472e69dc77e26b5f248a4a04295775cf5051215
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2013-01-03 19:02:59 -06:00
Robin Rosenberg 315f1cfa5c Update the revert command and things relating to revert
Cherry-pick has been fixed, but even though revert does
basically the same thing, the fixes were not carried over here.

- Recognize the revert-states, analogous to the cherry picking states
- Make reset handle a revert-in-progress
- Update REVERT_HEAD and MERGE_MSG when revert fails due to conflicts
- Clear revert state on commit and reset
- Format the message similarily to how cherry-pick does. This is
  not exactly how C Git does it.

The interface is still not the same as for cherry-picking.

Change-Id: I8ea956fcbc9526d62a2365360feea23a9280eba3
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-12-28 16:44:46 -06:00
Robin Rosenberg f71944ec76 Hide deprecation warnings in some test classes
These test classes heavily rely on Tree and associated classes. They
are convenient for building test cases and hence not yet replaced, but
there is a deprecation warning at about every line, which is not helpful.

Change-Id: Ia7cc8f3bb980dc03055b94748b6c7529a82ea5a5
2012-12-27 12:09:01 -05:00
Robin Rosenberg a57dd1c164 Declare essentially static methods as static
Change-Id: I83ca25fb569c0dbc36eb374d5437fcf2b65a6f68
2012-12-27 12:08:06 -05:00
Robin Rosenberg 04bc9b3ddc Add type argumente to some raw reclaration
Change-Id: Ief195fb5c55f75172f0428fdac8c8874292ae566
2012-12-27 11:57:34 -05:00
Matthias Sohn 706f8eb9fc Prepare 2.3.0 builds
Change-Id: I0ca539e8cfe444f96c64dc56d1f0ef33b66e0cff
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-12-21 00:48:45 +01:00
Matthias Sohn 2d78a8da97 Prepare post 2.2.0.201212191850-r builds
Change-Id: I1a0fe51c71551fcfc98f5dd435eb283fd661b77a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-12-21 00:31:26 +01:00
Matthias Sohn aa357c2a9f JGit v2.2.0.201212191850-r
Change-Id: Idc49f17d03886b6a1e61a94ff81e32625c8675d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-12-20 00:59:41 +01:00
Robin Rosenberg af54f16635 DirCacheIterator: Fix reset() and back()
reset() was broken and probably only worked when the position was
at the beginning. More serious was that back() sometimes descended
into the tree rather than skipping backward at the same level. Sometimes
this would result in false conflicts, but one could suspect silent
errors too. back() is called by the NamingConflictTreeWalk when looking
for directory/file conflicts.

Also added toString to DirCacheTree to simplify debugging.

Bug: 396127
Change-Id: Iaa1b4e20e623d84c2e5ac26748f42e991080dbcd
2012-12-15 11:00:55 +01:00
Robin Stocker beb16cec26 Support --cached in RmCommand
Also extend documentation and add examples.

Bug: 395599
Change-Id: Id1ddbc9da787472f82e58834092bc073224b262b
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-12-03 10:40:54 -06:00
Marc Strapetz 67edd3eda7 RevWalk support for shallow clones
StartGenerator now processes .git/shallow to have the
RevWalk stop for shallow commits.

See RevWalkShallowTest for tests.

Bug: 394543
CQ: 6908
Change-Id: Ia5af1dab3fe9c7888f44eeecab1e1bcf2e8e48fe
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-21 10:46:02 -06:00
Dariusz Luksza 8eb4d92637 Add support for rebase interactive 'edit' command
The 'edit' command allows you to change arbitrary commit
content and the message of any commit in the repository.

Bug: 394577
Change-Id: I43a44782cdb10b29f13784fa75ab37fe5d4da01b
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-19 10:02:25 -06:00
Dariusz Luksza 84fb2b59d1 Add support for rebase interactive 'reword' command
'reword' command is used to change commit message of any
commit in git history.

Bug: 394575
Change-Id: Ic974e76dfd923fd6f0cb8f07d1a6fbecd9abbf31
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-19 09:40:53 -06:00
Matthias Sohn 9051af3c4d Add GarbageCollectCommand to porcelain API
Bug: 394544
Change-Id: I73faa55d860db64efc3412fee27386df47552a75
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-18 19:19:12 -06:00
Mikael Karlsson fa5231191d Add support for pull with --rebase and --no-rebase
Bug: 394501
Change-Id: I697e2fc82a46c03762111eb1de93e673a2643b4f
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-16 12:51:35 -08:00
Markus Duft f64237d5ff Adapt Status and CleanCommand to support cleaning directories
This adds the possibility to:

 * retrieve untracked directories from the status
 * instruct the CleanCommand to clean those directories.
 * retrieve ignored paths from the status
 * instruct the CleanCommand to leave those ignored paths alone

Bug: 338717
Change-Id: Ibed0459005a5e306c010b9932f5b5fd107fb5448
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-16 12:17:28 -08:00
Robin Stocker cdaded26b0 CheckoutCommand: Support checking out ours and theirs
The checkoutPaths body is split into two implementations, depending on
whether we are checking out the index or a branch. This improves
readability, as in the index case we now also need to have access to
DirCacheIterator.

Bug: 390147
Change-Id: I99fd599b25b2ace9bdd84535a56565286a3cb7f1
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-16 10:31:32 -08:00
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
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 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
Chris Aniszczyk cda5e861b9 Merge "Refactor ResolveMergerTest to allow testing multiple strategies" 2012-10-30 20:00:14 -04: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 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
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
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 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
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
Robin Rosenberg 45edb41a9e Fix for Iff768422c, use offset 0 when going back to work tree iterator
In Iff768422c the offset used for the content id was fixed to use  the
offset that applied to the dircache iterator. Unfortunately the index
for the dircache content id offset stuck for entries that were not in
the index. Few caller probably cared about that, unless it actually
caused an ArrayIndexOutOfBoundsException.

Change-Id: Ic9f0e77c8ea3a0770d88565e94392e76853e3006
2012-10-06 13:08:16 +02:00
Robin Rosenberg 046a497d77 Fix unstable test
Add more time to a timestamp to safely go beyond the granularity of
the timestamp resolution of the file system. The lowest resolution we
know of is FAT with two second resolution. Then add some to make sure we
are above the limit.

Change-Id: I85c5b07dcdf2d80de41fe9b2354ccc888bad7f1e
2012-10-02 12:46:09 +02:00