Commit Graph

1637 Commits

Author SHA1 Message Date
Matthias Sohn 0db0476542 Fire IndexChangedEvent on DirCache.commit()
Since we replaced GitIndex by DirCache JGit didn't fire
IndexChangedEvents anymore. For EGit this still worked with a high
latency since its RepositoryChangeScanner which is scheduled to
run each 10 seconds fires the event in case the index changes.
This scanner is meant to detect index changes induced by a different
process e.g. by calling "git add" from native git.

When the index is changed from within the same process we should fire
the event synchronously. Compare the index checksum on write to index
checksum when index was read earlier to determine if index really
changed. Use IndexChangedListener interface to keep DirCache decoupled
from Repository.

Change-Id: Id4311f7a7859ffe8738863b3d86c83c8b5f513af
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-30 00:00:22 +02:00
Kevin Sawicki e630f91305 Remove TODO for generated constructor.
Change-Id: Ie405f6de99b8fa632d7462400e647a37f30e2e31
Signed-off-by: Kevin Sawicki <kevin@github.com>
2011-09-28 14:10:24 -07:00
Christian Halstrick 1230d353d8 Fix status in index entries after checkout of paths
The checkout command was producing an inconsistent state of the index
which even confuses native git. The content sha1 of the touched index
entries was updated, but the length and the filemode was not updated.
Later in coding the index entries got automatically corrected (through
Dircache.checkoutEntry()) but the correction was after persisting the
index to disk. So, the correction was lost and we ended up with an index
where length and sha1 don't fit together.
A similar problem is fixed with "lastModified" of DircacheEntry. When
checking out a path without specifying an explicit commit (you want to
checkout what's in the index) the index was not updated regarding
lastModified. Readers of the index will think the checked-out
file is dirty because the file has a younger lastmodified then what's
in the index.

Change-Id: Ifc6d806fbf96f53c94d9ded0befcc932d943aa04
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
Bug: 355205
2011-09-28 12:34:32 +02:00
Christian Halstrick d306c35cea Merge "Fix DirCache,getEntriesWithin for empty string arguemnt" 2011-09-26 04:27:54 -04:00
Robin Rosenberg 23bba6fb48 Merge "Remove duplicate calls to DirCache.unlock on checkout" 2011-09-25 04:44:45 -04:00
Robin Rosenberg b4112c1748 Fix DirCache,getEntriesWithin for empty string arguemnt
Change-Id: I0bea130df611de3ef8c9251093b11c62b5442cd1
2011-09-25 00:17:19 +02:00
Robin Rosenberg 51d95bbaea Merge "Document the show methods of RevWalkTextBuiltin" 2011-09-22 12:27:48 -04:00
Robin Rosenberg 8a45aa460c Merge "Fix a boxing warning in org.eclipse.jgit.pgm.RevWalkTextBuiltin" 2011-09-22 12:27:27 -04:00
Robin Rosenberg a3d7056b45 Merge "Remove use of GitIndex to detect index changes" 2011-09-22 12:24:37 -04:00
Robin Rosenberg ad50a0b7c0 Test the reflog message for commit, cherry-pick, revert and merge
Change-Id: I319f09577b3e04f6c31399fe8e57e9a9ad2c8a6c
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-21 23:36:55 +02:00
Robin Rosenberg 39ad503fcb Append merge strategy to reflog message
Change-Id: Ia0e73208b86c45a3d96698e973f6e70ec5cb7303
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-21 23:36:46 +02:00
Robin Rosenberg 4f4e468f6f Fix the reflog prefix for cherry-pick, revert and merge commands
We should see whether the commit was a regular commit or something
else.

Change-Id: I82d8300cf3c53cb2bdcb6495386aadb803e0c6f7
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-21 23:36:26 +02:00
Robin Rosenberg eb8431da75 Document the show methods of RevWalkTextBuiltin
Change-Id: Ic704008cb215e1437c0a3fd1aec3aa38209ef3c7
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-09-18 13:08:14 +02:00
Robin Rosenberg edaca7ed12 Fix a boxing warning in org.eclipse.jgit.pgm.RevWalkTextBuiltin
Change-Id: Ia154da79926ce25731e856bed264dd19a76bc1f1
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-09-18 13:08:03 +02:00
Matthias Sohn 46771e9e88 Remove use of GitIndex to detect index changes
We can detect index changes using FileSnapshot. This is more efficient
and removes usage of a deprecated class.

Change-Id: I4a679102c9a1bd8e82b9ca93eb9dbbde445e9be4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-16 00:19:39 +02:00
Matthias Sohn 19a366d532 Prepare 1.2.0 builds
Change-Id: I9ec247135d93ef28d732e94f18d0ec1d0e2e6d44
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-15 22:51:46 +02:00
Matthias Sohn 05c7896919 Merge branch 'stable-1.1'
* stable-1.1:
  Prepare post v1.1.0.201109151100-r build
  JGit v1.1.0.201109151100-r

Change-Id: I31a2e8d26d635ded9ea956a26ad9b2d9e20862a1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-15 22:51:28 +02:00
Matthias Sohn 57d6585522 Prepare post v1.1.0.201109151100-r build
Change-Id: Ib099ec93d8243b238641d79328216874532ab5eb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-15 21:51:23 +02:00
Matthias Sohn 1cb0510cee JGit v1.1.0.201109151100-r
Change-Id: Iadcec7e5973600e005cbdeb837fa197d3ae2ea86
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-15 17:32:58 +02:00
Kevin Sawicki 4005f3c693 Remove duplicate calls to DirCache.unlock on checkout
Calls to unlock the DirCache before throwing an exception
were not needed since checkout calls doCheckout wrapped
in a try block that calls DirCache.unlock in a finally
block.

Change-Id: I2b249a784f9e363430e288aad67fcefb7fac0a6e
Signed-off-by: Kevin Sawicki <kevin@github.com>
2011-09-13 15:29:55 -07:00
Matthias Sohn cc4e6109e4 Merge branch 'stable-1.1'
* stable-1.1:
  Allow commit when submodule changes are present
  Ignore submodule on checkout instead of deleting it
  cleanup: Reuse local variable for current DirCacheEntry
  Prepare post v1.1.0.201109071825-rc3 builds
  JGit v1.1.0.201109071825-rc3
  Use commit message best practices for Mylyn Commit template

Change-Id: I6ab9e5cb48c036d2ee2e548f5ec040d93672d8ad
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-11 22:43:41 +02:00
Robin Rosenberg a7d3c68015 Allow commit when submodule changes are present
We do not yet check or validate submodules, but can accept that
someone staged a change in a submodule with other tools.

Change-Id: I642ede382314bfbd1892dd509a2222885cc5350a
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-09-08 16:46:20 +02:00
Robin Rosenberg 576abf64d1 Ignore submodule on checkout instead of deleting it
The purpose of this commit is to prevent destruction of
submodules on checkout from a tree with a submodule to
another. For consistency we handle the reverse case too,
when we checkout a branch that has a submodule and the
submodule directory exists. And finally we ignore the
case where the submodule changes.

We do not update the submodules, we just try to ignore
them harder.

Bug: 356664
Change-Id: I202c695a57af99b13d0d7220803fd08def3d9b5e
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-09-08 16:46:20 +02:00
Robin Rosenberg 2bb8da0405 cleanup: Reuse local variable for current DirCacheEntry
Since we already have assigned i.getDirCacheEntry() to dce,
use dce instead.

Change-Id: I107713ad0b356516d75c29203f945b056bad3ac7
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-09-08 16:46:19 +02:00
Matthias Sohn b09d21b6eb Prepare post v1.1.0.201109071825-rc3 builds
Change-Id: I1244f6639263d156a6f9e4530167e5eb1826a535
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-08 01:50:41 +02:00
Matthias Sohn 75611a8314 JGit v1.1.0.201109071825-rc3
Change-Id: I1b989d3101272632eacabe25a0b111ad0ff5bb3b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-08 00:54:27 +02:00
Dariusz Luksza 570d862ef3 Fix IOOBE in Repository.resolveSimple()
IndexOutOfBoundException is thrown from Repository.resolveSimple() when
'-g' string is located less then 4 characters from the end of this
string.

Change-Id: I1128c2cdfec9db3023d4d0f1f40d863e84b75950
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
2011-09-06 10:12:39 +02:00
Matthias Sohn cfdb09e9db Use commit message best practices for Mylyn Commit template
We should use a template for Mylyn commit messages that matches with our
guidelines for commit messages.

http://wiki.eclipse.org/EGit/Contributor_Guide#Commit_message_guidelines

Bug: 337401
Change-Id: I05812abf0eb0651d22c439142640f173fc2f2ba0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-05 23:57:21 +02:00
Robin Rosenberg b695f66487 Fix the names in the reflog for checkouts
We were diverging from the reference implementation. Always use the
ref we checkout to as the to-branch the reflog and avoid the
refs/heads both in the from-name and to-name.

Change-Id: Id973d9102593872e4df41d0788f0eb7c7fd130c4
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-05 17:02:16 +02:00
Robin Rosenberg eadc26c0a0 Add a helper for parsing branch switch info out of a reflog entry
Change-Id: I91c7e08c4afd2562df2226887a933d93c78a0371
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-05 17:01:56 +02:00
Matthias Sohn 8001b19a8c Remove workarounds for fixed Tycho bugs
This removes the workaround for Tycho bug
- http://issues.sonatype.org/browse/TYCHO-313
which has been fixed.

Change-Id: I54a8de885ae3e6c45a778171dad6f6e5e9322114
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-05 09:24:05 +02:00
Matthias Sohn 44274434ad Define os/ws/arch environments for tycho build
Explicitly define os/ws/arch environments for
target-platform-configuration to make build platform
independent.

Change-Id: If43f5ee573c9abaa0359ea2386477b379012e834
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-05 09:24:05 +02:00
Kevin Sawicki d110fbc300 [blame] Reset rename detector before computing renames.
Bug: 354507
Change-Id: I5e9c65a082d9dee1e87536c5cf2a8de75efa6a33
Signed-off-by: Kevin Sawicki <kevin@github.com>
2011-09-01 13:29:43 -07:00
Matthias Sohn df117d3da9 Prepare post-v1.1.0.201109011030-rc2 builds
Change-Id: I8dda83cdbe88beba4a480df9846848bf3aceb9e2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-01 17:36:10 +02:00
Matthias Sohn 384ffa7ee9 JGit v1.1.0.201109011030-rc2
Change-Id: Ie6d65fe45ad92c813ce3a227729aa43681922249
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-01 16:38:13 +02:00
Robin Rosenberg dcd4c5a642 Use the appropriate constant for ".git"
We have two constants with the same content. DOT_GIT is intended
for the git repository below the work tree, while DOT_GIT_EXT is
the ".git" directory extension usually associated with bare
repositories.

Change-Id: I0946b4beb2d1c3af289ddbbb5641d2f4e4c49d3f
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-08-27 17:03:10 +02:00
Roberto Tyley 602b2f0d45 Tolerate zlib deflation with window size < 32Kb
JGit currently identifies loose objects as 'corrupt' if they've been
deflated using a window size less than 32Kb, because the
isStandardFormat() function doesn't recognise the header
byte as a zlib header. This patch makes the method tolerant of
all valid window sizes (15-bit to 8-bit) - but doesn't sacrifice
it's accuracy in distingushing the standard loose-object format
from the experimental (now abandoned) format. It's based on a patch
which has been merged into C-Git master branch:

https://github.com/git/git/commit/7f684a2aff636f44a506

On memory constrained systems zlib may use a much smaller window
size - working on Agit, I found that Android uses a 4KB window;
giving a header byte of 0x48, not 0x78. Consequently all loose
objects generated by the Android platform appear 'corrupt' :(

It might appear that this patch changes isStandardFormat() to the
point where it could incorrectly identify the experimental format as
the standard one, but the two criteria (bitmask & checksum) can only
give a false result for an experimental object where both of the
following are true:

1) object size is exactly 8 bytes when uncompressed (bitmask)
2) [single-byte in-pack git type&size header] * 256
   + [1st byte of the following zlib header] % 31 = 0 (checksum)

