]> source.dussan.org Git - jgit.git/log
jgit.git
14 years agoAdd copyTo(ByteBuffer) to AnyObjectId 15/1215/3
Shawn O. Pearce [Fri, 30 Jul 2010 15:51:11 +0000 (08:51 -0700)]
Add copyTo(ByteBuffer) to AnyObjectId

Change-Id: I3572f6113db883002f9c3a5ecc1bcc8370105c98
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoAdd copyTo(byte[], int) to AnyObjectId 14/1214/3
Shawn O. Pearce [Fri, 30 Jul 2010 02:41:59 +0000 (19:41 -0700)]
Add copyTo(byte[], int) to AnyObjectId

This permits formatting in hex into an existing byte array
supplied by the caller, and mirrors our copyRawTo method
with the same parameter signature.

Change-Id: Ia078d83e338b09b903bfd2d04284e5283f885a19
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoAdd a public RevTag.parse() method 67/1367/1
Shawn O. Pearce [Fri, 20 Aug 2010 22:41:49 +0000 (15:41 -0700)]
Add a public RevTag.parse() method

Callers might have a canonical tag encoding on hand that they
wish to convert into a clean structure for presentation purposes,
and the object may not be available in a repository.  (E.g. maybe
its a "draft" tag being written in an editor.)

Change-Id: I387a462afb70754aa7ee20891e6c0262438fdf32
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoAdd a public RevCommit.parse() method 66/1366/1
Shawn O. Pearce [Fri, 20 Aug 2010 16:32:07 +0000 (09:32 -0700)]
Add a public RevCommit.parse() method

Callers might have a canonical commit encoding on hand that they
wish to convert into a clean structure for presentation purposes,
and the object may not be available in a repository.  (E.g. maybe
its a "draft" commit being written in an editor.)

Change-Id: I21759cff337cbbb34dbdde91aec5aa4448a1ef37
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMake Tag class only for writing 65/1365/1
Shawn O. Pearce [Fri, 20 Aug 2010 22:18:25 +0000 (15:18 -0700)]
Make Tag class only for writing

The Tag class now only supports the creation of an annotated tag
object.  To read an annotated tag, applictions should use RevTag.
This permits us to have exactly one implementation, and RevTag's
is faster and more bug-free.

Change-Id: Ib573f7e15f36855112815269385c21dea532e2cf
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMake Commit class only for writing 64/1364/1
Shawn O. Pearce [Fri, 20 Aug 2010 15:53:46 +0000 (08:53 -0700)]
Make Commit class only for writing

The Commit class now only supports the creation of a commit object.
To read a commit, applictions should use RevCommit.  This permits
us to have exactly one implementation, and RevCommit's is faster
and more bug-free.

Change-Id: Ib573f7e15f36855112815269385c21dea532e2cf
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoCorrect PersonIdent hashCode() and equals() to ignore milliseconds 63/1363/1
Shawn O. Pearce [Fri, 20 Aug 2010 22:42:52 +0000 (15:42 -0700)]
Correct PersonIdent hashCode() and equals() to ignore milliseconds

Git doesn't store millisecond accuracy in person identity lines,
so a line that we create in Java and round-trip through a Git object
wouldn't compare as being equal.  Truncate to seconds when comparing
values to ensure the same identity is equal.

Change-Id: Ie4ebde64061f52c612714e89ad34de8ac2694b07
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoTry really hard to load a commit or tag 62/1362/1
Shawn O. Pearce [Fri, 20 Aug 2010 16:25:47 +0000 (09:25 -0700)]
Try really hard to load a commit or tag

When we need the canonical form of a commit or a tag in order to
parse it into our RevCommit or RevTag fields, we really need it as a
single contiguous byte array.  However the ObjectDatabase may choose
to give us a large loader.  In general commits or tags are always
under the several MiB limit, so even if the loader calls it "large"
we should still be able to afford the JVM heap memory required to
get a single byte array.  Coerce even large loaders into a single
byte array anyway.

Change-Id: I04efbaa7b31c5f4b0a68fc074821930b1132cfcf
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoFix ReadTreeTests to not rely on cached index 52/1352/1
Christian Halstrick [Fri, 20 Aug 2010 08:15:53 +0000 (10:15 +0200)]
Fix ReadTreeTests to not rely on cached index

ReadTreeTests relied on Repository.getIndex() which on
platforms which coarse FileSystemTimers failed to detect
index modifications. By explicitly reloading and writing
the index this problem is solved.

Change-Id: I0a98babfc2068a3b6b7d2257834988e1154f5b26
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoFix formatting of serialization code in ObjectId 43/1343/1
Shawn O. Pearce [Thu, 19 Aug 2010 18:53:22 +0000 (11:53 -0700)]
Fix formatting of serialization code in ObjectId

Change-Id: I5b3e99e9e658fe272a9e171db04b0f20e48ed8d3
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMake ObjectId.compareTo final 42/1342/1
Shawn O. Pearce [Thu, 19 Aug 2010 18:50:20 +0000 (11:50 -0700)]
Make ObjectId.compareTo final

Since equals() is now final and does not permit being overridden,
we should do the same thing with compareTo() to prevent different
subclasses from having different ordering behaviors.  This could
lead to the same mess that we had with different equals() behaviors.

Change-Id: I35a849b6efccee5fe74cc5788a3566a1516004b7
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMake ObjectId.hashCode final too 41/1341/1
Shawn O. Pearce [Thu, 19 Aug 2010 18:46:22 +0000 (11:46 -0700)]
Make ObjectId.hashCode final too

Since equals() is now final and does not permit being overridden,
we should do the same thing with hashCode() to prevent different
subclasses from having different hashing behaviors.  This could
lead to the same mess that we had with different equals() behaviors.

Change-Id: I35a849b6efccee5fe74cc5788a3566a1516004b7
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoRemove unnecessary ObjectId.copy() calls 40/1340/1
Shawn O. Pearce [Thu, 19 Aug 2010 18:43:39 +0000 (11:43 -0700)]
Remove unnecessary ObjectId.copy() calls

When RevObject overrode equals() to provide only reference equality
we used to need to convert a RevObject into an ObjectId by copy()
just to use standard Java tools like JUnit assertEquals(), or to
use contains() or get() on standard java.util collection types.

Now that we have removed this override and made ObjectId's equals()
final (preventing any of this mess in the future), some copy()
calls are unnecessary.  Anytime the value is being used as an input
to a lookup routine, or to an equals, we can avoid the copy().

