Commit Graph

1158 Commits

Author SHA1 Message Date
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
Stefan Lay 9225b88ae6 Check assume unchanged flag in Add command
When the assume unchanged flag is set the Add command must not update
the index for this file if any changes are present in the working
directory.

Bug: 331351
Change-Id: I255870f689225a1d88971182e0eb377952641b42
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2010-11-29 17:58:38 +01:00
Marc Strapetz e147fbcd66 Fix DiffConfig to understand "copy" resp. "copies" for diff.renames property.
Rename detection should be considered enabled if
diff.renames config property is set to "copy" or "copies", instead of
throwing IllegalArgumentException.

Change-Id: If55d955e37235d4d00f5b0febd6aa10c0e27814e
2010-11-29 17:14:07 +01:00
Mathias Kinzler 12b6350435 RebaseCommand: trim line endings when reading files
In order to enable interoperability with the command line, we need to
remove line feeds when reading the files.

Change-Id: Ie2f5799037a60243bb4fac52346908ff85c0ce5d
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
2010-11-26 12:22:40 +01:00
Chris Aniszczyk 3da6dbaf81 Merge "Change default diff algorithm to histogram and add tests" 2010-11-26 06:04:50 -05:00
Chris Aniszczyk c9bc3ebb4c Merge "Do some more tests for rebase --abort" 2010-11-26 05:45:49 -05:00
Christian Halstrick 12a5c8d413 Change default diff algorithm to histogram and add tests
The referenced bug showed that JGit produced different merge results
compared to C Git. Unit test was added to reproduce the issue. The
problem can be solved by switching to histogram diff algorithm.

Bug: 331078
Change-Id: I54f30afb3a9fef1dbca365ca5f98f4cc846092e3
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Philipp Thun <philipp.thun@sap.com>
2010-11-26 00:44:05 +01:00
Christian Halstrick 049827d708 Make diff algorithm configurable
The diff algorithm which is used by Merge, Cherry-Pick, Rebase
should be configurable. A new configuration parameter "diff.algorithm"
is introduced which currently accepts the values "myers" or
"histogram". Based on this parameter for example the ResolveMerger
will choose a diff algorithm. The reason for this is bug 331078.
This bug shows that JGit is more compatible with C Git when
histogram diff is in place. But since histogram diff is quite new we
need an easy way to fall back to Myers diff.

Bug: 331078
Change-Id: I2549c992e478d991c61c9508ad826d1a9e539ae3
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Philipp Thun <philipp.thun@sap.com>
2010-11-26 00:30:08 +01:00
Stefan Lay 91958b7045 Do some more tests for rebase --abort
Check for deletion of temporary files in .git folder.
Check for deletion and creation of files.

Change-Id: I60b0b2975724f2e3582e8674d9f876dcbf62b350
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
2010-11-25 15:01:17 +01:00
Christian Halstrick 7e298c9ed5 Add more tests for rebase and externalized missing Strings
Coverage tests showed that we are missing to test certain areas
in the rebase command. Add the missing tests.

Change-Id: Ia4a272d26cde7e1861dac30496e4b6799fc8187a
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2010-11-24 15:59:08 +01:00
Chris Aniszczyk c441380f9c Add the Checkout command to the Git CLI
The implementation delegates to the CheckoutCommand and
therefore only supports some of the options supported by
the CheckoutCommand.

Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-11-23 13:07:46 -06:00
Chris Aniszczyk 923443f94f Add CheckoutCommand
Add the ability to checkout a branch to the working tree.

Bug: 330860
Change-Id: Ie06b9e799a9e1be384da0b8996efa7209b32eac3
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-11-22 15:53:35 -06:00
Matthias Sohn 34962b4700 Merge "Fix bug regarding handling of non-versioned files during merge" 2010-11-22 16:43:43 -05:00
Christian Halstrick 5adef23365 Fix bug regarding handling of non-versioned files during merge
There was a bug introduced by commit 0e815fe. For non-versioned files
the merge algorithm detected an incoming deletion from THEIRS.
Consequently such files were deleted. That's a severe bug which was
fixed by more precisely detecting incoming deletions.

Change-Id: I4385d3c990db11d62e371a385dc8ee89841db84a
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Philipp Thun <philipp.thun@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-11-22 22:41:25 +01:00
Chris Aniszczyk a7f6764e01 Update Rm in the JGit CLI
Since we have the RmCommand API now, update Rm to use it.

Change-Id: I6e2cb37573cc8a29846f01e09e8c07e0dc279dbe
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-11-22 11:19:51 -06:00
Chris Aniszczyk f7690cceef Add RmCommand to Git API
Bug: 330827
Change-Id: I0b74bb92254d0ee988139d25022d06d16ed89d58
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-11-22 11:02:28 -06:00
Mathias Kinzler e5b96a7848 Initial implementation of a Rebase command
This is a first iteration to implement Rebase. At the moment, this
does not implement --continue and --skip, so if the first
conflict is found, the only option is to --abort the command.

Bug: 328217
Change-Id: I24d60c0214e71e5572955f8261e10a42e9e95298
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-11-22 09:58:36 -06:00
Shawn O. Pearce bd98a0a9a5 Move WorkingTreeIterator inherited state into an object
Instead of copying up to 4 fields from the parent iterator each time a
child iterator is initialized and used, construct a single state
object that contains the 4 fields, and pass that one state object
through to the child.  This makes it easier to add additional state
fields that must be inherited, at the slight expense of an extra
object allocation per TreeWalk, and an extra level of field
indirection whenever the options, nameEncoder, or read buffer is
required by the iterator.

Change-Id: Ic4603c33b772d7a45f9c81140537d51945688fcb
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-11-18 17:06:12 -08:00
Shawn O. Pearce 3de186fbf0 Name TreeFilter and MergeFilter implementations
Naming these inner classes ensures that stack traces which contain
them will give us useful information about which filter is involved in
the trace, rather than the generated names $1, $2, etc.  This makes it
much easier to understand a stack trace at a glance.

Change-Id: Ia6a75fdb382ff6461e02054d94baf011bdeee5aa
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-11-18 16:50:14 -08:00
Chris Aniszczyk 2054c3fb8a Add core.filemode to CoreConfig
Let CoreConfig cache the value of core.filemode so
clients like EGit can take advantage of it.

Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-11-14 18:54:36 -06:00
Christian Halstrick da1ea27fa2 Fixed checkouts when HEAD is ignored
In the case where DirCacheCheckout was used to checkout a tree
without taking HEAD into account (e.g. during a clone or hard reset)
we didn't handle conflicts correctly. E.g. if there are conflicts
(entries with stage != 0) in the index and we tried to hard reset
we have been processing the conflicting pathes multiple times (once
for every stage). With this fix we will update the index with the
entry from the "merge" state (the state we want checkout) when we
detect existing conflicts.

Change-Id: Iffbddccaa588cf0d1460a5e44dabaf540d996e26
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2010-11-13 11:42:13 -06:00
Chris Aniszczyk 7bce473c92 Merge "Add simple unit tests for Base64" 2010-11-13 12:40:18 -05:00
Chris Aniszczyk 952c4e1f3d Merge "Base64: Reformat to match JGit style" 2010-11-13 12:40:05 -05:00
Chris Aniszczyk 07cabc8c6f Merge "Base64: Strip out code JGit doesn't use" 2010-11-13 12:39:48 -05:00