Commit Graph

2259 Commits

Author SHA1 Message Date
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
Matthias Sohn 9893e9a880 Fix Jetty's p2 repository URL
The Jetty 7.x p2 repository was moved to the archive server

Change-Id: If864c64e8a64ced9b9b982332b412b367a6c1011
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-08-27 13:59:42 +02:00
Matthias Sohn e727aaf16e Update last jgit release version used in clirr API checks
Change-Id: I20b1dd7d45eb7bb2644865f019ab726354c840c7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-08-27 11:15:32 +02:00
Matthias Sohn 867e3e520a Update maven plugin versions
Change-Id: I547e89b11eaa291f1e512a209ac49eaa15273b42
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-08-27 11:15:30 +02: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
Matthias Sohn 812796023c Merge changes I4f73487b,I1d1ed122
* changes:
  The Git API's only likes /, not \ in paths
  Skip a test that cannot be verified on Windows
2012-08-21 16:59:42 -04:00
Robin Rosenberg c4bc9c709a The Git API's only likes /, not \ in paths
Therefore this test fails on Windows

Change-Id: I4f73487b720ea1479e95108344f1dc3711106408
2012-08-21 19:43:59 +02:00
Robin Rosenberg f72b26f2d3 Skip a test that cannot be verified on Windows
Change-Id: I1d1ed122c714f39ca7fb557224756205274804eb
2012-08-21 19:43:47 +02: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
Matthias Sohn 376a741d8f Teach BranchTrackingStatus to handle tracking of local branches
EGit wasn't able to decorate local branches tracking another local
branch with number of commits the checked out local branch differs from
the other local branch it's tracking.

Bug: 376970 
Change-Id: I74e932d5eacd74dbf6b0dffcfc65ba3222a8250e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-08-18 00:29:45 +02:00
Robin Stocker 5854ca091a Improve ours/theirs conflict markers for rebase, cherry-pick
On conflicts in rebase or cherry-pick, the conflict markers were like
this:

    <<<<<<< OURS
    a
    =======
    b
    >>>>>>> THEIRS

This is technically correct, but it could be better.

It's especially confusing during a rebase, where the meaning of
OURS/THEIRS is not obvious. The intuition is that "ours" is the commits
that "I" did before the rebase, but it's the other way around because of
the way rebase works. See various bug reports and stackoverflow
discussions.

With this change, in the case of a cherry-pick while on master, the
markers will be like this:

    <<<<<<< master
    a
    =======
    b
    >>>>>>> bad1dea Message of the commit I'm cherry-picking

In the case of a "git rebase master":

    <<<<<<< Upstream, based on master
    a
    =======
    b
    >>>>>>> b161dea Message of a commit I'm rebasing

It's not "master" because that would only be correct for the first
cherry-pick during a rebase, after that, it's master + already
cherry-picked commits.

And in the case of a "git pull --rebase":

    <<<<<<< Upstream, based on branch 'master' of git@example.org:repo
    a
    =======
    b
    >>>>>>> b161dea Message of a commit I'm rebasing

Bug: 336819
Change-Id: I1333a8dd170bb0077f491962013485efb6f2a926
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-08-18 00:11:45 +02:00
Patrick Carlson 9a979a3681 Make BlameGenerator comments more clear
The file location of the constructor for BlameGenerator
did not specify where the path should be relative from.

Fix BlameGenerator comments based on suggestions by Robin Stocker.

Change-Id: I3d79db2d2ba4961835fe664ae6178e0bfc97b910
2012-08-17 09:57:19 -05:00
Robin Rosenberg 9b86cf574b Suppress two resource warnings
Change-Id: I829bb135b2347f79aa6d8979a0934042e40d212f
2012-08-17 15:49:38 +02:00
Shawn Pearce ef6aec3a04 Merge changes Ie949f321,I403de522
* changes:
  Implement wasDeltaAttempted() in DfsObjectRepresentation.
  Do not delta compress objects that have already tried to compress.