However we still want to use copy() anytime we are given an ObjectId
that may exist long-term, where we don't want the high cost of the
additional storage from a RevCommit extension.  So we can't remove
all uses of copy(), just some of them.

Change-Id: Ief275dace435c0ddfa362ac8e5d93558bc7e9fc3
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoFix missing Configuration Change eventing 81/1281/6
Mathias Kinzler [Thu, 19 Aug 2010 07:11:03 +0000 (09:11 +0200)]
Fix missing Configuration Change eventing

Configuration change events were not being triggered, now they are
forwarded from the FileConfig up to the Repository's listeners.

Change-Id: Ida94a59f5a2b7fa8ae0126e33c13343275483ee5
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoEnhance MergeResult to report conflicts, etc 25/1225/5
Christian Halstrick [Thu, 19 Aug 2010 13:52:12 +0000 (15:52 +0200)]
Enhance MergeResult to report conflicts, etc

The MergeResult class is enhanced to report more data about a
three-way merge. Information about conflicts and the base, ours,
theirs commits can be retrived.

Change-Id: Iaaf41a1f4002b8fe3ddfa62dc73c787f363460c2
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agoAllow for optional tagger and message in Tag 33/1333/4
Chris Aniszczyk [Thu, 19 Aug 2010 02:12:15 +0000 (21:12 -0500)]
Allow for optional tagger and message in Tag

We should be more lenient when tagging without an
tagger or message. Currently, we will throw an NPE
which is incorrect behavior.

Change-Id: I04e30ce25a9432e4ca56c3f29658ecb24fb18d24
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agoRemove getter and setter for author in Tag 31/1331/2
Chris Aniszczyk [Thu, 19 Aug 2010 01:56:27 +0000 (20:56 -0500)]
Remove getter and setter for author in Tag

There was a duplicated getter and setter for tagger in Tag.
There's no needed to have two getters and setters that represent
the same things. The appropriate tests were updated also.

Change-Id: If46dc00c4c0f31ea4234c6d3bda3c03e6ebbafac
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agoAdd blob-data to utility method indexState() 16/1316/2
Christian Halstrick [Mon, 16 Aug 2010 16:44:26 +0000 (18:44 +0200)]
Add blob-data to utility method indexState()

indexState() encodes the complete state of the index
into one readable String. This helps to write tests
against the index. indexState() is enhanced to optionally
also contain the content of the files in the index.

Change-Id: Ie988f93768d864f4cbd55809a786bd5759fc24a5
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
14 years agoadded resetIndex() to RepositoryTestCase 15/1315/2
Christian Halstrick [Mon, 16 Aug 2010 16:42:24 +0000 (18:42 +0200)]
added resetIndex() to RepositoryTestCase

Added a utility method to set the reset an index to match exactly
some content in the filesystem. This can be used by tests to prepare
commits in the working-tree and set the index in one shot.

[sp: Cleaned up formatting, added getEntryFile(), released inserter.]

Change-Id: If38b1f7cacaaf769f51b14541c5da0c1e24568a5
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoDo not trigger RefsChangedEvent on the first attempt to read a ref 09/1309/2
Robin Rosenberg [Sun, 15 Aug 2010 09:53:42 +0000 (11:53 +0200)]
Do not trigger RefsChangedEvent on the first attempt to read a ref

Such events make no sense, it has never been visible to this
process so no client can have a stale value of the ref.

Change-Id: Iea3a5035b0a1410b80b09cf53387b22b78b18018
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
14 years agoAdd FileRepository(String) convenience constructor 22/1322/2
Ketan Padegaonkar [Tue, 17 Aug 2010 02:41:54 +0000 (19:41 -0700)]
Add FileRepository(String) convenience constructor

Add a convenience API in FileRepository to pass in a String that
points to the GIT_DIR location.  This is converted to a File and
sent through the usual constructor.

Change-Id: I588388f37e89b8c690020f110a1bc59f46170c40

14 years agoMerge "Backout RevObject's object-identity based equals implementation"
Shawn Pearce [Wed, 18 Aug 2010 19:00:33 +0000 (15:00 -0400)]
Merge "Backout RevObject's  object-identity based equals implementation"

14 years agoSet default file encoding used for JGit tests to UTF-8 14/1314/1
Matthias Sohn [Mon, 16 Aug 2010 15:42:41 +0000 (17:42 +0200)]
Set default file encoding used for JGit tests to UTF-8

This patch fixes the problem that JGit tests run from Maven fail on
Mac OS X [1]. In Eclipse the tests succeed since we set Eclipse
workspace encoding to UTF-8 via "Preferences > General > Workspace
> Text file encoding", checked via JConsole that this setting changes
the JVM system property of the test run. This change copies this
setting to the Maven test environment so that we get consistent test
results on all platforms.

[1] http://kerneltrap.org/mailarchive/git/2009/2/6/4916414/thread

Change-Id: Ia657d4037c518411f7bc3c75626dbafb1f4706a2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoBackout RevObject's object-identity based equals implementation 13/1313/1
Matthias Sohn [Sun, 15 Aug 2010 21:12:58 +0000 (23:12 +0200)]
Backout RevObject's  object-identity based equals implementation

This restores the transitivity and symmetry properties of the equals
methods on the AnyObjectId type hierarchy as defined in [1].
Following [2] we declare these equals methods final to ensure that
semantics of equals are consistent across AnyObjectId's type hierarchy.

[1] http://download-llnw.oracle.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)
[2] http://www.angelikalanger.com/Articles/JavaSolutions/SecretsOfEquals/Equals.html

Bug: 321502
Change-Id: Ibace21fa268c4aa15da6c65d42eb705ab1aa24b3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoMerge "Fix RevCommitList to work with subclasses of RevWalk"
Shawn Pearce [Thu, 12 Aug 2010 23:48:44 +0000 (19:48 -0400)]
Merge "Fix RevCommitList to work with subclasses of RevWalk"

14 years agoFix RevCommitList to work with subclasses of RevWalk 99/1299/1
Matthias Sohn [Thu, 12 Aug 2010 23:47:17 +0000 (01:47 +0200)]
Fix RevCommitList to work with subclasses of RevWalk

