Commit Graph

1714 Commits

Author SHA1 Message Date
Markus Keller a27c1a6b15 Fix compile error (method not available in 1.5)
Change-Id: I07aca821010daca75a66506b9ca738bc8c262abb
Signed-off-by: Markus Keller <markus_keller@ch.ibm.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-27 00:17:53 +02:00
Robin Rosenberg bc66934a83 Merge "Allow @ in branch names and tighten syntax checking" 2012-09-24 14:36:57 -04:00
Robin Rosenberg 2e1d391f62 Merge "FileBasedConfig supports UTF-8 byte order marker" 2012-09-24 14:35:22 -04:00
Robin Rosenberg 13df55a464 Merge "Fix typo in AnyObjectId#abbreviate" 2012-09-24 14:22:24 -04:00
Robin Rosenberg aca8df0425 Merge "Add toString for TrackingRefUpdate" 2012-09-24 14:21:11 -04:00
Marc Strapetz 8f706db56a FileBasedConfig supports UTF-8 byte order marker
Change-Id: I1f5dc07182dbf6bba2a9f4807fdd25b475da4ead
2012-09-24 14:28:15 +02:00
Robin Stocker 56a0286b28 Fix typo in AnyObjectId#abbreviate
Change-Id: I5796dc81727a8e1923189e9490a55c4af6ad053e
2012-09-24 00:34:33 +02:00
Robin Stocker 85b189fdbe Add toString for TrackingRefUpdate
Makes it much easier to debug the results of
OperationResult#getTrackingRefUpdates (which otherwise requires digging
into a TreeMap structure).

Change-Id: I90da5385ee47c441404728f252eb3a100c48ee1c
2012-09-24 00:01:04 +02:00
Robin Rosenberg 094df5a916 Allow @ in branch names and tighten syntax checking
Valid refs are defined by git-check-ref-format(1). In addition
we will not try to perform a lookup of an invalid ref name in
Repository.resolve().

Reported by R Shapiro in the Eclipse JGit Forum.

Change-Id: I0b098eec9ecb98a9ce16b1cfb476729aaf2fb190
2012-09-23 15:18:19 +02:00
Robin Stocker ac805874f7 Refuse to checkout unmerged paths from index
Without this check, the checkout was done but the result was a "both
deleted" status when inspecting it with C Git.

Found this while working on bug 390147.

Change-Id: Ic3693f2c651827239e838bf7f37da842a7ae9707
2012-09-23 02:41:51 +02:00
Sasa Zivkov 7ad88afeb8 Fix the javadoc for GC.setExpire
Clarify expiration of objects with the modification time exactly at the
given time instant.

Change-Id: I2000aec89c8d6a95700380b0a32275d2d658f67e
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2012-09-20 16:20:19 +02:00
Robin Rosenberg c9cce254c7 Use x-friends instead of x-internal to expose jgit for internal use
This prevents a lot of unnecessary warnings about disouraged usage of
the org.eclipse.jgit.internal package within JGit itself.

Change-Id: Ia6683902809425fd7245e7d5d344c2ff8f317ebb
2012-09-19 23:53:53 +02:00
Matthias Sohn 4b3c0f8aba Prepare 2.2.0 builds
Change-Id: I386ba70541d644e58661d26713b309371e0f9257
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-19 09:10:12 +02:00
Matthias Sohn 555ad1f93c Merge branch 'stable-2.1'
* stable-2.1:
  Prepare for 2.1 maintenance changes
  JGit v2.1.0.201209190230-r
  Introduce "never" as parseable date
  Introduce ParseExceptions for GitDateParser
  Support config param "gc.pruneexpire"