2012-08-15 15:31:33 -04:00
Robin Rosenberg 342de38e57 Fix idOffset when the working tree iterator matches a dircache entry
idOffset is not zero when idBuffer comes from blob in the dircache

Change-Id: Iff768422cba140a5d6a776e2c627b852f079c1da
2012-08-15 20:20:48 +02:00
Colby Ranger b777d7797d Implement wasDeltaAttempted() in DfsObjectRepresentation.
In DFS, everything is stored in a pack but only objects in a pack with
source GC or UNREACHABLE_GARBAGE have had delta compression attempted.
Expose the PackSource setter and getter on DfsPackDescription in order
to implement wasDeltaAttempted.

Change-Id: Ie949f321147ad870f1c3f23b552343bbbda32152
2012-08-13 15:54:06 -07:00
Colby Ranger b77ba04976 Do not delta compress objects that have already tried to compress.
If an object is in a pack file already, delta compression will not
attempt to re-compress it. This assumes that the previous
packing already performed the optimal compression attempt, however,
the subclasses of StoredObjectRepresentation may use other heuristics
to determine if the stored format is optimal.

Change-Id: I403de522f4b0dd2667d54f6faed621f392c07786
2012-08-13 14:29:28 -07:00
Christian Halstrick 02113f7411 Merge "Allow JGit to read C Git rebase state" 2012-08-13 09:43:42 -04:00
Markus Duft 1e75941410 Make CheckoutCommand pass modified files through result
This change makes CheckoutCommand pass the list of modified files
through the OK result, enabling outside world to react in a smaller
scope (for example refresh only resources containing the modified
files).

Change-Id: I53c50ee09bc0d3ff501bdc25196e52e739c3f1f9
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-08-07 21:40:21 -07:00
Robin Rosenberg 993fcac2d3 Allow JGit to read C Git rebase state
C Git prefixes the time stamp in the author script with a "@"

Change-Id: I140b29519acc101da78296eef562368fc6b61135
2012-08-07 16:49:45 +02:00
Matthias Sohn e9c811d0d0 Allow detection of case insensitive file systems
Change-Id: I03f59d07bcc3338ef8d392cbd940799186ca03bd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2012-08-06 21:34:57 +02:00
Jevgeni Zelenkov 803debd7be Ensure a directory exists before trying to create/merge a file into it.
Since git doesn't keep track of empty directories, they should be
created first. Test case included demonstrates that using
StashApplyCommand(). Bugfix is applied to the DirCacheCheckout class,
because StashApplyCommand() uses it internally to apply a stash.

Change-Id: Iac259229ef919f9e92e7e51a671d877172bb88a8
Signed-off-by: Jevgeni Zelenkov <jevgeni.zelenkov@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-08-06 08:59:28 +02:00
Robin Rosenberg d08b35532a Merge "Fix PlotCommit for commits with duplicate parents" 2012-08-05 06:51:27 -04:00
Robin Rosenberg b2f911bb69 Fix PlotCommit for commits with duplicate parents
JGit allows to create commits which have duplicate parents: e.g. a
commit X has first parent Y and second parent Y. Such commits are not
handled correctly by PlotCommit leading to wrong display of the history
in EGit. In such cases there is a never ending passing line drawn beside
all commits younger than the commit with duplicate parents. This commit
fixes this by explicitly checking for duplicate parents.

In a different commit we should fix JGit not to create commits with
duplicate parents. I think native git also doesn't allow such commits,
although history display in native git (gitk, git log --graph) is not
damaged by such commits.

Change-Id: Ie3019ef613a507023958bea27b1badc3b8950279
2012-08-05 12:50:06 +02:00
Shawn Pearce 7c1e175de8 Merge "Update the README file to refer to the EDL rather than BSD license." 2012-08-01 17:29:04 -04:00
Robin Rosenberg f84fb60f02 Update the README file to refer to the EDL rather than BSD license.
The wordings of the two license are the same. This change is there
to make this file consistent with the LICENSE file.