Bug: 321502
Change-Id: Ic4bc49a0da90234271aea7c0a4e344a1c3620cfc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoImprove IndexDiff performance 90/1290/3
Jens Baumgart [Thu, 12 Aug 2010 16:28:07 +0000 (18:28 +0200)]
Improve IndexDiff performance

Exclude ignored files from IndexDiff tree walk.
This makes EGit commit much faster.

Change-Id: I398499510c22c37667b7612db32eac3b31d325f0
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agoMerge "Hide Maven target directories from Eclipse"
Chris Aniszczyk [Wed, 11 Aug 2010 15:17:18 +0000 (11:17 -0400)]
Merge "Hide Maven target directories from Eclipse"

14 years agoTransportHttp does not honor timeout setting 76/1276/1
Mathias Kinzler [Tue, 10 Aug 2010 13:58:21 +0000 (15:58 +0200)]
TransportHttp does not honor timeout setting

This can result in an infinitely hanging IDE.

Change-Id: I669bc8d220a07011a42edf79de31825305ff3763
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
14 years agoFix NPE on commit in empty Repository 67/1267/1
Jens Baumgart [Mon, 9 Aug 2010 09:14:38 +0000 (11:14 +0200)]
Fix NPE on commit in empty Repository

NPE occured when committing in an empty repository.

Bug: 321858
Change-Id: Ibddb056c32c14c1444785501c43b95fdf64884b1
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
14 years agoHide Maven target directories from Eclipse 62/1262/1
Robin Rosenberg [Sun, 8 Aug 2010 11:16:53 +0000 (13:16 +0200)]
Hide Maven target directories from Eclipse

Change-Id: I64f12a35423a90ced9c9bc83f6869d8ed766dd35
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
14 years agoMerge branch 'rename-bug' 61/1261/1
Shawn O. Pearce [Fri, 6 Aug 2010 16:48:50 +0000 (09:48 -0700)]
Merge branch 'rename-bug'

* rename-bug:
  Fix ArrayIndexOutOfBounds on non-square exact rename matrix

Conflicts:
org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java

Change-Id: Ie0b8dd3e1ec174f79ba39dc4706bb0694cc8be29

14 years agoFix ArrayIndexOutOfBounds on non-square exact rename matrix 60/1260/1
Shawn O. Pearce [Fri, 6 Aug 2010 16:33:55 +0000 (09:33 -0700)]
Fix ArrayIndexOutOfBounds on non-square exact rename matrix

If the exact rename matrix for a particular ObjectId isn't square we
crashed with an ArrayIndexOutOfBoundsException because the matrix
entries were encoded backwards.  The encode function accepts the
source (aka deleted) index first, not second.  Add a unit test to
cover this non-square case to ensure we don't have this regression
in the future.

Change-Id: I5b005e5093e1f00de2e3ec104e27ab6820203566
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMerge changes I39bfefee,I47795987,I70d120fb,I58cc5e01,I96bee7b9
Shawn O. Pearce [Fri, 6 Aug 2010 01:11:31 +0000 (21:11 -0400)]
Merge changes I39bfefee,I47795987,I70d120fb,I58cc5e01,I96bee7b9

* changes:
  Enable configuration of non-standard pack settings
  Pass PackConfig down to PackWriter when packing
  Simplify UploadPack use of options during writing
  Move PackWriter configuration to PackConfig
  Allow PackWriter callers to manage the thread pool

14 years agoMerge "Remove static progress task names from PackWriter"
Shawn O. Pearce [Fri, 6 Aug 2010 01:11:30 +0000 (21:11 -0400)]
Merge "Remove static progress task names from PackWriter"

14 years agoMerge "Add "all" parameter to the commit Command"
Chris Aniszczyk [Thu, 5 Aug 2010 19:02:59 +0000 (15:02 -0400)]
Merge "Add "all" parameter to the commit Command"

14 years agoMerge "Add the parameter "update" to the Add command"
Chris Aniszczyk [Thu, 5 Aug 2010 19:01:53 +0000 (15:01 -0400)]
Merge "Add the parameter "update" to the Add command"

14 years agoMerge "add fsTick() to RepositoryTestCase"
Chris Aniszczyk [Thu, 5 Aug 2010 18:57:14 +0000 (14:57 -0400)]
Merge "add fsTick() to RepositoryTestCase"

14 years agoMerge "add more control to indexState() return-value"
Chris Aniszczyk [Thu, 5 Aug 2010 18:56:43 +0000 (14:56 -0400)]
Merge "add more control to indexState() return-value"

14 years agoAllow to replace existing Change-Id 39/1239/3
Stefan Lay [Thu, 5 Aug 2010 12:11:38 +0000 (14:11 +0200)]
Allow to replace existing Change-Id

It is useful to be able to replace an existing Change-Id
in the message, for example if the user decides not to
amend the previous commit.

Bug: 321188
Change-Id: I594e7f9efd0c57d794d2bd26d55ec45f4e6a47fd
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agoRename getOldName,getNewName to getOldPath,getNewPath 95/1195/2
Shawn O. Pearce [Wed, 28 Jul 2010 21:45:12 +0000 (14:45 -0700)]
Rename getOldName,getNewName to getOldPath,getNewPath

TreeWalk calls this value "path", while "name" is the stuff after the
last slash.  FileHeader should do the same thing to be consistent.
Rename getOldName to getOldPath and getNewName to getNewPath.

Bug: 318526
Change-Id: Ib2e372ad4426402d37939b48d8f233154cc637da
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMerge branch 'js/diff' 37/1237/1
Shawn O. Pearce [Wed, 4 Aug 2010 17:59:35 +0000 (10:59 -0700)]
Merge branch 'js/diff'

* js/diff:
  Fixed bug in scoring mechanism for rename detection

14 years agoFixed bug in scoring mechanism for rename detection 32/1232/2
Jeff Schumacher [Tue, 3 Aug 2010 23:59:30 +0000 (16:59 -0700)]
Fixed bug in scoring mechanism for rename detection

A bug in rename detection would cause file scores to be wrong. The
bug was due to the way rename detection would judge the similarity
between files. If file A has three lines containing 'foo', and file
B has 5 lines containing 'foo', the rename detection phase should
record that A and B have three lines in common (the minimum of the
number of times that line appears in both files). Instead, it would
choose the the number of times the line appeared in the destination
file, in this case file B. I fixed the bug by having the
SimilarityIndex instead choose the minimum number, as it should. I
also added a test case to verify that the bug had been fixed.

