Commit Graph

981 Commits

Author SHA1 Message Date
Jens Baumgart 51e2646d4a Introduce http test bundle
Introduce a http test bundle to make this functionality available for
EGit tests. A simple http server class is provided. The jetty version
was updated to a version that is also available via p2 (needed in EGit
UI tests).

Change-Id: I13bfc4c6c47e27d8f97d3e9752347d6d23e553d4
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-12-08 16:20:28 +01:00
Shawn O. Pearce a02be9725c Remove empty iterator from TreeWalk
Its confusing that a new TreeWalk() needs to have reset() invoked
on it before addTree().  This is a historical accident caused by
how TreeWalk was abused within ObjectWalk.

Drop the initial empty tree from the TreeWalk and thus remove a
number of pointless reset() operations from unit tests and some of
the internal JGit code.

Existing application code which is still calling reset() will simply
be incurring a few unnecessary field assignments, but they should
consider cleaning up their code in the future.

Change-Id: I434e94ffa43491019e7dff52ca420a4d2245f48b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-12-07 16:49:51 -08:00
Matthias Sohn 45731756a5 [findbugs] Do not ignore exceptional return value
java.io.File.delete() reports failure as an exceptional
return value false. Fix the code which silently ignored
this exceptional return value. Also remove some duplicate
deletion helper methods.

Change-Id: I80ed20ca1f07a2bc6e779957a4ad0c713789c5be
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-12-07 16:18:30 -08:00
Matthias Sohn e22f9552a8 Provide file utilities for file deletion
Provide file helper methods in a reusable utility class to
replace many local implementations. java.io.File has some
methods reporting failure by returning false. We prefer to
throw IOException on failure so that callers can't forget
checking the return value.

Change-Id: I430c77b5d2cffcf8b47584326ad4817a7291845e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-12-07 16:18:29 -08:00
Chris Aniszczyk 70162ce14b Merge "Clean up Init API" 2010-12-07 10:57:36 -05:00
Chris Aniszczyk db8cc4c84e Clean up Init API
Static accessors should come before a constructor.

Change-Id: Iee1051ce4f2038f19a08741e7a3a33f06a97a3c0
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-07 09:13:57 -06:00
Chris Aniszczyk 8bbd4f1bad Avoid NPE in Init
We should grab the repository directory from the command to
avoid an NPE if no git directory is passed in via the CLI.

Change-Id: I649467c6d84bbc0d26a070d0d4ff1e6f81fd5bad
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-07 09:10:07 -06:00
Chris Aniszczyk 48b73efe1e Merge "Rebase Interoperability third part: handle stop upon conflict" 2010-12-07 09:34:25 -05:00
Chris Aniszczyk a51f44edb0 Merge "Rebase Interoperability second part: fix "pop steps"" 2010-12-07 09:19:35 -05:00
Mathias Kinzler ad96546ca0 Rebase Interoperability third part: handle stop upon conflict
There are some files that need to exist so that the CLI can continue
after the rebase has been stopped due to conflicts

Change-Id: I3cb4dc98609c059bf0cf9fd5f9e47a9c681cea2d
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
2010-12-07 13:34:44 +01:00
Shawn Pearce 6462be8350 Merge "LockFile.commit: retry renaming" 2010-12-06 18:55:18 -05:00
Chris Aniszczyk 6d08252b11 Merge "Update Init to use InitCommand" 2010-12-06 17:09:14 -05:00
Chris Aniszczyk a2469bb5d2 Merge "Add InitCommand" 2010-12-06 17:08:55 -05:00
Chris Aniszczyk 34554e4f1c Merge "Add debugging toString to TreeFormatter" 2010-12-06 10:11:11 -05:00
Chris Aniszczyk 6eb6d7c77a Merge "Add insert(TreeFormatter) to ObjectInserter" 2010-12-06 10:10:58 -05:00
Chris Aniszczyk 731f84559d Merge "Add toByteArray to CommitBuilder, TreeBuilder" 2010-12-06 10:10:41 -05:00
Chris Aniszczyk 35d51d040c Merge "Remove unused getTreeId from TreeFormatter" 2010-12-06 10:10:26 -05:00
Chris Aniszczyk 643de8323a Merge "Remove result id from CommitBuilder, TagBuilder" 2010-12-06 10:09:59 -05:00
Jens Baumgart cbf5ff6ac7 LockFile.commit: retry renaming
Currently the following can happen in LockFile.commit: deletion of the
original file succeeds but renaming fails afterwards. In this case the
original file (e.g. branch file in refs/heads) is lost.
To workaround the issue the same retry logic as for file deletion is
applied to file renaming.

