]> source.dussan.org Git - jgit.git/log
jgit.git
13 years agoJGit 0.11.3 47/2547/1 stable-0.11 v0.11.3
Matthias Sohn [Sun, 20 Feb 2011 23:59:47 +0000 (00:59 +0100)]
JGit 0.11.3

Change-Id: I0a3d4d4400e7643c43d64bf60e566d533b5dcee1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoFix NullPointer when pulling from a deleted local branch 46/2546/1
Stefan Lay [Wed, 16 Feb 2011 14:46:26 +0000 (15:46 +0100)]
Fix NullPointer when pulling from a deleted local branch

A checked Exception is thrown instead.

The reason for throwing an Exception is that the state of the
repository is inconsistent in this case: There is a merge
configuration containing a non-existing local branch. Ideally the
deletion of a local branch should also delete the corresponding
merge configuration.

Bug: 337315
Change-Id: I8ed57d5aaed60aaab685fc11a8695e474e60215f
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agosmart-http: Fix recognition of gzip encoding 45/2545/1
Shawn O. Pearce [Tue, 15 Feb 2011 22:09:42 +0000 (14:09 -0800)]
smart-http: Fix recognition of gzip encoding

Some clients coming through proxies may advertise a different
Accept-Encoding, for example "Accept-Encoding: gzip(proxy)".
Matching by substring causes us to identify this as a false positive;
that the client understands gzip encoding and will inflate the
response before reading it.

In this particular case however it doesn't.  Its the reverse proxy
server in front of JGit letting us know the proxy<->JGit link can
be gzip compressed, while the client<->proxy part of the link is not:

  client <-- no gzip --> proxy <-- gzip --> JGit

Use a more standard method of parsing by splitting the value into
tokens, and only using gzip if one of the tokens is exactly the
string "gzip".  Add a unit test to make sure this isn't broken in
the future.

Change-Id: Ib4c40f9db177322c7a2640808a6c10b3c4a73819
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoFix processing of broken symbolic references in RefDirectory 44/2544/1
Marc Strapetz [Wed, 9 Feb 2011 11:54:09 +0000 (12:54 +0100)]
Fix processing of broken symbolic references in RefDirectory

Change-Id: Ic1ceb9c99dca2c69e61ea0ef03ec64f13714b80a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoCreateBranchCommand: Wrong existence check 43/2543/1
Mathias Kinzler [Mon, 14 Feb 2011 14:48:43 +0000 (15:48 +0100)]
CreateBranchCommand: Wrong existence check

Bug: 337044
Change-Id: I89224719712c1f1ab80ea34280139dfeb00be3d0
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoQualify post 0.11.1 builds 42/2542/1
Matthias Sohn [Sun, 20 Feb 2011 23:41:45 +0000 (00:41 +0100)]
Qualify post 0.11.1 builds

Change-Id: I48cca12fcc6212fbe6c42109e44e4a2dc20ecada
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoJGit 0.11.1 82/2482/1 v0.11.1
Matthias Sohn [Fri, 11 Feb 2011 22:25:34 +0000 (23:25 +0100)]
JGit 0.11.1

Change-Id: I9ac2fdfb4326536502964ba614d37d0bd103f524
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoFix version.sh 81/2481/1
Matthias Sohn [Fri, 11 Feb 2011 22:03:40 +0000 (23:03 +0100)]
Fix version.sh

Change-Id: Ia010c9cecefbfb90ae54786adc7c8d838525d2f3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoMerge "Fix NPE on reading global config on MAC" into stable-0.11
Chris Aniszczyk [Wed, 9 Feb 2011 17:27:36 +0000 (12:27 -0500)]
Merge "Fix NPE on reading global config on MAC" into stable-0.11

13 years agoFix NPE on reading global config on MAC 69/2469/1
Jens Baumgart [Wed, 9 Feb 2011 14:12:31 +0000 (15:12 +0100)]
Fix NPE on reading global config on MAC

Bug: 336610

Change-Id: Iefcb85e791723801faa315b3ee45fb19e3ca52fb
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
13 years agoAdd isOutdated method to DirCache 67/2467/1
Jens Baumgart [Wed, 9 Feb 2011 14:02:22 +0000 (15:02 +0100)]
Add isOutdated method to DirCache

isOutdated returns true iff the memory state differs from the index
file.

Change-Id: If35db06743f5f588ab19d360fd2a18a07c918edb
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
13 years agoPullCommand: use default remote instead of throwing Exception 53/2453/1
Mathias Kinzler [Tue, 8 Feb 2011 07:56:19 +0000 (08:56 +0100)]
PullCommand: use default remote instead of throwing Exception

When pulling into a local branch that has no upstream configuration,
pull should try to used the default remote ("origin") instead of
throwing an Exception.

Bug: 336504
Change-Id: Ife75858e89ea79c0d6d88ba73877fe8400448e34
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
13 years agoRemove quoting of command over SSH 35/2435/1
Shawn O. Pearce [Sun, 6 Feb 2011 22:04:39 +0000 (14:04 -0800)]
Remove quoting of command over SSH

If the command contains spaces, it needs to be evaluated by the remote
shell.  Quoting the command breaks this, making it impossible to run a
remote command that needs additional options.

Bug: 336301
Change-Id: Ib5d88f0b2151df2d1d2b4e08d51ee979f6da67b5
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoFix JGit --upload-pack, --receive-pack options 16/2416/4
Shawn O. Pearce [Fri, 4 Feb 2011 13:51:27 +0000 (05:51 -0800)]
Fix JGit --upload-pack, --receive-pack options

JGit did not use sh -c to run the receive-pack or upload-pack programs
locally, which caused errors if these strings contained spaces and
needed the local shell to evaluate them.

Win32 support using cmd.exe /c is completely untested, but seems like
it should work based on the limited information I could get through
Google search results.

Bug: 336301
Change-Id: I22e5e3492fdebbae092d1ce6b47ad411e57cc1ba
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoIn iplog list approved CQs as "active" 26/2426/1
Matthias Sohn [Sun, 6 Feb 2011 00:19:52 +0000 (01:19 +0100)]
In iplog list approved CQs as "active"

Change-Id: I69c60576ae648fea2a730c9e9f042004bccecc90
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoReuse cached SHA-1 when computing from WorkingTreeIterator 27/1927/7
Shawn O. Pearce [Fri, 19 Nov 2010 01:15:19 +0000 (17:15 -0800)]
Reuse cached SHA-1 when computing from WorkingTreeIterator