Change-Id: Ic75272a2d6e512a361f88eec91e1b8a7c2298d6b

14 years agoAdd gitignore support to IndexDiff and use TreeWalk 33/1233/4
Jens Baumgart [Wed, 4 Aug 2010 09:49:33 +0000 (11:49 +0200)]
Add gitignore support to IndexDiff and use TreeWalk

IndexDiff was re-implemented and now uses TreeWalk instead
of GitIndex. Additionally, gitignore support and retrieval of
untracked files was added.

Change-Id: Ie6a8e04833c61d44c668c906b161202b200bb509
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agoAdd "all" parameter to the commit Command 48/1148/4
Stefan Lay [Wed, 28 Jul 2010 09:00:22 +0000 (11:00 +0200)]
Add "all" parameter to the commit Command

When the add parameter is set all modified and deleted files
are staged prior to commit.

Change-Id: Id23bc25730fcdd151386cd495a7cdc0935cbc00b
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
14 years agoAdd the parameter "update" to the Add command 47/1147/7
Stefan Lay [Wed, 4 Aug 2010 11:21:57 +0000 (13:21 +0200)]
Add the parameter "update" to the Add command

This change is mainly done for a subsequent commit
which will introduce the "all" parameter to the Commit
command.

Bug: 318439
Change-Id: I85a8a76097d0197ef689a289288ba82addb92fc9
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
14 years agoadd fsTick() to RepositoryTestCase 31/1231/2
Christian Halstrick [Tue, 3 Aug 2010 20:27:41 +0000 (22:27 +0200)]
add fsTick() to RepositoryTestCase

An utility method which was in RacyGitTests has been moved to
RepositoryTestCase. Also the javadoc has been improved.
This method allows to wait long enough until the
filesystem-timer has advanced. This is useful when it has to
be guaranteed that two files modifications have different
modification timestamps.

Change-Id: I2ebd7cd7818feba6acffb3f835101d8fd281bd5a
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
14 years agoadd more control to indexState() return-value 30/1230/2
Christian Halstrick [Wed, 4 Aug 2010 11:35:56 +0000 (13:35 +0200)]
add more control to indexState() return-value

The indexState() method was enhanced to be more configurable. A bitmask
controls which of the optional parts are reported. All data about
the worktree is not reported anymore by this method which makes the
interface more cleaner for users wanting to test only the state of the
index.
This was done because the previous version reported always so much
additional data that it was hard to write good assertions against it.

Change-Id: I9b481e97f8fcf3fcdbb785b801dc07bfa85dcc33
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
14 years agoMerge "Fixed FileTreeIteratorWithTimeControl"
Christian Halstrick [Tue, 3 Aug 2010 08:32:52 +0000 (04:32 -0400)]
Merge "Fixed FileTreeIteratorWithTimeControl"

14 years agoAllow version builtin to run without git repository 12/1212/1
Benjamin Muskalla [Mon, 2 Aug 2010 16:00:43 +0000 (18:00 +0200)]
Allow version builtin to run without git repository

The version builtin should be able to run without a git directory to call
it from wherever you want.

Change-Id: I1a3bce662e6788b860a275ee50315af8d5cc094a
Signed-off-by: Benjamin Muskalla <bmuskalla@eclipsesource.com>
14 years agoFixed FileTreeIteratorWithTimeControl 03/1203/2
Stefan Lay [Fri, 30 Jul 2010 15:35:29 +0000 (17:35 +0200)]
Fixed FileTreeIteratorWithTimeControl

getEntryLastModified returned wrong values for
timestamps on boundaries.

Change-Id: I0457ff030946fda7ecc70671bc65db02a8c206ee
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
14 years agoMake use of Repository.writeMerge...() 97/1197/1
Christian Halstrick [Thu, 29 Jul 2010 07:09:54 +0000 (09:09 +0200)]
Make use of Repository.writeMerge...()

The CommitCommand should not use java.io to delete MERGE_HEAD and MERGE_MSG
files since Repository already has utility methods for that.

Change-Id: If66a419349b95510e5b5c2237a91f06c1d5ba0d4
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
14 years agoRemove use of SortedSet.floor() 93/1193/1
Shawn O. Pearce [Wed, 28 Jul 2010 21:40:09 +0000 (14:40 -0700)]
Remove use of SortedSet.floor()

Its only available in Java 6, and JGit still supports Java 5.

Change-Id: I6c8fac06106ffe20ac8b4b595f34e027f2d29cc2
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMerge "Fix tag sorting in PlotWalk"
Christian Halstrick [Wed, 28 Jul 2010 21:13:27 +0000 (17:13 -0400)]
Merge "Fix tag sorting in PlotWalk"

14 years agoAdd tests for racy git / Index state encoding 61/1161/4
Christian Halstrick [Tue, 20 Jul 2010 19:21:14 +0000 (21:21 +0200)]
Add tests for racy git / Index state encoding

In order to test racy git situations we have to be able to control
the last-modification timestamps of the filesystem. Since we already
access the modification timestamps of files through an abstraction
(the WorkingTreeIterator) I add a new implementation of this iterator
which allows to map timestamp-ranges to single constant timestamps.
For users of this iterator it looks like all files in that range
have been modified at exactly the same time.
With the help of this iterator a test has been writting which
checkes for racy git handling (smudging, unsmudging, dirty-detection).

Additionally add a method to RepositoryTestCase which encodes the
current index state in one String. This should include info about
pathes, file/index modtime, smudgeState, clean-state. Make
sure timestamps are presented in a way that it is easy to
write assertions against this strings (no concrete milliseconds
but t0,t1,...).

These two topics depend circulary on each other: thats why they have
been squashed in one commit.

Change-Id: I115c3f2f20fca9b481830bdc6b9d1ade2c3abdcf
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
14 years agoEnable configuration of non-standard pack settings 91/1191/2
Shawn O. Pearce [Wed, 28 Jul 2010 18:23:32 +0000 (11:23 -0700)]
Enable configuration of non-standard pack settings

For daemons we might want to disable delta compression entirely, or
in some strange case an administrator might need to turn of delta
reuse.  Expose these normally internal pack settings through the pack
configuration section.

Change-Id: I39bfefee8384c864cc04ffac724f197240c8a11a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoPass PackConfig down to PackWriter when packing 90/1190/2
Shawn O. Pearce [Wed, 28 Jul 2010 17:48:53 +0000 (10:48 -0700)]
Pass PackConfig down to PackWriter when packing

