Commit Graph

571 Commits

Author SHA1 Message Date
Christian Halstrick b42293c81d Merge "Close the repo in CloneCommandTest" 2011-10-27 08:57:06 -04:00
Matthias Sohn 34f678643c Merge changes I488e9c97,I30f1049f,I1c088dce
* changes:
  Cosmetic adjustment of relative date format, do not display "0 months"
  Make use of the many date formatting options in the log command
  Define a utility class for handling Git date formats
2011-10-26 17:29:23 -04:00
Robin Rosenberg 57bdb04873 Cosmetic adjustment of relative date format, do not display "0 months"
Though it may seem less precise, "0 months" looks bad and the reference
Git implementation also does not display "0 months"

Change-Id: I488e9c97656f9941788ae88d7c5c1562ab6c26f0
2011-10-26 23:15:28 +02:00
Robin Rosenberg 96b801f02b Close the repo in CloneCommandTest
The test failed on Windows only

Change-Id: Ibff5308b33deb73570626a08a04e86ad8f418023
2011-10-26 22:59:39 +02:00
Matthias Sohn 66cb4ac902 Merge "Allow detecting which files were renamed during a revwalk" 2011-10-26 16:18:21 -04:00
Carsten Pfeiffer 98d4bd6d36 Allow detecting which files were renamed during a revwalk
The egit history view shows the files associated with a commit by using
a PathFilter. When following renames with a FollowFilter, the PathFilter
cannot be configured anymore because the affected files are simply not
known.

Thus, it should be possible to get to know which files are renamed.

Bug: 302549
Change-Id: I4761e9f5cfb4f0ef0b0e1e38991401a1d5003bea
2011-10-25 09:22:11 +02:00
Robin Rosenberg f4460dda97 Define a utility class for handling Git date formats
Besides the formats known by git-log(1) we also add "locale" 
and "localelocal" that formats dates according to the user's locale.
"locale" does not translate into local timezone, while
localelocal does.

Change-Id: I1c088dcec992c107e43f6c17be4ac9ed6eb428bf
2011-10-23 01:51:30 +02:00
Robin Rosenberg fb68c7a4cd Use the SystemReader to get system time
Change-Id: Ib79c0cc964bfe799b204419e552b9aa6243966ce
2011-10-20 23:49:51 +02:00
Robin Rosenberg 2e43dcd645 Fix bad checkout behaviour when a file is removed
We deleted the entry if there was a file and an index
entry, but not when there was just an index entry. Now
delete the file in both cases since the missing file
just means our worktree is dirty. This affected the
implementation of reset --hard.

Bug: 347574
Change-Id: Ie66fa61303472422830f5e33614e93ad65094e5d
2011-10-18 22:32:47 +02:00
Shawn O. Pearce cc03e27093 Merge changes I7cdb563b,I7f60ae68,I7bd1e769,I92683805,I0e51a8e6
* changes:
  UploadPack: Fix races in smart HTTP negotiation
  PackWriter: Export more statistics
  Do not requeue state vector in stateless RPC fetch
  Wrap excessively long line in BasePackFetchConnection
  Fix smart HTTP client stream alignment errors
2011-10-07 16:00:21 -04:00
Christian Halstrick f99ce8d6ff Merge "Fix DirCacheEdtor.DeleteTree for empty string argument" 2011-10-05 06:21:01 -04:00
Robin Rosenberg 602c869d7a Do not attempt to resolve describe-labels with less than four digits
Change-Id: I21dcd3cca3b41102fd898238d8d640dea25e0caf
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-10-03 00:39:50 +02:00
Robin Rosenberg 1570aa9e5c Fix DirCacheEdtor.DeleteTree for empty string argument
Change-Id: I7425da91c0752ae82484e3c29d21b57402d30c61
2011-10-01 16:35:00 +02:00
Kevin Sawicki 37e4019fd9 Add blame unit test for file that is renamed twice.
Bug: 354507
Change-Id: I853774ecc1662d095a50a9668431c6e3ce4156c4
Signed-off-by: Kevin Sawicki <kevin@github.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-09-30 14:22:46 -07:00
Robin Rosenberg a4b5051880 Merge "Use bundle dependency for org.hamcrest.org" 2011-09-30 12:29:54 -04:00
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
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
Matthias Sohn 01cf611e12 Use bundle dependency for org.hamcrest.org
This is required to make org.eclipse.jgit.test compile when SWTBot isn't
installed which should only be necessary for EGit developers.

Change-Id: I7fc22ca9fc3048cdcf211c56612a3d1b8bed8f6e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-09-27 15:34:52 +02:00
Christian Halstrick d306c35cea Merge "Fix DirCache,getEntriesWithin for empty string arguemnt" 2011-09-26 04:27:54 -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 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
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 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
Shawn O. Pearce c1a9b2ae8b Fix smart HTTP client stream alignment errors
The client's use of UnionInputStream was broken when combined with a
8192 byte buffer used by PackParser. A smart HTTP client connection
always pushes in the execute stateless RPC input stream after the
data stream has ended from the remote peer. At the end of the pack,
PackParser asked to fill a 8192 byte buffer, but if only e.g. 1000
bytes remained UnionInputStream went to the next stream and asked
it for input, which triggered a new RPC, and failed because there
was nothing pending in the request buffer.