Change-Id: I2b2170c29017993d8cb7a1d3c8cd94fb16c7dd02
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
13 years agoPackWriter: Support reuse of entire packs 88/2388/4
Shawn O. Pearce [Mon, 31 Jan 2011 16:35:17 +0000 (08:35 -0800)]
PackWriter: Support reuse of entire packs

The most expensive part of packing a repository for transport to
another system is enumerating all of the objects in the repository.
Once this gets to the size of the linux-2.6 repository (1.8 million
objects), enumeration can take several CPU minutes and costs a lot
of temporary working set memory.

Teach PackWriter to efficiently reuse an existing "cached pack"
by answering a clone request with a thin pack followed by a larger
cached pack appended to the end.  This requires the repository
owner to first construct the cached pack by hand, and record the
tip commits inside of $GIT_DIR/objects/info/cached-packs:

  cd $GIT_DIR
  root=$(git rev-parse master)
  tmp=objects/.tmp-$$
  names=$(echo $root | git pack-objects --keep-true-parents --revs $tmp)
  for n in $names; do
    chmod a-w $tmp-$n.pack $tmp-$n.idx
    touch objects/pack/pack-$n.keep
    mv $tmp-$n.pack objects/pack/pack-$n.pack
    mv $tmp-$n.idx objects/pack/pack-$n.idx
  done

  (echo "+ $root";
   for n in $names; do echo "P $n"; done;
   echo) >>objects/info/cached-packs

  git repack -a -d

When a clone request needs to include $root, the corresponding
cached pack will be copied as-is, rather than enumerating all of
the objects that are reachable from $root.

For a linux-2.6 kernel repository that should be about 376 MiB,
the above process creates two packs of 368 MiB and 38 MiB[1].
This is a local disk usage increase of ~26 MiB, due to reduced
delta compression between the large cached pack and the smaller
recent activity pack.  The overhead is similar to 1 full copy of
the compressed project sources.

With this cached pack in hand, JGit daemon completes a clone request
in 1m17s less time, but a slightly larger data transfer (+2.39 MiB):

  Before:
    remote: Counting objects: 1861830, done
    remote: Finding sources: 100% (1861830/1861830)
    remote: Getting sizes: 100% (88243/88243)
    remote: Compressing objects: 100% (88184/88184)
    Receiving objects: 100% (1861830/1861830), 376.01 MiB | 19.01 MiB/s, done.
    remote: Total 1861830 (delta 4706), reused 1851053 (delta 1553844)
    Resolving deltas: 100% (1564621/1564621), done.

    real  3m19.005s

  After:
    remote: Counting objects: 1601, done
    remote: Counting objects: 1828460, done
    remote: Finding sources: 100% (50475/50475)
    remote: Getting sizes: 100% (18843/18843)
    remote: Compressing objects: 100% (7585/7585)
    remote: Total 1861830 (delta 2407), reused 1856197 (delta 37510)
    Receiving objects: 100% (1861830/1861830), 378.40 MiB | 31.31 MiB/s, done.
    Resolving deltas: 100% (1559477/1559477), done.

    real 2m2.938s

Repository owners can periodically refresh their cached packs by
repacking their repository, folding all newer objects into a larger
cached pack.  Since repacking is already considered to be a normal
Git maintenance activity, this isn't a very big burden.

[1] In this test $root was set back about two weeks.

Change-Id: Ib87131d5c4b5e8c5cacb0f4fe16ff4ece554734b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoPackWriter: Display totals after sending objects 87/2387/2
Shawn O. Pearce [Mon, 31 Jan 2011 16:58:23 +0000 (08:58 -0800)]
PackWriter: Display totals after sending objects

CGit pack-objects displays a totals line after the pack data
was fully written.  This can be useful to understand some of
the decisions made by the packer, and has been a great tool
for helping to debug some of that code.

Track some of the basic values, and send it to the client when
packing is done:

  remote: Counting objects: 1826776, done
  remote: Finding sources: 100% (55121/55121)
  remote: Getting sizes: 100% (25654/25654)
  remote: Compressing objects: 100% (11434/11434)
  remote: Total 1861830 (delta 3926), reused 1854705 (delta 38306)
  Receiving objects: 100% (1861830/1861830), 386.03 MiB | 30.32 MiB/s, done.

Change-Id: If3b039017a984ed5d5ae80940ce32bda93652df5
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoRefAdvertiser: Avoid object parsing 10/2410/1
Shawn O. Pearce [Wed, 2 Feb 2011 21:48:26 +0000 (13:48 -0800)]
RefAdvertiser: Avoid object parsing

It isn't strictly necessary to validate every reference's target
object is reachable in the repository before advertising it to a
client. This is an expensive operation when there are thousands of
references, and its very unlikely that a reference uses a missing
object, because garbage collection proceeds from the references and
walks down through the graph. So trying to hide a dangling reference
from clients is relatively pointless.

Even if we are trying to avoid giving a client a corrupt repository,
this simple check isn't sufficient.  It is possible for a reference to
point to a valid commit, but that commit to have a missing blob in its
root tree.  This can be caused by staging a file into the index,
waiting several weeks, then committing that file while also racing
against a prune.  The prune may delete the blob, since its
modification time is more than 2 weeks ago, but retain the commit,
since its modification time is right now.

Such graph corruption is already caught during PackWriter as it
enumerates the graph from the client's want list and digs back
to the roots or common base.  Leave the reference validation also
for that same phase, where we know we have to parse the object to
support the enumeration.

Change-Id: Iee70ead0d3ed2d2fcc980417d09d7a69b05f5c2f
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoMerge "Expose some constants needed for reading the Pull configuration"
Chris Aniszczyk [Wed, 2 Feb 2011 15:22:23 +0000 (10:22 -0500)]
Merge "Expose some constants needed for reading the Pull configuration"

13 years agoMerge "Adapt expected commit message in tests"
Chris Aniszczyk [Wed, 2 Feb 2011 15:18:31 +0000 (10:18 -0500)]
Merge "Adapt expected commit message in tests"

13 years agoAdapt expected commit message in tests 03/2403/1
Robin Stocker [Wed, 2 Feb 2011 15:11:39 +0000 (16:11 +0100)]
Adapt expected commit message in tests