As it happens, for all possible combinations of valid object type
(1-4) and window bits (0-7), the only time when the checksum will be
divisible by 31 is for 0x1838 - ie object type *1*, a Commit - which,
due the fields all Commit objects must contain, could never be as
small as 8 bytes in size.

Given this, the combination of the two criteria (bitmask & checksum)
always correctly determines the buffer format, and is more tolerant
than the previous version.

References:

Android uses a 4KB window for deflation:
http://android.git.kernel.org/?p=platform/libcore.git;a=blob;f=luni/src/main/native/java_util_zip_Deflater.cpp;h=c0b2feff196e63a7b85d97cf9ae5bb2583409c28;hb=refs/heads/gingerbread#l53

Code snippet searching for false positives with the zlib checksum:
https://gist.github.com/1118177

Change-Id: Ifd84cd2bd6b46f087c9984fb4cbd8309f483dec0
2011-08-25 22:25:10 +01:00
Stefan Lay 28a4992524 Merge "Unwind loop that iterates over fetch connection refs." 2011-08-25 11:09:52 -04:00
Kevin Sawicki e54404d555 Reassign symbolic ref list after calling put.
This is required since RefList.put returns a new RefList.

Change-Id: I717d75d6f6154a6e0dc7cde3b72b0a59c68d955c
Signed-off-by: Kevin Sawicki <kevin@github.com>
2011-08-24 13:22:05 -07:00
Christian Halstrick eb5e9532df Merge "Fix boxing warnings in PushProcessTest" 2011-08-24 10:15:36 -04:00
Tomasz Zarna 90c96eb903 Fix boxing warnings in PushProcessTest
Change-Id: I5114968536853fb530b8a96c10def675e39c884f
2011-08-24 15:40:48 +02:00
Tomasz Zarna c35c23db8d Use JGitText.refAlreadyExists instead of "ref exists"
Change-Id: I113bcf82c6292db5269271f799d09c80acc40bcd
2011-08-24 10:17:32 +02:00
Kevin Sawicki b127fa19eb Unwind loop that iterates over fetch connection refs.
Create separate loops based on whether the ref specs
collection is empty or not.