Change UnionInputStream to only return what it consumed from a
single InputStream without invoking the next InputStream, just in
case that second InputStream happens to be one of these magical
ones that generates an RPC invocation.

Change-Id: I0e51a8e6fea1647e4d2e08ac9cfc69c2945ce4cb
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-09-14 15:34:55 -07: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
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 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 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
Tomasz Zarna 90c96eb903 Fix boxing warnings in PushProcessTest
Change-Id: I5114968536853fb530b8a96c10def675e39c884f
2011-08-24 15:40:48 +02: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
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
Christian Halstrick 12bb76380f Merge "PackWriter: Make want/have actual sets" 2011-08-18 03:43:38 -04:00
Kevin Sawicki a7aaf88b2e Use HEAD as default ref for RefLogCommand.
This mirrors the default command-line behavior.

Change-Id: I4f819410fa6df3064c560beb3184b61fd7bb1f15
Signed-off-by: Kevin Sawicki <kevin@github.com>
2011-08-17 08:56:16 -07:00
Dariusz Luksza 679cab9b32 Adds DiffEntry.scan(TreeWalk, boolean) method
Adds method into DiffEntry class that allows to specify whether changed
trees are included in scanning result list. By default changed trees
aren't added, but in some cases having changed tree would be useful.

Also adds check for tree count in TreeWalk and when it is different from
two it will thrown an IllegalArgumentException.

This change is required by egit
I7ddb21e7ff54333dd6d7ace3209bbcf83da2b219

Change-Id: I5a680a73e1cffa18ade3402cc86008f46c1da1f1
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-08-17 12:43:35 +02:00
Shawn O. Pearce 74333e63b6 PackWriter: Make want/have actual sets
During parsing these are used with contains(). If they are a List
type, the contains operation is not efficient. Some callers such
as UploadPack often pass a List here, so convert to Set when the
type isn't efficient for contains().

Change-Id: If948ae3bf1f46e756bd2d5db14795e12ba7a6207
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-08-16 12:18:39 -07:00
Christian Halstrick 100e9429b5 Merge "Add DiffCommand to JGit API" 2011-08-16 08:25:46 -04:00
Tomasz Zarna 714a3ee151 Add DiffCommand to JGit API
Bug: 334766
Change-Id: Iea74c599a956a058608e424d0274f879bc2f064a
2011-08-16 11:47:55 +02:00
Robin Rosenberg 5a3a2b53ee Merge "Fix reading of ref names containing characters that sort before /" 2011-08-10 14:40:25 -04:00
Robin Rosenberg c536873c87 Fix reading of ref names containing characters that sort before /
A set of ref names like ('a/b' and 'a+b') would cause the RefDirectory
to think that the set of refs have changed because it traversed the
'a' directory in the subtree before looking at 'a+b', but it then
compared with the know refs which are sorted with 'a+b' first.

Fix this by traversing the refs tree in another order. Treat a directory
as if they ends with a '/' before deciding on the order to traverse
the refs tree.

Bug: 348834
Change-Id: I23377f8df00c7252bf27dbcfba5da193c5403917
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-07-22 11:51:41 +02:00
Tomasz Zarna e15037b3c7 Merge doesn't remove empty folders
Bug: 349848
Change-Id: I2aa5a1a7259889428e4845046b900538262f3c84
2011-07-13 15:42:33 +02:00
Dariusz Luksza 1d1f572771 Add support for reseting on directories
Reset command should works recursively and allows reset all changed
files in given directory.

Bug: 348524
Change-Id: I441db34f226be36548c61cef77958995971498de
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-07-12 11:14:28 -05:00
Sasa Zivkov 1d4a1fe772 Fixed creation of branch from a tag
Creation of a branch X from an annotated tag, as the starting point,
resulted into .git/refs/heads/X containing the ID of the annotated tag
instead of the ID of the tagged commit.

This fix peels the tag ref before using it as the starting point for
the newly created branch.

Bug: 340836
Change-Id: I01c7325770ecb37f5bf8ddb2a22f802466524f24
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-07-12 10:48:59 -05:00
Adrian Goerler ad74bbf9c1 Cleanup directories leftover by test.
Use the temporary file management from superclass.

Change-Id: I3042951dc21860b4b85dd72a6bf41ee7cfe2aba4
Signed-off-by: Adrian Goerler <adrian.goerler@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-07-07 23:16:40 +02:00
Adrian Goerler 172a9f0521 Cloning should fail when destination directory exists and is not empty
When trying to clone into a folder that already contains a cloned
repository native git will fail with a message "fatal: destination path
'folder' already exists and is not an empty directory.". Now JGit will
also fail in this situation throwing a JGitInternalException.

The test case was provided by Tomasz Zarna.

Bug: 347852
Change-Id: If9e9919a5f92d13cf038dc470c21ee5967322dac
Also-by: Tomasz Zarna <Tomasz.Zarna@pl.ibm.com>
Signed-off-by: Adrian Goerler <adrian.goerler@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-07-06 23:10:53 +02:00