Because of change I28ae5713, the commit message lost the "into HEAD" and
caused the MergeCommandTest to fail. This change fixes it.

Bug: 336059
Change-Id: Ifac0138c6c6d66c40d7295b5e11ff3cd98bc9e0c

13 years agoExpose some constants needed for reading the Pull configuration 02/2402/1
Mathias Kinzler [Wed, 2 Feb 2011 13:45:37 +0000 (14:45 +0100)]
Expose some constants needed for reading the Pull configuration

Change-Id: I72cb1cc718800c09366306ab2eebd43cd82023ff
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
13 years agoPushCommand: do not set a null credentials provider 00/2400/1
Jens Baumgart [Wed, 2 Feb 2011 12:13:28 +0000 (13:13 +0100)]
PushCommand: do not set a null credentials provider

PushCommand now does not set a null credentials provider on
Transport because in this case the default provider is replaced with
null and the default mechanism for providing credentials is not
working.

Bug: 336023
Change-Id: I7a7a9221afcfebe2e1595a5e59641e6c1ae4a207
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
13 years agoDon't print "into HEAD" when merging refs/heads/master 96/2396/1
Robin Stocker [Tue, 1 Feb 2011 21:27:33 +0000 (22:27 +0100)]
Don't print "into HEAD" when merging refs/heads/master

When MergeMessageFormatter was given a symbolic ref HEAD which points to
refs/heads/master (which is the case when merging a branch in EGit), it
would result in a merge message like the following:

  Merge branch 'a' into HEAD

But it should print the following (as C Git does):

  Merge branch 'a'

The solution is to use the leaf ref when checking for refs/heads/master.

Change-Id: I28ae5713b7e8123a0176fc6d7356e469900e7e97

13 years agoPackWriter: Make thin packs more efficient 86/2386/2
Shawn O. Pearce [Mon, 31 Jan 2011 07:40:08 +0000 (23:40 -0800)]
PackWriter: Make thin packs more efficient

There is no point in pushing all of the files within the edge
commits into the delta search when making a thin pack.  This floods
the delta search window with objects that are unlikely to be useful
bases for the objects that will be written out, resulting in lower
data compression and higher transfer sizes.

Instead observe the path of a tree or blob that is being pushed
into the outgoing set, and use that path to locate up to WINDOW
ancestor versions from the edge commits.  Push only those objects
into the edgeObjects set, reducing the number of objects seen by the
search window.  This allows PackWriter to only look at ancestors
for the modified files, rather than all files in the project.
Limiting the search to WINDOW size makes sense, because more than
WINDOW edge objects will just skip through the window search as
none of them need to be delta compressed.

To further improve compression, sort edge objects into the front
of the window list, rather than randomly throughout.  This puts
non-edges later in the window and gives them a better chance at
finding their base, since they search backwards through the window.

These changes make a significant difference in the thin-pack:

  Before:
    remote: Counting objects: 144190, done
    remote: Finding sources: 100% (50275/50275)
    remote: Getting sizes: 100% (101405/101405)
    remote: Compressing objects: 100% (7587/7587)
    Receiving objects: 100% (50275/50275), 24.67 MiB | 9.90 MiB/s, done.
    Resolving deltas: 100% (40339/40339), completed with 2218 local objects.

    real    0m30.267s

  After:
    remote: Counting objects: 61549, done
    remote: Finding sources: 100% (50275/50275)
    remote: Getting sizes: 100% (18862/18862)
    remote: Compressing objects: 100% (7588/7588)
    Receiving objects: 100% (50275/50275), 11.04 MiB | 3.51 MiB/s, done.
    Resolving deltas: 100% (43160/43160), completed with 5014 local objects.

    real    0m22.170s

The resulting pack is 13.63 MiB smaller, even though it contains the
same exact objects.  82,543 fewer objects had to have their sizes
looked up, which saved about 8s of server CPU time.  2,796 more
objects from the client were used as part of the base object set,
which contributed to the smaller transfer size.

Change-Id: Id01271950432c6960897495b09deab70e33993a9
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Sigend-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoPackWriter: Cleanup findObjectToPack method 85/2385/2
Shawn O. Pearce [Sun, 30 Jan 2011 23:10:51 +0000 (15:10 -0800)]
PackWriter: Cleanup findObjectToPack method

Some of this code predates making ObjectId.equals() final
and fixing RevObject.equals() to match ObjectId.equals().
It was therefore more complex than it needs to be, because
it tried to work around RevObject's broken equals() rules
by converting to ObjectId in a different collection.

Also combine setUpWalker() and findObjectsToPack() methods,
these can be one method and the code is actually cleaner.

Change-Id: I0f4cf9997cd66d8b6e7f80873979ef1439e507fe
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoPackWriter: Correct 'Compressing objects' progress message 84/2384/2
Shawn O. Pearce [Mon, 31 Jan 2011 16:37:54 +0000 (08:37 -0800)]
PackWriter: Correct 'Compressing objects' progress message

The first 'Compressing objects' progress message is wrong, its
actually PackWriter looking up the sizes of each object in the
ObjectDatabase, so objects can be sorted correctly in the later
type-size sort that tries to take advantage of "Linus' Law" to
improve delta compression.

Rename the progress to say 'Getting sizes', which is an accurate
description of what it is doing.

Change-Id: Ida0a052ad2f6e994996189ca12959caab9e556a3
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoMerge "Add git-clone to the Git API"
Chris Aniszczyk [Tue, 1 Feb 2011 14:56:46 +0000 (09:56 -0500)]
Merge "Add git-clone to the Git API"

13 years agoPackWriter: Don't include edges in progress meter 83/2383/2
Shawn O. Pearce [Sun, 30 Jan 2011 22:41:50 +0000 (14:41 -0800)]
PackWriter: Don't include edges in progress meter

When compressing objects, don't include the edges in the progress
meter.  These cost almost no CPU time as they are simply pushed into
and popped out of the delta search window.

Change-Id: I7ea19f0263e463c65da34a7e92718c6db1d4a131
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoMerge "Show resolving deltas progress to push clients"
Chris Aniszczyk [Tue, 1 Feb 2011 14:40:57 +0000 (09:40 -0500)]
Merge "Show resolving deltas progress to push clients"