When we are creating a pack the higher level application should be able
to override the PackConfig used, allowing it to control the number of
threads used or how much memory is allocated per writer.

Change-Id: I47795987bb0d161d3642082acc2f617d7cb28d8c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoSimplify UploadPack use of options during writing 89/1189/2
Shawn O. Pearce [Wed, 28 Jul 2010 17:52:36 +0000 (10:52 -0700)]
Simplify UploadPack use of options during writing

We only use these variables once, so just put them at the proper
use site and avoid assigning the local variable.  The code is a
bit shorter and the intent is a little bit more clear.

Change-Id: I70d120fb149b612ac93055ea39bc053b8d90a5db
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMove PackWriter configuration to PackConfig 88/1188/2
Shawn O. Pearce [Wed, 28 Jul 2010 17:45:27 +0000 (10:45 -0700)]
Move PackWriter configuration to PackConfig

This refactoring permits applications to configure global per-process
settings for all packing and easily pass it through to per-request
PackWriters, ensuring that the process configuration overrides the
repository specific settings.

For example this might help in a daemon environment where the server
wants to cap the resources used to serve a dynamic upload pack
request, even though the repository's own pack.* settings might be
configured to be more aggressive.  This allows fast but less bandwidth
efficient serving of clients, while still retaining good compression
through a cron managed `git gc`.

Change-Id: I58cc5e01b48924b1a99f79aa96c8150cdfc50846
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMeaningful error message when trying to check-out submodules 83/1083/4
Mathias Kinzler [Wed, 28 Jul 2010 11:58:39 +0000 (13:58 +0200)]
Meaningful error message when trying to check-out submodules

Currently, a NullPointerException occurs in this case. We should
instead throw a more meaningful Exception with a proper message.
This is a very "stupid" implementation which simply checks for
the existence of a ".gitmodules" file.

Bug: 300731
Bug: 306765
Bug: 308452
Bug: 314853
Change-Id: I155aa340a85cbc5d7d60da31dba199fc30689b67
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
14 years agoFix unit tests under windows 85/1185/2
Christian Halstrick [Wed, 28 Jul 2010 11:29:18 +0000 (13:29 +0200)]
Fix unit tests under windows

the following tests fail under windows because certain inputstreams
are not closed and files cannot be deleted because of that.  The
main problem I found is UnpackedObject.InflaterInputStream.close().
This method may throw exceptions found by checkValidEndOfStream()
but doesn't call super.close() before leaving. It is not clear to me
which resources a close() method should release before it throws an
exception. But those reseources which are not published to the
outside and which therefore cannot be closed by other means have to
be closed in all cases.
I changed the close() method to call super.close() under all
circumstances.

failing tests:
  testStandardFormat_LargeObject_TruncatedZLibStream(org.eclipse.jgit.storage.file.UnpackedObjectTest)
  testStandardFormat_LargeObject_TrailingGarbage(org.eclipse.jgit.storage.file.UnpackedObjectTest)
  testPackFormat_SmallObject(org.eclipse.jgit.storage.file.UnpackedObjectTest)

Change-Id: Id2e609a29e725aad953ff9bd88af6381df38399d
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
14 years agoFix tag sorting in PlotWalk 92/1192/1
Shawn O. Pearce [Wed, 28 Jul 2010 18:44:00 +0000 (11:44 -0700)]
Fix tag sorting in PlotWalk

By deferring tag sorting until the commit is produced by the walker
we can avoid an infinite loop that was triggered by trying to sort
tags while allocating a commit.  This also avoids needing to look
at commits which aren't going to be produced in the result.

Bug: 321103
Change-Id: I25acc739db2ec0221a50b72c2d2aa618a9a75f37
Reviewed-by: Mathias Kinzler <mathias.kinzler@sap.com>
Reviewed-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoRemove static progress task names from PackWriter 86/1186/1
Shawn O. Pearce [Wed, 28 Jul 2010 17:48:04 +0000 (10:48 -0700)]
Remove static progress task names from PackWriter

These need to be dynamic based on the current thread's environment
at time of execution in order to be properly localized for the end
user that will be seeing these messages.

Change-Id: I4976f462cfe606edd2761c0e36b2f6b20f63d53c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoAllow PackWriter callers to manage the thread pool 87/1187/1
Shawn O. Pearce [Wed, 28 Jul 2010 02:32:13 +0000 (19:32 -0700)]
Allow PackWriter callers to manage the thread pool

By permitting the caller of PackWriter to select the Executor it
uses for task execution, we give the caller the ability to manage
the lifecycle of the thread pool, including reusing it across
concurrent pack generators.

This is the first step to supporting application thread pools
within Daemon or another managed service like Gerrit Code Review.

Change-Id: I96bee7b9c30ff9885f2bd261d0b6daaac713b5a4
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoTeach NameConflictTreeWalk to report DF conflicts 69/1169/3
Christian Halstrick [Thu, 22 Jul 2010 13:57:14 +0000 (15:57 +0200)]
Teach NameConflictTreeWalk to report DF conflicts

Add a method isDirectoryFileConflict() to NameConflictTreeWalk which
tells whether the current path is part of a directory/file conflict.

Change-Id: Iffcc7090aaec743dd6f3fd1a333cac96c587ae5d
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoStack Overflow in EGit History View 83/1183/1
Mathias Kinzler [Wed, 28 Jul 2010 09:46:05 +0000 (11:46 +0200)]
Stack Overflow in EGit History View

This is caused by a recursion in PlotWalk.getTags().
As a hotfix, the sort was simply removed. The sort
must be re-implemented so that parseAny() is not called
again (currently, this happens in the PlotRefComparator).

Change-Id: I060d26fda8a75ac803acaf89cfb7d3b4317328f3
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
14 years agoBreak dissimilar file pairs during diff 70/1170/7
Jeff Schumacher [Thu, 22 Jul 2010 19:55:28 +0000 (12:55 -0700)]
Break dissimilar file pairs during diff

File pairs that are very dissimilar during a diff were not being
broken apart into their constituent ADD/DELETE pairs. The leads to
sub-optimal rename detection. Take, for example, this situation:

A file exists at src/a.txt containing "foo". A user renames src/a.txt
to src/b.txt, then adds a new src/a.txt containing "bar".