Change-Id: I2861b45fe083675e12ff47f591e104f8cf6dd216
Signed-off-by: Kevin Sawicki <kevin@github.com>
2011-08-22 13:10:31 -07:00
Christian Halstrick 930875a81a Throw JGit exception when ResetCommand got wrong ref
If the ResetCommand should reset to a invalid ref (e.g. HEAD in a repo
whithout a single commit) it was throwing an NPE. This is fixed now by
throwing a JGitInternalExcpeption. It would be nicer if we could throw
a InvalidRefException, but this would modify our API.

Bug: 339610
Change-Id: Iffcb4f2cca9f702176471d93c3a71e5cb3e700b1
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-08-21 14:11:00 -07:00
Matt Fischer 9952223e06 Implement server support for shallow clones
This implements the server side of shallow clones only (i.e.
git-upload-pack), not the client side.

CQ: 5517
Bug: 301627
Change-Id: Ied5f501f9c8d1fe90ab2ba44fac5fa67ed0035a4
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-08-21 14:04:23 -07:00
Shawn O. Pearce a1a8c6d77e PackWriter: support excluding objects already in other packs
This can be useful when implementing garbage collection and there
are packs that should not be copied, such as huge packs that have
a sibling ".keep" file alongside of them.

Callers driving PackWriter need to initialize the list of packs not
to include objects from by passing each index to excludeObjects().

Change-Id: Id7f34df69df97be406bcae184308e92b0e8690fd
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-08-21 13:59:26 -07:00
Denys Digtiar c580c56c4d Fix ClassCastException in MergeCommand
Test was added which reproduce the ClassCastException when ours or
theirs merge strategy is set to MergeCommand. Merger and MergeCommand
were updated in order to avoid exception.

Change-Id: I4c1284b4e80d82638d0677a05e5d38182526d196
Signed-off-by: Denys Digtiar <duemir@gmail.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-08-21 13:53:02 -07:00
Ketan Padegaonkar e38cf2078d Add ListTagCommand to JGit API
Bug: 355246
Change-Id: I11e019f3c19b4340ac7160ac8fcbadd52499d322
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-08-21 13:43:50 -07:00
Chris Aniszczyk bd691f162c Merge "Add DeleteTagCommand to JGit API" 2011-08-21 16:24:23 -04:00
Tomasz Zarna 5f787bfd62 Add DeleteTagCommand to JGit API
Bug: 353226
Change-Id: I54ae237cab792742333a249eb5a774d5e1775af8
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-08-21 13:18:52 -07:00