13 years agoMerge "ObjectWalk: Fix reset for non-commit objects"
Chris Aniszczyk [Tue, 1 Feb 2011 14:38:30 +0000 (09:38 -0500)]
Merge "ObjectWalk: Fix reset for non-commit objects"

13 years agoAdd git-clone to the Git API 53/2053/5
Chris Aniszczyk [Mon, 6 Dec 2010 23:14:29 +0000 (17:14 -0600)]
Add git-clone to the Git API

Enhance the Git API to support cloning repositories.

Bug: 334763
Change-Id: Ibe1191498dceb9cbd1325aed85b4c403db19f41e
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoShow resolving deltas progress to push clients 82/2382/1
Shawn O. Pearce [Mon, 31 Jan 2011 15:07:05 +0000 (07:07 -0800)]
Show resolving deltas progress to push clients

CGit push clients 1.6.6 and later support progress messages on the
side-band-64k channel during push, as this was introduced to handle
server side hook errors reported over smart HTTP.

Since JGit's delta resolution isn't always as fast as CGit's is,
a user may think the server has crashed and failed to report
status if the user pushed a lot of content and sees no feedback.
Exposing the progress monitor during the resolving deltas phase
will let the user know the server is still making forward progress.

This also helps BasePackPushConnection, which has a bounded timeout
on how long it will wait before assuming the remote server is dead.
Progress messages pushed down the side-band channel will reset the
read timer, helping the connection to stay alive and avoid timing
out before the remote side's work is complete.

Change-Id: I429c825e5a724d2f21c66f95526d9c49edcc6ca9
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoObjectWalk: Fix reset for non-commit objects 81/2381/1
Shawn O. Pearce [Sun, 30 Jan 2011 22:43:49 +0000 (14:43 -0800)]
ObjectWalk: Fix reset for non-commit objects

Non-commits are added to a pending queue, but duplicates are
removed by checking a flag.  During a reset that flag must be
stripped off the old roots, otherwise the caller cannot reuse
the old roots after the reset.

RevWalk already does this correctly for commits, but ObjectWalk
failed to handle the non-commit case itself.

Change-Id: I99e1832bf204eac5a424fdb04f327792e8cded4a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoMerge "Revert Ie48d6556"
Chris Aniszczyk [Mon, 31 Jan 2011 17:27:02 +0000 (12:27 -0500)]
Merge "Revert Ie48d6556"

13 years agoMerge "Proper handling of rebase during pull"
Chris Aniszczyk [Mon, 31 Jan 2011 16:02:57 +0000 (11:02 -0500)]
Merge "Proper handling of rebase during pull"

13 years agoRevert Ie48d6556 79/2379/1
Chris Aniszczyk [Mon, 31 Jan 2011 15:59:42 +0000 (09:59 -0600)]
Revert Ie48d6556

This was a mistake that was missed due to historical reasons.

"The first /r/ tells our Apache to redirect the request to Gerrit.
The second /r/ tells Gerrit that the thing following is a Git SHA-1
and it should try to locate the changes that use that commit object.
Nothing I can easily do about it now. The second /r/ is historical
and comes from Gerrit 1.x days."

Change-Id: Iec2dbf5e077f29c0e0686cab11ef197ffc705012
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoFix incorrect review url in IP log file 69/2369/2
Robert Munteanu [Fri, 28 Jan 2011 15:31:25 +0000 (17:31 +0200)]
Fix incorrect review url in IP log file

Change-Id: Ie48d655698dc1f4cd4f00606436a57c451c13179
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoProper handling of rebase during pull 76/2376/1
Mathias Kinzler [Mon, 31 Jan 2011 11:12:48 +0000 (12:12 +0100)]
Proper handling of rebase during pull

After consulting with Christian Halstrick, it turned out that the
handling of rebase during pull was implemented incorrectly.

Change-Id: I40f03409e080cdfeceb21460150f5e02a016e7f4
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
13 years agoMerge changes I3a74cc84,I219f864f
Robin Rosenberg [Sat, 29 Jan 2011 22:52:12 +0000 (17:52 -0500)]
Merge changes I3a74cc84,I219f864f

* changes:
  [findbugs] Do not ignore exceptional return value of createNewFile()
  Do not create files to be updated before checkout of DirCache entry

13 years agoAdd setCredentialsProvider to PullCommand 71/2371/2
Tomasz Zarna [Fri, 28 Jan 2011 17:28:28 +0000 (18:28 +0100)]
Add setCredentialsProvider to PullCommand

Bug: 335703
Change-Id: Id9713a4849c772e030fca23dd64b993264f28366
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoMerge "ObjectIdSubclassMap: Support duplicate additions"
Chris Aniszczyk [Fri, 28 Jan 2011 17:45:39 +0000 (12:45 -0500)]
Merge "ObjectIdSubclassMap: Support duplicate additions"

13 years agoObjectIdSubclassMap: Support duplicate additions 61/2361/2
Shawn O. Pearce [Fri, 28 Jan 2011 01:20:36 +0000 (17:20 -0800)]
ObjectIdSubclassMap: Support duplicate additions

The new addIfAbsent() method combines get() with add(), but does
it in a single step so that the common case of get() returning null
for a new object can immediately insert the object into the map.

Change-Id: Ib599ab4de13ad67665ccfccf3ece52ba3222bcba
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoMerge "Make PullCommand work with Rebase"
Chris Aniszczyk [Fri, 28 Jan 2011 15:52:38 +0000 (10:52 -0500)]
Merge "Make PullCommand work with Rebase"

13 years agoMerge "RebaseCommand: detect and handle fast-forward properly"
Chris Aniszczyk [Fri, 28 Jan 2011 15:38:27 +0000 (10:38 -0500)]
Merge "RebaseCommand: detect and handle fast-forward properly"

13 years agoRevert "Teach PackWriter how to reuse an existing object list" 67/2367/1
Shawn O. Pearce [Fri, 28 Jan 2011 15:16:02 +0000 (07:16 -0800)]
Revert "Teach PackWriter how to reuse an existing object list"

This reverts commit f5fe2dca3cb9f57891e1a4b18832fcc158d0c490.

I regret adding this feature to the public API.  Caches aren't always
the best idea, as they require work to maintain.  Here the cache is
redundant information that must be computed, and when it grows stale
must be removed.  The redundant information takes up more disk space,
about the same size as the pack-*.idx files are.  For the linux-2.6
repository, that's more than 40 MB for a 400 MB repository.  So the
cache is a 10% increase in disk usage.