Even though the old a.txt and the new b.txt are identical, the
rename detection algorithm would not detect it as a rename since
it was already paired in a MODIFY. I added code to split all
MODIFYs below a certain score into their constituent ADD/DELETE
pairs. This allows situations like the one I described above to be
more correctly handled.

Change-Id: I22c04b70581f206bbc68c4cd1ee87a1f663b418e
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoAdd methods which write MERGE_HEAD and MERGE_MSG 62/1162/3
Christian Halstrick [Wed, 21 Jul 2010 15:14:54 +0000 (17:14 +0200)]
Add methods which write MERGE_HEAD and MERGE_MSG

Add methods to the Repository class which write into MERGE_HEAD
and MERGE_MSG files. Since we have the read methods in the same
class this seems to be the right place.

Change-Id: I5dd65306ceb06e008fcc71b37ca3a649632ba462
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoFix concurrent read / write issue in LockFile on Windows 72/1172/5
Jens Baumgart [Mon, 26 Jul 2010 08:18:47 +0000 (10:18 +0200)]
Fix concurrent read / write issue in LockFile on Windows

LockFile.commit fails if another thread concurrently reads
the base file. The problem is fixed by retrying the rename
operation if it fails.

Change-Id: I6bb76ea7f2e6e90e3ddc45f9dd4d69bd1b6fa1eb
Bug: 308506
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
14 years agoFix Javadoc warnings 74/1174/2
Robin Stocker [Sat, 24 Jul 2010 09:34:58 +0000 (11:34 +0200)]
Fix Javadoc warnings

There were some broken links, incorrect uses of @value, an invalid
tag and an outdated comment.

Change-Id: I22886bcc869a4b62bd606ebed40669f7b4723664
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMake forPath(ObjectReader) variant in TreeWalk 80/1180/1
Shawn O. Pearce [Tue, 27 Jul 2010 15:36:24 +0000 (08:36 -0700)]
Make forPath(ObjectReader) variant in TreeWalk

This simplifies the logic for those who already have an ObjectReader
on hand want to reuse it to lookup a single path.

Change-Id: Ief17d6b2a0674ddb34bbc9f43121b756eae960fb
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMake StoredConfig an abstraction above FileBasedConfig 78/1178/1
Shawn O. Pearce [Mon, 26 Jul 2010 23:50:11 +0000 (16:50 -0700)]
Make StoredConfig an abstraction above FileBasedConfig

This exposes a load and save method, allowing a Repository to denote
that it has a persistent configuration of some kind which can be
accessed by the application, without needing to know exact details
of how its stored .

Change-Id: I7c414bc0f975b80f083084ea875eca25c75a07b2
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMerge branch 'delta' 71/1171/1
Shawn O. Pearce [Thu, 22 Jul 2010 18:17:00 +0000 (11:17 -0700)]
Merge branch 'delta'

* delta: (103 commits)
  Discard the uncompressed delta as soon as its compressed
  Honor pack.windowlimit to cap memory usage during packing
  Honor pack.threads and perform delta search in parallel
  Cache small deltas during packing
  Implement delta generation during packing
  debug-show-packdelta:  Dump a pack delta to the console
  Initial pack format delta generator
  Add debugging toString() method to ObjectToPack
  Make ObjectToPack clearReuseAsIs signal available to subclasses
  Correctly classify the compressing objects phase
  Refactor ObjectToPack's delta depth setting
  Configure core.bigFileThreshold into PackWriter
  Add doNotDelta flag to ObjectToPack
  Add more configuration options to PackWriter
  Save object path hash codes during packing
  Add path hash code to ObjectWalk
  Add getObjectSize to ObjectReader
  Allow TemporaryBuffer.Heap to allocate smaller than 8 KiB
  Define a constant for 127 in DeltaEncoder
  Cap delta copy instructions at 64k
  ...

Conflicts:
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties
org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RewriteTreeFilter.java

Change-Id: I7c7a05e443a48d32c836173a409ee7d340c70796

14 years agoAllow client of Add command to set a WorkingTreeIterator 66/1166/2
Stefan Lay [Thu, 22 Jul 2010 12:57:00 +0000 (14:57 +0200)]
Allow client of Add command to set a WorkingTreeIterator

This is e.g. useful when a client of the AddCommand has
additional rules to ignore files. In Eclipse a resource can
be set to derived or be excluded by preferences.

Change-Id: I6c47e54a1ce26315faf5ed0723298ad2c2db197c
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
14 years agoAllow for filepattern "." in AddCommand 65/1165/1
Stefan Lay [Thu, 22 Jul 2010 12:27:35 +0000 (14:27 +0200)]
Allow for filepattern "." in AddCommand

Enable adding on repository root level.

Change-Id: I415b10dc74cc9435578424d9f106c972fd703055
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
14 years agoDo not add ignored files in Add command 63/1163/1
Stefan Lay [Thu, 22 Jul 2010 09:26:04 +0000 (11:26 +0200)]
Do not add ignored files in Add command

Signed-off-by: Stefan Lay <stefan.lay@sap.com>
14 years agoMove ignore node handling into WorkingTreeIterator 56/1156/5
Shawn O. Pearce [Wed, 21 Jul 2010 08:51:15 +0000 (10:51 +0200)]
Move ignore node handling into WorkingTreeIterator

The working tree iterator has perfect knowledge of the path structure
as well as immediate information about whether or not an ignore file
even exists at this level.  We can exploit that to simplify the
logic and running time for testing ignored file status by pushing
all of the checks down into the iterator itself.

Change-Id: I22ff534853e8c5672cc5c2d9444aeb14e294070e
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Charley Wang <chwang@redhat.com>
CC: Chris Aniszczyk <caniszczyk@gmail.com>
CC: Stefan Lay <stefan.lay@sap.com>
CC: Matthias Sohn <matthias.sohn@sap.com>
14 years agoMerge "Fix concurrent read / write issue in GitIndex on Windows"
Shawn Pearce [Wed, 21 Jul 2010 17:08:01 +0000 (13:08 -0400)]
Merge "Fix concurrent read / write issue in GitIndex on Windows"

14 years agoFix concurrent read / write issue in GitIndex on Windows 52/1152/4
Jens Baumgart [Wed, 21 Jul 2010 07:35:15 +0000 (09:35 +0200)]
Fix concurrent read / write issue in GitIndex on Windows