Change-Id: If149d7f968a3425d9425f6ba9ce135a8341776a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-19 09:02:31 +02:00
Matthias Sohn 54c4eb69ac Prepare for 2.1 maintenance changes
Change-Id: I436f36a7c6dc86916eb4cde038b27f9fb183465a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-19 09:00:33 +02:00
Matthias Sohn c466bc2ddf JGit v2.1.0.201209190230-r
Change-Id: I9f94bce9a25644575a068c8fa459f74e06b02030
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-19 08:56:17 +02:00
Robin Rosenberg 1f19d0a834 Merge "Fix resolving expression with ~ and ^ than extends beyond history" 2012-09-18 18:00:38 -04:00
Dave Borowitz 70ae16d708 Fix resolving expression with ~ and ^ than extends beyond history
resolve("foo~X") where X is greater than the distance from foo to the
root should return null, but 2a2362fb introduced a bug causing it to
either return resolve("foo") or NPE. Add a test for the correct
behavior.

Also add an analogous test for foo^X where X is greater than the
number of parents (which was not broken by that commit).

Change-Id: Ic580081ece57c8c2df29b652897b425ecb34e11f
2012-09-18 19:51:57 +02:00
Robin Rosenberg e0a3091af7 Introduce "never" as parseable date
For configuration parameter like "gc.pruneexpire" we need to understand
the value "never". Never is handled as a date so far into the future
that it will never happen. The actual value currently used is the
constant GitDateParser.NEVER.

Change-Id: I7744eaee9bf5026da517151c212c88325c348d6c
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2012-09-18 19:23:17 +02:00
Christian Halstrick 84e171fbab Introduce ParseExceptions for GitDateParser
Instead of just returning null when something was not parseable we
should throw a real ParseException. This allows us to distinguish
between specifications which are unparseable and those which represent
no date (e.g. "never")

Change-Id: Ib3c1aa64b65ed0e0270791a365f2fa72ab78a3f4
2012-09-17 22:41:06 +02:00
Christian Halstrick 27b791c591 Support config param "gc.pruneexpire"
Make GC honor the config parameter gc.pruneexpire. If the parameter is
not set then the default is "2.weeks.ago"

Change-Id: I0ae0ca85993cafb4bc75ba80504da18544894ec3
2012-09-17 22:41:06 +02:00
Shawn Pearce 18e020218b Merge "Suppress two resource warnings" 2012-09-16 21:13:15 -04:00
Sasa Zivkov a551493240 Additional unit tests for the GC
Change-Id: Id5b578f7040c6c896ab9386a6b5ed62b0f495ed5
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-16 23:57:18 +02:00
Robin Rosenberg caa362f20d Check for write errors in standard out and exit with error
The underlying problem is that System.out is a PrintWriter and
as such it does not throw exceptions on error, but rather just
sets a flag and continues.

This changes replaces the use of System.out with a PrintWriter-like
writer that does not catch error, but instead throw them to the
caller.

Bug: 366243
Change-Id: I44405edc4416e943b87f09a0f6ed041c6c51b046
2012-09-16 11:12:47 -07:00
Robin Rosenberg 28adbb3500 Merge "Ignore non-commit refs when in RevWalkUtils.findBranchesReachableFrom" 2012-09-14 18:59:38 -04:00
Robin Stocker 187101808c [findBugs] Silence warning about Transport initialization
Change-Id: I98fc9720106bcd873b330090bafde276508f8a40
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-14 00:01:47 +02:00
Tommi Siivola 0e56f34752 Fix ResolveMerger issue with submodule conflict
ResolveMerger throws a MissingObjectException when it encounters
a submodule conflict while merging. The reason is that it treats
the submodule link as a blob and tries to read its contents.

We solve the issue by detecting before content merge whether the
path to be merged is a submodule link, and skip the content
merge if it is.

Bug: 389238
Change-Id: I9a58dfc7716b28a21f5c04cf3a865091ae8dfe7e
Signed-off-by: Tommi Siivola <tommi.siivola@eficode.com>
2012-09-12 13:11:57 +03:00
Jason Pyeron 79d3dd8391 Ignore attempts to set the timeout to -1
The value of -1 is the default value used by the underlying http
transports provided by the jre. On some versions an attempt to
set the timeout explicitly to -1 triggers a check condition,
disallowing negative numbers.

Bug: 389003
Change-Id: I74a22f8edc6c8e15843ad07c96a137739d9dcad1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-10 23:50:10 +02:00
Robin Rosenberg 833fd09442 Ignore non-commit refs when in RevWalkUtils.findBranchesReachableFrom
This methods is for finding branches only.