The entire point of this cache is to improve PackWriter performance,
and only PackWriter performance, and only when sending an initial
clone to a new client.  There may be better ways to optimize this, and
until we have a solid solution, we shouldn't be using a separate cache
in JGit.

13 years agoMake PullCommand work with Rebase 65/2365/4
Mathias Kinzler [Fri, 28 Jan 2011 13:40:09 +0000 (14:40 +0100)]
Make PullCommand work with Rebase

Rebase must honor the upstream configuration

branch.<branchname>.rebase

Change-Id: Ic94f263d3f47b630ad75bd5412cb4741bb1109ca
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
13 years agoRebaseCommand: detect and handle fast-forward properly 64/2364/3
Mathias Kinzler [Fri, 28 Jan 2011 14:03:02 +0000 (15:03 +0100)]
RebaseCommand: detect and handle fast-forward properly

This bug was hidden by an incomplete test: the current Rebase
implementation using the "git rebase -i" pattern does not work
correctly if fast-forwarding is involved. The reason for this is that
the log command does not return any commits in this case.
In addition, a check for already merged commits was introduced to
avoid spurious conflicts.

Change-Id: Ib9898fe0f982fa08e41f1dca9452c43de715fdb6
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
13 years agoTransportHttp wrongly uses JDK 6 constructor of IOException 63/2363/1
Mathias Kinzler [Fri, 28 Jan 2011 08:24:20 +0000 (09:24 +0100)]
TransportHttp wrongly uses JDK 6 constructor of IOException

IOException constructor taking Exception as parameter is
new for JDK 6.

Change-Id: Iec349fc7be9e9fbaeb53841894883c47a98a7b29
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
13 years ago[findbugs] Do not ignore exceptional return value of createNewFile() 06/2106/8
Matthias Sohn [Mon, 10 Jan 2011 21:45:47 +0000 (22:45 +0100)]
[findbugs] Do not ignore exceptional return value of createNewFile()

Properly handle return value of java.io.File.createNewFile().

Change-Id: I3a74cc84cd126ca1a0eaccc77b2944d783ff0747
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years ago[findbugs] Do not ignore exceptional return value of mkdir 04/2104/8
Matthias Sohn [Fri, 10 Dec 2010 20:58:05 +0000 (21:58 +0100)]
[findbugs] Do not ignore exceptional return value of mkdir

java.io.File.mkdir() and mkdirs() report failure as an exceptional
return value false. Fix the code which silently ignored this
exceptional return value.

Change-Id: I41244f4b9d66176e68e2c07e2329cf08492f8619
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoDo not create files to be updated before checkout of DirCache entry 28/2228/4
Matthias Sohn [Mon, 10 Jan 2011 22:09:34 +0000 (23:09 +0100)]
Do not create files to be updated before checkout of DirCache entry

DirCacheCheckout.checkoutEntry() prepares the new file content using a
temporary file and then renames it to the file to be written during
checkout. For files to be updated checkout() created each file before
calling checkoutEntry(). Hence renaming the temporary file always
failed which was corrected in exception handling by retrying to rename
the file after deleting the just newly created file.

Change-Id: I219f864f2ed8d68051d7b5955d0659964fa27274
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoTeach PackWriter how to reuse an existing object list 59/2359/1
Shawn O. Pearce [Wed, 26 Jan 2011 22:27:32 +0000 (14:27 -0800)]
Teach PackWriter how to reuse an existing object list

Counting the objects needed for packing is the most expensive part of
an UploadPack request that has no uninteresting objects (otherwise
known as an initial clone).  During this phase the PackWriter is
enumerating the entire set of objects in this repository, so they can
be sent to the client for their new clone.

Allow the ObjectReader (and therefore the underlying storage system)
to keep a cached list of all reachable objects from a small number of
points in the project's history.  If one of those points is reached
during enumeration of the commit graph, most objects are obtained from
the cached list instead of direct traversal.

PackWriter uses the list by discarding the current object lists and
restarting a traversal from all refs but marking the object list name
as uninteresting.  This allows PackWriter to enumerate all objects
that are more recent than the list creation, or that were on side
branches that the list does not include.

However, ObjectWalk tags all of the trees and commits within the list
commit as UNINTERESTING, which would normally cause PackWriter to
construct a thin pack that excludes these objects.  To avoid that,
addObject() was refactored to allow this list-based enumeration to
always include an object, even if it has been tagged UNINTERESTING by
the ObjectWalk.  This implies the list-based enumeration may only be
used for initial clones, where all objects are being sent.

The UNINTERESTING labeling occurs because StartGenerator always
enables the BoundaryGenerator if the walker is an ObjectWalk and a
commit was marked UNINTERESTING, even if RevSort.BOUNDARY was not
enabled.  This is the default reasonable behavior for an ObjectWalk,
but isn't desired here in PackWriter with the list-based enumeration.
Rather than trying to change all of this behavior, PackWriter works
around it.

Because the list name commit's immediate files and trees were all
enumerated before the list enumeration itself starts (and are also
within the list itself) PackWriter runs the risk of adding the same
objects to its ObjectIdSubclassMap twice.  Since this breaks the
internal map data structure (and also may cause the object to transmit
twice), PackWriter needs to use a new "added" RevFlag to track whether
or not an object has been put into the outgoing list yet.

Change-Id: Ie99ed4d969a6bb20cc2528ac6b8fb91043cee071
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoAllow ObjectReuseAsIs to resort objects during writing 58/2358/1
Shawn O. Pearce [Wed, 26 Jan 2011 01:20:08 +0000 (17:20 -0800)]
Allow ObjectReuseAsIs to resort objects during writing

It can be very handy for the implementation to resort the
object list based on data locality, improving prefetch in
the operating system's buffer cache.

Export the list to the implementation was a proper List,
and document that its mutable and OK to be modified.  The
only caller in PackWriter is already OK with these rules.

Change-Id: I3f51cf4388898917b2be36670587a5aee902ff10
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoPackWriter: Use TOPO order only for incremental packs 57/2357/1
Shawn O. Pearce [Tue, 25 Jan 2011 00:18:23 +0000 (16:18 -0800)]
PackWriter: Use TOPO order only for incremental packs