GitIndex.write fails if another thread concurrently reads
the index file. The problem is fixed by retrying the rename
operation if it fails.

Bug: 311051
Change-Id: Ib243d2a90adae312712d02521de4834d06804944
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
14 years agoCheck for racy git in WorkingTreeIterator 43/1143/2
Christian Halstrick [Fri, 16 Jul 2010 07:59:13 +0000 (09:59 +0200)]
Check for racy git in WorkingTreeIterator

The WorkingTreeIterator has a method to check whether
the current file differs from the corresponding index
entry. This commit improves this check to also handle
racy git situations.

See http://git.kernel.org/?p=git/git.git;a=blob;f=Documentation/technical/racy-git.txt;hb=HEAD

Change-Id: I3ad0897211dcbb2eac9eebcb19d095a5052fb06b
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoSmudge racily clean index entries by truncating length (like git.git) 42/1142/2
Christian Halstrick [Thu, 15 Jul 2010 11:36:11 +0000 (13:36 +0200)]
Smudge racily clean index entries by truncating length (like git.git)

To mark an entry racily clean we set its length to 0 (like native git
does). Entries which are not racily clean and have zero length can be
distinguished from racily clean entries by checking P_OBJECTID
against the SHA1 of empty content. When length is 0 and P_OBJECTID is
different from SHA1 of empty content we know the entry is marked
racily clean.

See http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg00488.html

Change-Id: I689552931441ab51964b430b303160c9126b66af
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoUse proper constants for .gitignore and .git directory 55/1155/1
Shawn O. Pearce [Tue, 20 Jul 2010 16:11:39 +0000 (09:11 -0700)]
Use proper constants for .gitignore and .git directory

We have a constant for .gitignore, so use it.  While we are in
the same method, correct the reference of ".git" to be the actual
GIT_DIR given.  This might not be within the work tree if the
GIT_DIR and GIT_WORK_TREE environment variables were used.

Change-Id: I38e1cec13405109b9c347858b38dd9fb2f1f2560
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Charley Wang <chwang@redhat.com>
CC: Chris Aniszczyk <caniszczyk@gmail.com>
CC: Stefan Lay <stefan.lay@sap.com>
CC: Matthias Sohn <matthias.sohn@sap.com>
14 years agoRemove gitIgnoreTimestamp from abstract iterator API 54/1154/1
Shawn O. Pearce [Tue, 20 Jul 2010 15:58:14 +0000 (08:58 -0700)]
Remove gitIgnoreTimestamp from abstract iterator API

This never should have been exposed on the top of the
AbstractTreeIterator type hierarchy.  There is no concept of a
timestamp in a canonical tree read from the object database, and
the time in the DirCache isn't what we want here either.

Actually all that we need is to find the files whose names are
".gitignore" and are below the root directory.  We can accomplish
that with a suffix filter, and process them immediately.

Change-Id: Ib09cbf81a9e038452ce491385c65498312e2916b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Charley Wang <chwang@redhat.com>
CC: Chris Aniszczyk <caniszczyk@gmail.com>
CC: Stefan Lay <stefan.lay@sap.com>
CC: Matthias Sohn <matthias.sohn@sap.com>
14 years agoFix NPE in RenameDetector 51/1151/1
Shawn O. Pearce [Tue, 20 Jul 2010 14:52:35 +0000 (07:52 -0700)]
Fix NPE in RenameDetector

If we have two adds of the same object but no deletes the detector
threw an NPE because the entry that came back from the deleted map
was null (no matching objects).  In this case we need to put the
adds all back onto the list of left over additions since they did
not match a delete.

Change-Id: Ie68fbe7426b4dc0cb571a08911c7adbffff755d5
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Jeffrey Schumacher" <jeffschu@google.com>
14 years agoIndexPack: Fix spurious pack file corruption errors 50/1150/1
Shawn O. Pearce [Tue, 20 Jul 2010 14:40:48 +0000 (07:40 -0700)]
IndexPack: Fix spurious pack file corruption errors

We didn't correctly handle the zlib trailer for an object.  If the
trailer bytes were outside of the current buffer window but we had
fully inflated the object itself, we broke out of the loop (as we had
our target size) but inflate wasn't finished (as it did not yet get
the trailer) so we failed the test and threw a corruption exception.

Use an infinite loop and only break out when the inflater is done.

Change-Id: I7c9bbbeb577a990d9bc56a50ebd485935460f6c8
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoFully implement Logger interface 89/689/2
Jonathan Gossage [Fri, 16 Jul 2010 23:53:23 +0000 (01:53 +0200)]
Fully implement Logger interface

On April 27, 2010 the Logger interface was upgraded with a number of new methods
to make it consistent with the implementations it was meant to support.

This patch makes RecordingLogger consistent with the Logger interface and allows to
also use Jetty 7.1.5 released with Helios which can be installed from the p2 repository
at http://download.eclipse.org/jetty/7.1.5.v20100705/repository

Change-Id: I5645436bbe7492f82d4069e4d9cbebede0bf764e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoDiscard the uncompressed delta as soon as its compressed 41/1141/1
Shawn O. Pearce [Fri, 16 Jul 2010 17:41:09 +0000 (10:41 -0700)]
Discard the uncompressed delta as soon as its compressed

The DeltaCache will most likely need to copy the compressed delta
into a new buffer in order to compact away the wasted space at the
end caused by over allocation.  Since we don't need the uncompressed
format anymore, null out our only reference to it so the GC can
reclaim this memory if it needs to perform a collection in order
to satisfy the cache's allocation attempt.

Change-Id: I50403cfd2e3001b093f93a503cccf7adab43cc9d
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMerge branch 'js/rename' 40/1140/1
Shawn O. Pearce [Fri, 16 Jul 2010 17:22:15 +0000 (10:22 -0700)]
Merge branch 'js/rename'

* js/rename:
  Implemented file path based tie breaking to exact rename detection
  Added more test cases for RenameDetector
  Added very small optimization to exact rename detection
  Fixed Misleading Javadoc
  Added file path similarity to scoring metric in rename detection
  Fixed potential div by zero bug
  Added file size based rename detection optimization
  Create FileHeader from DiffEntry
  log: Implement --follow
  Cache the diff configuration section
  log: Add whitespace ignore options
  Format submodule links during differences
  Redo DiffFormatter API to be easier to use
  log, diff: Add rename detection support
  Implement similarity based rename detection
  Added a preliminary version of rename detection
  Refactored code out of FileHeader to facilitate rename detection