Bug: 331890
Change-Id: I68620c07f2d3ab7f3279c71a91e184e8eac69832
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
Signed-off-by: Philipp Thun <philipp.thun@sap.com>
2010-12-06 13:40:07 +01:00
Chris Aniszczyk 90fbc1db3a Merge "Honor GIT_SSH when opening SSH connections" 2010-12-05 20:14:46 -05:00
Chris Aniszczyk 8f6c8818dc Update Init to use InitCommand
Change-Id: I3ff700a87dfa6ac255c1aaf3fe11a07264594aab
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-05 19:03:34 -06:00
Chris Aniszczyk f7a566c1aa Add InitCommand
Adds git-init support to the Git API.

Change-Id: I1428b861f22cabe4d92cadf3d9114dddeec75b40
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-05 19:01:43 -06:00
Shawn O. Pearce ed7e38b98d Merge "Ensure stable tag sort in PlotWalk" 2010-12-05 18:10:12 -05:00
Chris Aniszczyk ef11143ffe Merge "Abstract SSH setup to support GIT_SSH" 2010-12-05 10:50:05 -05:00
Shawn O. Pearce 064ecc25ce Fix findGitDir() with no ceiling directories
Bug: 322866
Change-Id: I64205bb0315a725dfa523ccff1796de50f465162
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Ketan Padegaonkar <KetanPadegaonkar@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-12-05 15:42:57 +01:00
Matthias Sohn c474813b0a Merge "Correct CommitBuilder, TagBuilder method to be build()" 2010-12-05 08:19:58 -05:00
Robin Rosenberg 40c2f68382 Merge "Fix checking out large files" 2010-12-04 03:49:11 -05:00
Shawn O. Pearce 864091d982 Ensure stable tag sort in PlotWalk
Because tags are more interesting here than local or remote branch
heads, tags get sorted earlier in the array than heads or remotes do.

Bug: 324939
Change-Id: Ifc3863461654df7f34fdecbd2abe1f4b5d2ffb8e
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Mathias Kinzler <mathias.kinzler@sap.com>
CC: Stefan Lay <stefan.lay@sap.com>
2010-12-03 16:38:24 -08:00
Shawn O. Pearce 61db0e4787 Fix checking out large files
DirCacheCheckout needs to use ObjectLoader.copyTo to avoid loading the
complete content of a large file into the JVM heap.

Bug: 321097
Change-Id: I967590b6f233fd1c83d873075db01d653208b3b9
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Chris Aniszczyk <caniszczyk@gmail.com>
CC: Christian Halstrick <christian.halstrick@sap.com>
2010-12-03 16:37:56 -08:00
Shawn O. Pearce 22e720ce77 Honor GIT_SSH when opening SSH connections
If the environment variable GIT_SSH is set, use GIT_SSH for any remote
protocol connections, instead of the local JSch library.

Bug: 321062
Change-Id: Ia18ea49d58f3ed657430067f1f72ef788a2dae4c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-12-03 16:33:46 -08:00
Shawn O. Pearce 04b289cc42 Abstract SSH setup to support GIT_SSH
In order to honor GIT_SSH the TransportGitSsh class needs to run the
process named by the GIT_SSH environment variable and use that as the
pipes for connectivity to the remote peer.  Refactor the current
transport code to support a different type of pipe connectivity, so we
can later add GIT_SSH.

Bug: 321062
Change-Id: I9d8ee1a95f1bac5013b33a4a42dcf1f98f92172f
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-12-03 16:14:46 -08:00
Matthias Sohn 6ca9fd2d95 Add missing license header
Change-Id: Ibfd17951606f02283660befcff53ff9b73405dd9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-12-03 22:37:46 +01:00
Shawn O. Pearce 8fd2335b70 Add debugging toString to TreeFormatter
Displaying the current tree in the ls-tree style output makes it
easier to see what entries are currently stored.

Change-Id: If17c414db0d2e8d84e65de8bbcba7fd1b79aa311
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Reviewed-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-03 13:11:39 -08:00
Shawn O. Pearce 8d4c95a645 Add insert(TreeFormatter) to ObjectInserter
This makes usage of a TreeFormatter more similar to a CommitBuilder or
a TagBuilder: populate the formatter and pass to the ObjectInserter.

Change-Id: I5a45ef3a35cc73f4905a34bc6f6228510df8eb2c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Reviewed-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-03 13:03:12 -08:00
Shawn O. Pearce 9ad802c15b Add toByteArray to CommitBuilder, TreeBuilder
This better matches the existing API of TreeFormatter, but is just a
simple delegation to build().