When performing an initial clone of a repository there are no
uninteresting commits, and the resulting pack will be completely
self-contained.  Therefore PackWriter does not need to honor C
Git standard TOPO ordering as described in JGit commit ba984ba2e0a
("Fix checkReferencedIsReachable to use correct base list").

Switching to COMMIT_TIME_DESC when there are no uninteresting commits
allows the "Counting objects" phase to emit progress earlier, as the
RevWalk will not buffer the commit list.  When TOPO is set the RevWalk
enumerates all commits first, before outputing any for PackWriter to
mark progress updates from.

Change-Id: If2b6a9903b536c7fb3c45f85d0a67ff6c6e66f22
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoRemove getObjectsDirectory, openPack from base API 16/2316/2
Shawn O. Pearce [Sun, 23 Jan 2011 01:27:20 +0000 (17:27 -0800)]
Remove getObjectsDirectory, openPack from base API

These two methods are specific to the FileRepository implementation
and should not be exposed as part of the base Repository API.  Now
that PackParser is generic and does not require these two methods
to import a pack stream into a repostiory, it is safe to remove
these and get them out of the public view.

Change-Id: I8990004d08074657f467849dabfdaa7e6674e69a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoMerge "Support for self signed certificate (HTTPS)"
Shawn Pearce [Thu, 27 Jan 2011 16:46:49 +0000 (11:46 -0500)]
Merge "Support for self signed certificate (HTTPS)"

13 years agoHard reset should not report conflict on untracked file 53/2353/1
Matthias Sohn [Thu, 27 Jan 2011 16:20:04 +0000 (17:20 +0100)]
Hard reset should not report conflict on untracked file

This problem surfaced since EGit Core ResetOperationTest is failing
since change I26806d21. JGit detected checkout conflict for untracked
files which never were tracked by the repository.

"git reset --hard" in c git also doesn't remove such untracked files.

Change-Id: Icc8e1c548ecf6ed48bd2979c81eeb6f578d347bd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoRename PlotWalk.getTags() to getRefs() 28/2328/2
Roberto Tyley [Tue, 25 Jan 2011 14:50:25 +0000 (14:50 +0000)]
Rename PlotWalk.getTags() to getRefs()

Change-Id: I170685e70d9ac09a010df69d26ec1c38bde60174
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoProvide access to the Refs of a PlotCommit 37/2337/2
Roberto Tyley [Wed, 26 Jan 2011 13:25:10 +0000 (13:25 +0000)]
Provide access to the Refs of a PlotCommit

This information is generally useful - have followed the
accessor pattern of 'children' and 'parents'

Change-Id: I79b3ddd6f390152aa49e6b7a4c72a4aca0d6bc72
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoFix tests broken by fix for adding files in a network share 51/2351/2
Robin Rosenberg [Wed, 26 Jan 2011 19:30:30 +0000 (20:30 +0100)]
Fix tests broken by fix for adding files in a network share

The change Ie0350e032a97e0d09626d6143c5c692873a5f6a2 was not
done properly. The renamed file was not write protected, and
this broke a test.

Bug: 335388
Change-Id: I41b2235b7677bc5fddc70dda2a56cdd2cb53ce5d
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
13 years agoFetchCommand: allow to set "TagOpt" 50/2350/2
Mathias Kinzler [Wed, 26 Jan 2011 19:03:02 +0000 (20:03 +0100)]
FetchCommand: allow to set "TagOpt"

This is needed for implementing Fetch in EGit using the API.

Change-Id: Ibdcc95906ef0f93e3798ae20d4de353fb394f2e2
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
13 years agoMake sure not to overwrite untracked not-ignored files 43/2343/2
Christian Halstrick [Wed, 12 Jan 2011 16:25:40 +0000 (17:25 +0100)]
Make sure not to overwrite untracked not-ignored files

When DirCacheCheckout was checking out it was silently
overwriting untracked files. This is only ok if the
files are also ignored. Untracked and not ignored files
should not be overwritten. This fix adds checks for
this situation.
Because this change in the behaviour also broke tests
which expected that a checkout will overwrite untracked
files (PullCommandTest) these tests have to be modified
also.

Bug: 333093
Change-Id: I26806d2108ceb64c51abaa877e11b584bf527fc9
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoFixed several NPEs in the Fetch CLI 45/2345/2
Sasa Zivkov [Wed, 26 Jan 2011 16:28:47 +0000 (17:28 +0100)]
Fixed several NPEs in the Fetch CLI

The Fetch command line was failing with NPE in case some options were omitted.
Additionally, it was setting a negative timeout when no timeout option was used
which caused HttpURLConnection to throw an IllegalArgumentException.

Change-Id: I2c67e2e1a03044284d183d73f0b82bb7ff79de95
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoFixed NLS in JGit command line interface 48/2348/2
Sasa Zivkov [Wed, 26 Jan 2011 17:20:13 +0000 (18:20 +0100)]
Fixed NLS in JGit command line interface

There was one place where the parameter substitution wasn't done which caused
text fragments like "{0}" to appear in JGits output.

Bug: 325025
Change-Id: I89b881a8b5ef39f609437546310463ed4f6e1fb5
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoFix adding files in a network share 33/2333/2
Robin Rosenberg [Tue, 25 Jan 2011 22:26:38 +0000 (23:26 +0100)]
Fix adding files in a network share

We cannot always rename read-only files on network shares,
so rename the temp file for a new loose object first, and
then set it as read-only.

Bug: 335388
Change-Id: Ie0350e032a97e0d09626d6143c5c692873a5f6a2
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoMerge "Refactor and comment complicated if statements"
Chris Aniszczyk [Wed, 26 Jan 2011 17:23:26 +0000 (12:23 -0500)]
Merge "Refactor and comment complicated if statements"

13 years agoMerge "MergeCommand should create missing branches"
Chris Aniszczyk [Wed, 26 Jan 2011 17:17:47 +0000 (12:17 -0500)]
Merge "MergeCommand should create missing branches"

13 years agoMerge "Make setCredentialsProvider more convenient to use"
Chris Aniszczyk [Wed, 26 Jan 2011 17:05:57 +0000 (12:05 -0500)]
Merge "Make setCredentialsProvider more convenient to use"

13 years agoMake setCredentialsProvider more convenient to use 46/2346/1
Mathias Kinzler [Wed, 26 Jan 2011 17:03:22 +0000 (18:03 +0100)]
Make setCredentialsProvider more convenient to use