Change-Id: I7c9d7a8f3622dd4099ca311af3dd032034bf56c0
2012-08-01 23:25:20 +02:00
Robin Rosenberg 0ec1db820d Merge "Fix resolving of relative file URIs in TransportLocal" 2012-07-29 18:31:39 -04:00
Robin Rosenberg 958a517c86 Merge "Garbage collector for FileRepositories" 2012-07-29 10:16:22 -04:00
Christian Halstrick 4c3f017a77 Garbage collector for FileRepositories
Implements a garbage collector for FileRepositories. Main ideas are
copied from the garbage collector for DFS based repos
(DfsGarbageCollector). Added functionalities are
- pruning loose objects
- handling of the index
- packing refs
- handling of reflogs (objects referenced from reflog will not be
pruned/)

These are features of a GC which are not handled in this change and
which should come with subsequent changes:
- unpacking packed objects into loose objects (to support that pruning
packed objects doesn't delete them until they are older than two weeks)
- expiration of reflogs
- support for configuration parameters (e.g. gc.pruneExpire)

Change-Id: I14ea5cb7e0fd1b5c50b994fd77f4e05bfbb9d911
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2012-07-29 15:43:50 +02:00
Shawn O. Pearce 0be3b0f70e Merge "Expose some DFS APIs as public or protected" 2012-07-29 01:01:35 -04:00
Shawn O. Pearce 3534fa9c61 Expose some DFS APIs as public or protected
Expose class DfsReader and method DfsPackFile.hasObject() as public.
Applications may want to be able to inquire about some details of
the storage of a repository. Make this possible by exposing some
simple accessor methods.

Expose method DfsObjDatabase.clearCache() as protected, allowing
implementing subclasses to dump the cache if necessary, and force
it to reload on a future request.

Change-Id: Ic592c82d45ace9f2fa5f8d7e4bacfdce96dea969
2012-07-27 06:59:32 -07:00
Robin Stocker beee7b86af Fix resolving of relative file URIs in TransportLocal
A configured remote url like "../repo" works with C Git.

In JGit, it only worked if Java's current working directory happened to
be the local repository working directory.

Change-Id: I33ba3f81b37d03cf17ca7ae25a90774a27e7e02b
Signed-off-by: Robin Stocker <robin@nibor.org>
2012-07-27 12:05:13 +02:00
Robin Rosenberg d47403ea94 Merge "[findBugs] Make ChunkKey serializable" 2012-07-26 17:21:51 -04:00
Christian Halstrick 778fdfaec1 Again teach ResolveMerger to create more correct DirCacheEntry's
Currently, after a merge/cherry-pick/rebase, all index entries are
smudged as the ResolveMerger never sets entry lengths and/or
modification times. This change teaches it to re-set them at least for
things it did not touch. The other entries are then repaired when the
index is persisted, or entries are checked out.

The first attempt to get this in was commit
3ea694c252 which has been reverted.
Since then some fixes to ResolveMerger and a few more tests have
been added which check situations where the index is not matching
HEAD before we merge.

Change-Id: I648fda30846615b3bf688c34274c6cf4bc857832
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Also-by: Markus Duft <markus.duft@salomon.at>
2012-07-26 16:20:38 +02:00
Shawn Pearce d87e56addd Merge "Revert "Teach ResolveMerger to create more correct DirCacheEntry's"" 2012-07-25 10:59:32 -04:00
Shawn Pearce 955b024995 Revert "Teach ResolveMerger to create more correct DirCacheEntry's"
This reverts commit 3ea694c252

Merges with unmodified subtrees are broken with this commit present.
Back it out until a fixed version can be supplied.
2012-07-24 20:07:48 -04:00
Robin Rosenberg c010c93694 Support [<ref>]@{upstream} revision syntax
Resolves into a ref name corresponding to the named (or current)
branch's upstream ref.

Change-Id: I98df46cedb498724cf14343fbb168f24ff667929
2012-07-20 08:29:10 +02:00