14 years agoFix infinite loop in IndexPack 49/1049/4
Shawn O. Pearce [Sat, 3 Jul 2010 01:21:55 +0000 (18:21 -0700)]
Fix infinite loop in IndexPack

A programming error using the Inflater API led to an infinite
loop within IndexPack, caused by the Inflater returning 0 from
the inflate() method, but it didn't want more input.  This happens
when it has reached the end of the stream, or has reached a spot
asking for an external dictionary.  Such a case is a failure for us,
and we should abort out.

Thanks to Alex for pointing out that we had 3 implementations of
the inflate rountine, which should be consolidated into one and
use a switch to determine where to load data from.

Bug: 317416
Change-Id: I34120482375b687ea36ed9154002d77047e94b1f
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoImplemented file path based tie breaking to exact rename detection 30/1130/2
Jeff Schumacher [Tue, 13 Jul 2010 19:21:12 +0000 (12:21 -0700)]
Implemented file path based tie breaking to exact rename detection

During the exact rename detection phase in RenameDetector, ties were
resolved on a first-found basis. I added support for file path based
tie breaking during that phase. Basically, there are four situations
that have to be handled:

One add matching one delete:
In this simple case, we pair them as a rename.

One add matching many deletes:
Find the delete whos path matches the add the closest, and
pair them as a rename.

Many adds matching one delete:
Similar to the above case, we find the add that matches the
delete the closest, and pair them as a rename. The other adds
are marked as copies of the delete.

Many adds matching many deletes:
Build a scoring matrix similar to the one used for content-
based matching, scoring instead by file path. Some of the
utility functions in SimilarityRenameDetector are used in
this case, as we use the same encoding scheme. Once the
matrix is built, scan it for the best matches, marking them
as renames. The rest are marked as copies.

I don't particularly like the idea of using utility functions right
out of SimilarityRenameDetector, but it works for the moment. A later
commit will likely refactor this into a common utility class, as well
as bringing exact rename detection out of RenameDetector and into a
separate class, much like SimilarityRenameDetector.

Change-Id: I1fb08390aebdcbf20d049aecf402a36506e55611

14 years agoAdded dirty-detection to WorkingTreeIterator 59/1059/7
Christian Halstrick [Fri, 16 Jul 2010 08:03:49 +0000 (10:03 +0200)]
Added dirty-detection to WorkingTreeIterator

Added possibility to compare the current entry of a WorkingTreeIterator
to a given DirCacheEntry. This is done to detect whether an entry
in the index is dirty or not. 'Dirty' means that the file in the working tree
is different from what's in the index. Merge algorithms will make use of
this to detect conflicts.

Change-Id: I3ff847f4bf392553dcbd6ee236c6ca32a13eedeb
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoMerge "Remove an unused File reference in test code"
Shawn Pearce [Thu, 15 Jul 2010 23:01:25 +0000 (19:01 -0400)]
Merge "Remove an unused File reference in test code"

14 years agoRemove an unused File reference in test code 37/1137/1
Robin Rosenberg [Thu, 15 Jul 2010 22:35:47 +0000 (00:35 +0200)]
Remove an unused File reference in test code

Change-Id: Ib0d6c36811df719a53c66e9fa7460b89b2faf98b
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
14 years agoMerge "Handle the tilde notation (~user) of git url"
Shawn Pearce [Thu, 15 Jul 2010 21:29:21 +0000 (17:29 -0400)]
Merge "Handle the tilde notation (~user) of git url"

14 years agoHandle the tilde notation (~user) of git url 34/1134/1
Robin Rosenberg [Wed, 14 Jul 2010 23:16:09 +0000 (01:16 +0200)]
Handle the tilde notation (~user) of git url

When the path is prefixed with ~ the URI parser thought about this
as /~. Strip the / if the next character is the tilde.

Bug: 307017
Change-Id: I58203e5617956b46d83e8987d1f8042beddffac3
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
14 years agoGit Porcelain API: Add Command 36/1036/7
Stefan Lay [Thu, 8 Jul 2010 08:32:57 +0000 (10:32 +0200)]
Git Porcelain API: Add Command

The new Add command adds files to the Git Index.
It  uses the DirCache to access the git index. It
works also in case of an existing conflict.

Fileglobs (e.g. *.c) are not yet supported.

The new Add command does add ignored files because
there is no gitignore support in jgit yet.

Bug: 318440
Change-Id: If16fdd4443e46b27361c2a18ed8f51668af5d9ff
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
14 years agoMerge changes I104cd62f,I1d0238b4
Shawn Pearce [Wed, 14 Jul 2010 00:36:25 +0000 (20:36 -0400)]
Merge changes I104cd62f,I1d0238b4

* changes:
  Internationalize RepositoryState descriptions
  Say that commit is allowed during bisect

14 years agoFix ReadTreeTest 25/1125/3
Christian Halstrick [Tue, 13 Jul 2010 12:28:42 +0000 (12:28 +0000)]
Fix ReadTreeTest

After refactoring ReadTreeTest the tests failed for filesystems
with coarse modification time granularity. This is fixed by
explicitly telling the repo to reread the index after we build
a new index.

Additionally the test testDirectoryFileSimple was simplified
by using buildTree() instead of misusing GitIndex to construct
trees.

Change-Id: I20d2f097491e4cc8c657a696beabc7026b485017
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoAdd compatibility with gitignore specifications 83/683/20
Charley Wang [Mon, 12 Jul 2010 22:34:15 +0000 (00:34 +0200)]
Add compatibility with gitignore specifications

This patch adds ignore compatibility to jgit. It encompasses
exclude files as well as .gitignore. Uses TreeWalk and
FileTreeIterator to find nodes and parses .gitignore
files when required. The patch includes a simple cache that
can be used to save results and avoid excessive gitignore
parsing.

CQ: 4302
Bug: 303925
Change-Id: Iebd7e5bb534accca4bf00d25bbc1f561d7cad11b
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoAdded more test cases for RenameDetector 23/1123/3
Jeff Schumacher [Mon, 12 Jul 2010 19:31:18 +0000 (12:31 -0700)]
Added more test cases for RenameDetector

I added test cases to cover the majority of the code. It's not 100%
coverage yet, but the remaining bits are small.

Change-Id: Ib534c8e94b13358b8b22cf54e2ff84132bae6d14