Change-Id: I984836ea7d6a67fd2d1d05f270afa7c29f30971c
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
13 years agoRemove unneeded interface from test class 40/2340/1
Christian Halstrick [Wed, 12 Jan 2011 12:52:50 +0000 (13:52 +0100)]
Remove unneeded interface from test class

Change-Id: Ia876fda0d4cf91b5326d48014e88503de93a1f38
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
13 years agoRefactor and comment complicated if statements 42/2342/1
Christian Halstrick [Wed, 12 Jan 2011 13:25:30 +0000 (14:25 +0100)]
Refactor and comment complicated if statements

When debugging and enhancing DirCacheCheckout.processEntry() I found
that some of if-statements where hard to read/understand. This
change just splits some long if statements and adds more comments
explaining in which state we are. This change is only a preparation
for followup commits which introduce checks for untracked+ignored
files.

Change-Id: I670ff08310b72c858709b9e395f0aebb4b290a56
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
13 years agoMergeCommand should create missing branches 41/2341/1
Christian Halstrick [Wed, 26 Jan 2011 15:30:13 +0000 (16:30 +0100)]
MergeCommand should create missing branches

If HEAD exists but points to an not-existing branch the merge
command should silently create the missing branch and check
it out. This happens if you pull into freshly initalized repo.
HEAD points to refs/heads/master but refs/heads/master doesn't
exist. If you know merge a commit X into HEAD then the branch
master should be created (pointing to X) the working tree should
be updated to reflect X. That is achieved by checkout with one
tree only (HEAD is missing).

A test for this functionality will come the the next proposal
in PullCommandTest.

Change-Id: Id4a0d56d944e0acebd4b3157428bb50bd3fdd872
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
13 years agoSupport for self signed certificate (HTTPS) 18/2318/2
Per Salomonsson [Wed, 26 Jan 2011 00:16:24 +0000 (01:16 +0100)]
Support for self signed certificate (HTTPS)

Add possibility to disable ssl verification, just as i can do with git
using: git config --global http.sslVerify false

To enable the feature, configure
Window->Preferences->Team->Git->Configuration
and add a new key/value: http.sslVerify=false

When handling repos over https, JGit will then check that flag to see
if security is loose and the ssl verification should be ignored.

Having it implemented as a key/value makes it not too obvious in the
GUI - so the user must know what he/she is doing when adding it. Being
aware of the risks etc.

Bug: 332487
Change-Id: I2a1b8098b5890bf512b8dbe07da41036c0fc9b72
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoPermit disabling birthday attack checks in PackParser 94/2294/2
Shawn O. Pearce [Wed, 19 Jan 2011 00:33:33 +0000 (16:33 -0800)]
Permit disabling birthday attack checks in PackParser

Reading a repository for millions of missing objects might be very
expensive to perform, especially if the repository is on a network
filesystem or some other costly RPC backend.  A repository owner
might choose to accept some risk in return for better performance,
so allow disabling collision checking when receiving a pack.

Currently there is no way for an end-user to disable this feature.
This is intentional, because it is generally *NOT* a good idea to
skip this check.  Instead this feature is supplied for storage
implementations to bypass the default checking logic, should they
have their own custom routines that is just as effective but can
be handled more efficiently.

Change-Id: I90c801bb40e86412209de0c43e294a28f6a767a5
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoEnsure all deltas were resolved in a pack 93/2293/2
Shawn O. Pearce [Wed, 19 Jan 2011 01:14:15 +0000 (17:14 -0800)]
Ensure all deltas were resolved in a pack

If a pack uses OFS_DELTA only (e.g. its an initial push to a
repository) and PackParser's implementation is broken such that the
delta chain that hangs below a particular object offset is empty, the
entryCount won't match the expected objectCount. Fail fast rather
than claiming the stream was parsed correctly.

The current implementation is not broken as described above.  I broke
the code when I implemented my own new subclass of PackParser (which
incorrectly mucked with the object offset information), leading me to
discover this consistency check was missing.

Change-Id: I07540f0ae1144ef6f3bda48774dbdefb8876e1d3
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoRefactor IndexPack to not require local filesystem 52/2252/3
Shawn O. Pearce [Fri, 14 Jan 2011 22:17:55 +0000 (14:17 -0800)]
Refactor IndexPack to not require local filesystem

By moving the logic that parses a pack stream from the network (or
a bundle) into a type that can be constructed by an ObjectInserter,
repository implementations have a chance to inject their own logic
for storing object data received into the destination repository.

The API isn't completely generic yet, there are still quite a few
assumptions that the PackParser subclass is storing the data onto
the local filesystem as a single file.  But its about the simplest
split of IndexPack I can come up with without completely ripping
the code apart.

Change-Id: I5b167c9cc6d7a7c56d0197c62c0fd0036a83ec6c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoParse RevCommit bodies before calling RevFilter.include() 09/2309/4
Jesse Greenwald [Fri, 14 Jan 2011 22:34:35 +0000 (16:34 -0600)]
Parse RevCommit bodies before calling RevFilter.include()

RevFilter.include()'s documentation promises the RevCommit's
body is parsed before include is invoked.  This wasn't always
true if the commit was parsed once, had its body discarded,
the RevWalk was reset() and started a new traversal.

Change-Id: Ie5cafde09ae870712b165d8a97a2c9daf90b1dbd
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoAllow to set a CredentialsProvider on relevant API commands 27/2327/2
Mathias Kinzler [Tue, 25 Jan 2011 14:03:19 +0000 (15:03 +0100)]
Allow to set a CredentialsProvider on relevant API commands

This is needed for commands that use Transport internally.

Change-Id: I9417c85255b160723968c647063b9c7e05995ea4
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoExposed the constructor of Note class 04/2304/3
Sasa Zivkov [Fri, 21 Jan 2011 16:04:24 +0000 (17:04 +0100)]
Exposed the constructor of Note class

Additionally, defined the NoteMap.getNote method which returns a Note
instance.  These changes were necessary to enable implementation of
the NoteMerger interface (the merge method needs to instantiate a
Note) and to enable direct use of NoteMerger which expects instances
of Note class as its paramters.  Implementing creation of code review
summary notes in Gerrit [1] will make use of both of these features.

[1] https://review.source.android.com/#change,20045

Change-Id: I627aefcedcd3434deecd63fa1d3e90e303b385ac
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoMerge "Build http.server source JAR"
Chris Aniszczyk [Fri, 21 Jan 2011 15:32:22 +0000 (10:32 -0500)]
Merge "Build http.server source JAR"