Change-Id: I188f43acc34455e773d63836724b05e18f5c7a84
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Reviewed-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-03 12:57:41 -08:00
Shawn O. Pearce 807ee4797f Remove unused getTreeId from TreeFormatter
Change-Id: If5955757575d4c6053b6f8109e9dc2ecb0502446
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Reviewed-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-03 12:47:37 -08:00
Shawn O. Pearce cf52ef5531 Remove result id from CommitBuilder, TagBuilder
These objects don't need to be updated with the resulting ObjectId of
the formatted content, callers can get that from the ObjectInserter on
their own.

Change-Id: Idc5f097de9f7beafc5e54e597383d82daf9d7db4
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Reviewed-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-03 12:38:31 -08:00
Shawn O. Pearce f996fb1796 Correct CommitBuilder, TagBuilder method to be build()
The correct names for these is build(), as that is what a Java
developer will expect given the "builder" pattern.

Bug: 323541
Change-Id: I35042bdc95a955beeaee29e54bde10e4240b2a71
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Reviewed-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-03 12:28:00 -08:00
Matthias Sohn 37001ddc8d Fix jgit build broken by deabacc4
Since 049827d7 MergeAlgorithm isn't static anymore.

Change-Id: I3d704f663a776bb57e59f28a8200753fae5e9d25
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-12-03 09:24:31 +01:00
Chris Aniszczyk 39fe52ccc7 Merge "Rebase Interoperability first part: write "interactive" file" 2010-12-02 21:19:10 -05:00
Chris Aniszczyk b5f9a9b4d3 Merge "Fixed Merge Algorithm regarding concurrent file creations" 2010-12-02 20:19:04 -05:00
Christian Halstrick deabacc420 Fixed Merge Algorithm regarding concurrent file creations
When in OURS and THEIRS a new file is created we want a conflict
when the two contents differ. If on two branches the same file
with the same content is created this should not be a conflict.
But: the current merge algorithm is throwing NPEs in this case.
Fix this by choosing an empty RawText as common base if the
base is empty.

Change-Id: I21cb23f852965b82fb82ccd66ec961c7edb3ac3d
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2010-12-02 13:15:59 +01:00
Shawn O. Pearce e0a9961b78 Avoid unnecessary decoding of length in PackFile
If the object type is a whole object and all we want is the type,
there is no need to skip the length header.  The type is already known
and can be returned as-is.  Instead skip the length header only for
the two delta formats, where the delta base must itself be scanned.

Change-Id: I87029258e88924b3e5850bdd6c9006a366191d10
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-12-01 09:59:55 -08:00
Shawn O. Pearce d29b5db695 Remove unused 'shift' variable from PackFile
This variable was not used for anything, but Eclipse's JDT failed to
notice because of the "shift += " operation within the body of the
while loop.  Here we don't need the shift because we do not decode the
length, but we do have to skip over the bytes that store the length to
locate the delta base.

Bug: 331319
Change-Id: I200a874fd7e39e3adf2640b8cd0f53dcf91ef4c9
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Remy Suen <remysuen@ca.ibm.com>
2010-12-01 09:57:16 -08:00
Mathias Kinzler 59e62ba7e1 Rebase Interoperability second part: fix "pop steps"
If the CLI stops a rebase upon conflict, the current
step is already popped from the git-rebase-todo and appended to the
"done" file. The current implementation wrongly pops the step only
after successful cherry-pick.

Change-Id: I8640dda0cbb2a5271ecf75fcbad69410122eeab6
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
2010-12-01 15:10:13 +01:00
Mathias Kinzler 7aa1b85821 Rebase Interoperability first part: write "interactive" file
The Repository is then in state "Rebase interactive".

Change-Id: I5d2de57f8670e1d4c71ed22509ab17f04e2561b5
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
2010-12-01 15:08:07 +01:00
Stefan Lay b4359cb829 Include list of assume unchanged files in IndexDiff
The IndexDiff had not collected the info if the flag
"assume-unchanged" is set. This information is useful for clients
which may want to decide if specific actions are allowed on a file.

Bug: 326213
Change-Id: I14bb7b03247d6c0b429a9d8d3f6b10f21d8ddeb1
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2010-11-30 10:51:21 -08:00
Stefan Lay 7bf0f5070e Use the Set interface in declarations and as return value
Change-Id: Ib273c4980036f75bd4dad3ffe1c29a37b2df932a
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2010-11-30 11:05:42 +01:00
Shawn Pearce a115b64f4b Merge "Check assume unchanged flag in Add command" 2010-11-29 18:21:08 -05:00
Shawn Pearce f968cbabcf Merge "Fix DiffConfig to understand "copy" resp. "copies" for diff.renames property." 2010-11-29 17:59:15 -05:00