Change-Id: Ic68b5295ff814401890f0592ae95851554706ca6
2012-09-08 12:08:07 +02:00
Shawn O. Pearce e63f1c94f8 Mark fields of BaseReceivePack private
None of these should have been exposed to base classes. The majority
of them are private implementation details that are not required by a
subclass in order to interact with the base protocol definition. The
few that are needed should be visible as accessor methods, so the
internals can be modified without breaking the public JGit API.

Change-Id: I874179105c9c37703307facbbf99387c52bf772c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-05 17:20:12 +02:00
Shawn O. Pearce 9638e0aa87 Delete checkObjectCollisions from PackParser
This flag was added to provide an unsafe operation on the local
repository because the storage.dht code was too damn slow to provide
proper safe Git behavior all of the time. Now that stoarge.dht has
been removed from the repository, also delete this unsafe flag to
prevent applications from misusing the JGit library and permitting
users to potentially damage their local repository with bad data
received from an untrusted peer.

Change-Id: Ib1861c48bb74836731e7b7d57b635dd654b0dc66
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-05 17:20:05 +02:00
Tomasz Zarna e44c3e7139 Output result of switching branch -- o.e.jgit.pgm.Checkout
Change-Id: I9829950b686ce3b8c70b8f7a1774d5e2b55cd00a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-05 07:59:37 +02:00
Christian Halstrick 32e952fefd Merge "Support branches with name 'config'" 2012-09-03 08:15:31 -04:00
Robin Stocker 51c20b27ac DirCacheCheckout: Fix handling of files not in index
When a file is not in the index and neither contents nor mode differ
between "head" and "merge", the index state should be kept. If they
differ, a checkout conflict should occur. This is described in Git's
git-read-tree.txt.

JGit used to replace the index state with "merge" in both of the above
cases.

A confusing effect of this was that when one removed a file and then did
a rebase, the file silently reappeared again.

The changes to dir/file conflict handling are a consequence of this
change, as the index handling change made tests in DirCacheCheckoutTest
break. I compared these cases to C Git and the new behavior there also
matches what C Git does.

Bug: 387390
Change-Id: I5beb781f12172a68f98c67d4c8029eb51ceae62d
Signed-off-by: Robin Stocker <robin@nibor.org>
2012-09-01 13:29:00 +02:00
Robin Rosenberg 0a9e010e14 Create an input stream that transforms LF to CRLF
The transformation is the same as AutoCRLFOutputStream does, but
the direction is reversed. The tests are reused, but the implementation
derives somewhat from the EolCanonicalizingInputStream.

This stream will be used to compare blobs with LF line endings with
worktree data that has CRLF line endings.

Bug: 387501
Change-Id: I80d96e453e7f780dd464a89778de124cf35384e1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-01 09:56:51 +02:00
Christian Halstrick 6b9b024c91 Enhance statistics for repo by sizes and ref-counts
The statistics for a repo now expose how many bytes are used in the
filesystem to store all loose/packed objects. The number of packed/loose
refs are also exposed.

Change-Id: I335a4c7630a2629a86f13a2a5cd99f79a2c2afa4
2012-08-31 16:14:12 +02:00
Christian Halstrick abd60101b6 Implement a parser for dates
In order to parse user specified strings containing date and time info
a thread-safe parser is implemented. This is needed for example to
interpret configuration parameters (e.g. gc.pruneexpire where need to
parse strings like "2 weeks ago"). The parser is thread-safe by caching
SimpleDateFormat instances in a ThreadLocal cache.

Native git has a parser called approxidate which is able to interpret a
huge number of formats ("1 year ago", "tea time", ...). Ideally JGit
should be able to parse the same strings as native git but for now this
parser understands the following subset:

"now"
"yesterday"
"(x) years|months|weeks|days|hours|minutes|seconds ago"
"yyyy-MM-dd HH:mm:ss Z" (ISO)
"EEE, dd MMM yyyy HH:mm:ss Z" (RFC)
"yyyy-MM-dd"
"yyyy.MM.dd"
"MM/dd/yyyy"
"dd.MM.yyyy"
"EEE MMM dd HH:mm:ss yyyy Z" (DEFAULT)
"EEE MMM dd HH:mm:ss yyyy" (LOCAL)

Change-Id: Iccb66dadb60da13104e73140e53d5e2de068369c
2012-08-28 19:33:42 +10:00
Stefan Lay 47e4e9b177 Merge "Fix gc's usage of progress monitor" 2012-08-28 03:02:19 -04:00
Robin Rosenberg 0264c313ba Enable rebase to continue for all rebase stages
EGit should be able to continue a rebase started by C Git.

Change-Id: I63058026295fec34157b5687ae87ae9cb0c27c86
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-08-27 00:54:59 +02:00
Matthias Sohn 0e684bb97c Merge "Refactor detection of Windows platform to SystemReader" 2012-08-26 18:39:54 -04:00
Matthias Sohn 9004ed6e74 Merge "Set core.precomposeunicode to true when creating repository on Mac" 2012-08-26 18:34:22 -04:00
Matthias Sohn d0433a9bab Merge "Refactor detection of OS X to SystemReader" 2012-08-26 18:33:34 -04:00
Matthias Sohn 29d9fc478c Fix gc's usage of progress monitor
Change-Id: I8dcdf0b83e91e6132dc490e8ec53818220773c94
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-08-26 01:46:40 +02:00
Robin Rosenberg 9570e0d4a9 Refactor detection of Windows platform to SystemReader
Change-Id: Id0b8aef92f10572d4f1ec198e0281162fcd7ed4e
2012-08-22 00:37:17 +02:00
Robin Rosenberg dccad56c9a Set core.precomposeunicode to true when creating repository on Mac
Java has no option but to use precomposed Unicode, so we should
state that when creating a new repository. Not that Java will use
precomposed unicode regardless of this setting, but this reduces
the risk of incompatibility with C Git.

Change-Id: I3779b75f76d2e2061c836cbc9b4b7c2ae0cf18f4
2012-08-22 00:36:11 +02:00
Robin Rosenberg f5ef963acd Refactor detection of OS X to SystemReader
Change-Id: I34e9ba4a26f7af5b88140c070f02a7990f1941af
2012-08-22 00:36:09 +02:00
Robin Rosenberg 5e21a8916c Merge changes I98df46ce,Ifb815a12,I051a1724
* changes:
  Support [<ref>]@{upstream} revision syntax
  Support parsing previous checkout as a revision expresion.
  Allow a @ without branch in revision syntax
2012-08-21 17:34:45 -04:00
Robin Rosenberg 1c1fc6814c Merge "Refactored method to find branches from which a commit is reachable" 2012-08-21 17:19:17 -04:00
Christian Halstrick 252727c4fc Support branches with name 'config'
JGit was not able to lookup refs which had the name of files which exist
in the .git folder. When JGit was looking up a ref named X it has a
fixed set of directories where it searched for files named X
(ignore packed refs for now). First directory to search for is .git. In
case of the ref named 'config' it searched there for this file, found it
(it's the .git/config file with the repo configuration in it), parsed
it, found it is an invalid ref and stopped searching. It never looked
for a file .git/refs/heads/config.

I changed JGit in a way that when it finds a file in GIT_DIR which
corresponds to a ref name and if this file doesn't contain a valid ref
then it will ignore the InvalidObjectIdException and continue searching.

Change-Id: Ic26a329fb1624a5b2b2494c78bac4bd76817c100
Bug: 381574
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2012-08-21 15:10:02 +02:00
Robin Rosenberg d4fed9cb4b Refactored method to find branches from which a commit is reachable
The method uses some heuristics to obtain much better performance
than isMergeBase.

Since I wrote the relevant code in the method I approve the license
change from EPL to EDL implied by the move.

Change-Id: Ic4a7584811a2b0bf24e4f6b3eab2a7c022eabee8
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2012-08-21 08:27:23 +02:00