13 years agoIntroduce metaData compare between working tree and index entries 99/2199/4
Christian Halstrick [Fri, 31 Dec 2010 13:42:41 +0000 (14:42 +0100)]
Introduce metaData compare between working tree and index entries

Instead of offering only a high-level isModified() method a new
method compareMetadata() is introduced which compares a working tree entry
and a index entry by looking at metadata only. Some use-cases
(e.g. computing the content-id in idBuffer()) may use this new method
instead of isModified().

Change-Id: I4de7501d159889fbac5ae6951f4fef8340461b47
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoAdd progress reporting to IndexDiff 63/2263/5
Robin Rosenberg [Fri, 21 Jan 2011 00:23:24 +0000 (01:23 +0100)]
Add progress reporting to IndexDiff

Change-Id: I4f05bdb0c58b039bd379341a6093f06a2cdfec6e
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoBuild http.server source JAR 92/2292/1
Shawn O. Pearce [Tue, 18 Jan 2011 23:59:15 +0000 (15:59 -0800)]
Build http.server source JAR

Change-Id: I459de081fd518abfa50dd812c68eed4d1c7f8a0b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoFix misc spelling errors in comments and method names 62/2262/1
Robin Rosenberg [Mon, 17 Jan 2011 21:04:14 +0000 (22:04 +0100)]
Fix misc spelling errors in comments and method names

Change-Id: I24552443710075856540696717ac4068dfe6a7f2
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
13 years agoMerge "File utility for creating a new empty file"
Matthias Sohn [Sun, 16 Jan 2011 17:22:46 +0000 (12:22 -0500)]
Merge "File utility for creating a new empty file"

13 years agoFile utility for creating a new empty file 05/2105/5
Matthias Sohn [Thu, 30 Dec 2010 22:10:55 +0000 (23:10 +0100)]
File utility for creating a new empty file

The java.io.File.createNewFile() method for creating new empty files
reports failure by returning false. To ease proper checking of return
values provide a utility method wrapping createNewFile() throwing
IOException on failure.

Change-Id: I42a3dc9d8ff70af62e84de396e6a740050afa896
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoMerge "ConfigConstants: expose some constants for user name and email."
Shawn Pearce [Wed, 12 Jan 2011 15:47:55 +0000 (10:47 -0500)]
Merge "ConfigConstants: expose some constants for user name and email."

13 years agoMerge "CheckoutCommand: fix reflog message"
Shawn Pearce [Wed, 12 Jan 2011 15:46:23 +0000 (10:46 -0500)]
Merge "CheckoutCommand: fix reflog message"

13 years agoMerge "Locate $HOME like C Git does on Windows"
Shawn Pearce [Wed, 12 Jan 2011 15:44:57 +0000 (10:44 -0500)]
Merge "Locate $HOME like C Git does on Windows"

13 years agoFix API ListBranchCommand for listmode 'all' 40/2240/1
Roberto Tyley [Wed, 12 Jan 2011 14:34:10 +0000 (14:34 +0000)]
Fix API ListBranchCommand for listmode 'all'

If remote branches are present they can not be added
to the RefMap from the local branches - the two RefMaps
have a different value of 'prefix' and consequently an
IllegalArgumentException is thrown.

13 years agoLocate $HOME like C Git does on Windows 37/2237/1
Robin Rosenberg [Wed, 12 Jan 2011 13:58:55 +0000 (14:58 +0100)]
Locate $HOME like C Git does on Windows

Java's user.home is not the same as $HOME so EGit did see the
same global configuration as C Git does.

Bug: 333269
Change-Id: Id54fc5292bf8c5a67177f9097ee692717a7df336
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
13 years agoCheckoutCommand: fix reflog message 36/2236/1
Mathias Kinzler [Wed, 12 Jan 2011 12:19:32 +0000 (13:19 +0100)]
CheckoutCommand: fix reflog message

There is a space missing between <from> and "to" in the reflog
message produced by the CheckoutCommand, which is of the form

moving from <from> to <to>

Change-Id: I3dc57ab0a6589292db77a17d9029ee9499dfc725
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
13 years agoConfigConstants: expose some constants for user name and email. 31/2231/2
Mathias Kinzler [Wed, 12 Jan 2011 07:50:12 +0000 (08:50 +0100)]
ConfigConstants: expose some constants for user name and email.

This is needed by a EGit change

http://egit.eclipse.org/r/#change,2232

Change-Id: I3d62f904b769fc2f1b7b8f0f24f7dd757fc9c379
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
13 years agoMerge "Using java.util.concurrent in NLSTest instead of handling threads directly."
Shawn Pearce [Mon, 10 Jan 2011 15:05:28 +0000 (10:05 -0500)]
Merge "Using java.util.concurrent in NLSTest instead of handling threads directly."

13 years agoMerge "Do not cherry-pick or revert commit more than once"
Matthias Sohn [Mon, 10 Jan 2011 14:00:30 +0000 (09:00 -0500)]
Merge "Do not cherry-pick or revert commit more than once"

13 years agoUsing java.util.concurrent in NLSTest instead of handling threads directly. 19/2219/2
Sasa Zivkov [Fri, 7 Jan 2011 12:38:28 +0000 (13:38 +0100)]
Using java.util.concurrent in NLSTest instead of handling threads directly.

A test in NLSTest was mixing the "old" and the "new" way of handling
concurrency. This change makes use of the java.util.concurrent facilities to
control concurrency and removes the code that was directly dealing with Thread
objects.

Change-Id: Ie7267776e988a48a5443f0f3fe4eb43e79eee4b1
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
13 years agoDo not cherry-pick or revert commit more than once 23/2223/1
Robin Rosenberg [Mon, 10 Jan 2011 07:47:14 +0000 (08:47 +0100)]
Do not cherry-pick or revert commit more than once

Instead just return success. In the case that no commit has been
cherry-picked or reverted, just return the old HEAD.

Bug: 333814
Change-Id: I67db2b77b52c43932436d22a8daa5a6556423484
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
13 years agoMerge "Use heap based stack for PackFile deltas"
Shawn O. Pearce [Mon, 10 Jan 2011 00:20:13 +0000 (19:20 -0500)]
Merge "Use heap based stack for PackFile deltas"