Browse Source

Initial JGit contribution to eclipse.org

Per CQ 3448 this is the initial contribution of the JGit project
to eclipse.org.  It is derived from the historical JGit repository
at commit 3a2dd9921c.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
tags/v0.7.0
Git Development Community 12 years ago
commit
1a6964c827
100 changed files with 8331 additions and 0 deletions
  1. 1
    0
      .gitattributes
  2. 6
    0
      .gitignore
  3. 42
    0
      LICENSE
  4. 122
    0
      README
  5. 366
    0
      SUBMITTING_PATCHES
  6. 49
    0
      TODO
  7. 1
    0
      jgit-maven/.gitignore
  8. 226
    0
      jgit-maven/jgit/pom.xml
  9. 94
    0
      jgit.sh
  10. 179
    0
      make_jgit.sh
  11. 8
    0
      org.eclipse.jgit.pgm/.classpath
  12. 1
    0
      org.eclipse.jgit.pgm/.gitignore
  13. 17
    0
      org.eclipse.jgit.pgm/.project
  14. 3
    0
      org.eclipse.jgit.pgm/.settings/org.eclipse.core.resources.prefs
  15. 3
    0
      org.eclipse.jgit.pgm/.settings/org.eclipse.core.runtime.prefs
  16. 321
    0
      org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs
  17. 9
    0
      org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.ui.prefs
  18. 30
    0
      org.eclipse.jgit.pgm/src/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin
  19. 137
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
  20. 216
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java
  21. 187
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
  22. 78
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Command.java
  23. 194
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java
  24. 164
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java
  25. 125
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java
  26. 65
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java
  27. 119
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java
  28. 111
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java
  29. 132
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java
  30. 76
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java
  31. 71
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java
  32. 129
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java
  33. 86
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java
  34. 85
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
  35. 184
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
  36. 80
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java
  37. 256
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
  38. 74
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java
  39. 81
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevList.java
  40. 74
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java
  41. 208
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java
  42. 98
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java
  43. 68
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java
  44. 100
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java
  45. 241
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
  46. 80
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java
  47. 58
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java
  48. 212
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/build/JarLinkUtil.java
  49. 74
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java
  50. 60
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java
  51. 313
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
  52. 76
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java
  53. 121
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java
  54. 80
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
  55. 61
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteDirCache.java
  56. 143
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java
  57. 177
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java
  58. 101
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java
  59. 108
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java
  60. 84
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RefSpecHandler.java
  61. 146
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java
  62. 114
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java
  63. 100
    0
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java
  64. 11
    0
      org.eclipse.jgit.test/.classpath
  65. 3
    0
      org.eclipse.jgit.test/.gitignore
  66. 17
    0
      org.eclipse.jgit.test/.project
  67. 6
    0
      org.eclipse.jgit.test/.settings/org.eclipse.core.resources.prefs
  68. 3
    0
      org.eclipse.jgit.test/.settings/org.eclipse.core.runtime.prefs
  69. 320
    0
      org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs
  70. 10
    0
      org.eclipse.jgit.test/.settings/org.eclipse.jdt.ui.prefs
  71. 116
    0
      org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/SpeedTestBase.java
  72. 91
    0
      org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0005_ShallowSpeedTest.java
  73. 94
    0
      org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0006_DeepSpeedTest.java
  74. 227
    0
      org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java
  75. 21
    0
      org.eclipse.jgit.test/org.eclipse.jgit.core--All-External-Tests (Java 6).launch
  76. 20
    0
      org.eclipse.jgit.test/org.eclipse.jgit.core--All-External-Tests.launch
  77. 21
    0
      org.eclipse.jgit.test/org.eclipse.jgit.core--All-Tests (Java 6).launch
  78. 20
    0
      org.eclipse.jgit.test/org.eclipse.jgit.core--All-Tests.launch
  79. 6
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/E.patch
  80. 1
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/E_PostImage
  81. 0
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/E_PreImage
  82. 24
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/X.patch
  83. 28
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/X_PostImage
  84. 25
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/X_PreImage
  85. 8
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/Y.patch
  86. 1
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/Y_PostImage
  87. 1
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/Y_PreImage
  88. 8
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/Z.patch
  89. 1
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/Z_PostImage
  90. 1
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/Z_PreImage
  91. 18
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/testContext0.out
  92. 24
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/testContext1.out
  93. 37
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/testContext10.out
  94. 37
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/testContext100.out
  95. 30
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/testContext3.out
  96. 34
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/testContext5.out
  97. 1
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/patch/.gitattributes
  98. 24
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/patch/testEditList_Types.patch
  99. 17
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/patch/testError_BodyTooLong.patch
  100. 0
    0
      org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/patch/testError_CcTruncatedOld.patch

+ 1
- 0
.gitattributes View File

@@ -0,0 +1 @@
*.java diff=java

+ 6
- 0
.gitignore View File

@@ -0,0 +1,6 @@
/jgit
/jgit.jar
/jgit_src.zip
/jgit_docs.zip
/org.eclipse.jgit/lib/jsch-*.jar
/org.eclipse.jgit.pgm/lib/args4j-*.jar

+ 42
- 0
LICENSE View File

@@ -0,0 +1,42 @@
/*
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Eclipse Foundation, Inc. nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/


+ 122
- 0
README View File

@@ -0,0 +1,122 @@
== Java GIT ==

This package is licensed under the BSD.

org.eclipse.jgit/

A pure Java library capable of being run standalone, with no
additional support libraries. Some JUnit tests are provided
to exercise the library. The library provides functions to
read and write a GIT formatted repository.

All portions of jgit are covered by the BSD. Absolutely no GPL,
LGPL or EPL contributions are accepted within this package.

org.eclipse.jgit.test/
Unit tests for org.eclipse.jgit and the same licensing rules.

== WARNINGS / CAVEATS ==

- Symbolic links are not supported because java does not support it.
Such links could be damaged.

- Only the timestamp of the index is used by jgit check if the index
is dirty.

- Don't try the library with a JDK other than 1.6 (Java 6) unless you
are prepared to investigate problems yourself. JDK 1.5.0_11 and later
Java 5 versions *may* work. Earlier versions do not. JDK 1.4 is *not*
supported. Apple's Java 1.5.0_07 is reported to work acceptably. We
have no information about other vendors. Please report your findings
if you try.

- CRLF conversion is never performed. On Windows you should thereforc
make sure your projects and workspaces are configured to save files
with Unix (LF) line endings.

== Package Features ==

org.eclipse.jgit/

* Read loose and packed commits, trees, blobs, including
deltafied objects.

* Read objects from shared repositories

* Write loose commits, trees, blobs.

* Write blobs from local files or Java InputStreams.

* Read blobs as Java InputStreams.

* Copy trees to local directory, or local directory to a tree.

* Lazily loads objects as necessary.

* Read and write .git/config files.

* Create a new repository.

* Read and write refs, including walking through symrefs.

* Read, update and write the Git index.

* Checkout in dirty working directory if trivial.

* Walk the history from a given set of commits looking for commits
introducing changes in files under a specified path.

* Object transport
Fetch via ssh, git, http, Amazon S3 and bundles.
Push via ssh, git and Amazon S3. JGit does not yet deltify
the pushed packs so they may be a lot larger than C Git packs.

org.eclipse.jgit.pgm/

* Assorted set of command line utilities. Mostly for ad-hoc testing of jgit
log, glog, fetch etc.

== Missing Features ==

There are a lot of missing features. You need the real Git for this.
For some operations it may just be the preferred solution also. There
are not just a command line, there is e.g. git-gui that makes committing
partial files simple.

- Merging.

- Repacking.

- Generate a GIT format patch.

- Apply a GIT format patch.

- Documentation. :-)

- gitattributes support
In particular CRLF conversion is not implemented. Files are treated
as byte sequences.

- submodule support
Submodules are not supported or even recognized.

== Support ==

Post question, comments or patches to the git@vger.kernel.org mailing list.


== Contributing ==

See SUBMITTING_PATCHES in this directory. However, feedback and bug reports
are also contributions.


== About GIT ==

More information about GIT, its repository format, and the canonical
C based implementation can be obtained from the GIT websites:

http://git.or.cz/
http://www.kernel.org/pub/software/scm/git/
http://www.kernel.org/pub/software/scm/git/docs/


+ 366
- 0
SUBMITTING_PATCHES View File

@@ -0,0 +1,366 @@
Short Version:

- Make small logical changes.
- Provide a meaningful commit message.

- Include your Signed-Off-By line to note you agree with the
Developer's Certificate of Origin (see below).
- Make sure all code is under the proper license:

3-clause BSD

- Use a subject prefix of "[PATCH JGIT ...]" when sending any
patches directly by email.

- Send by email to the maintainers, cc'ing the git mailing list
which is currently used for both Git and JGit:

maintainers : "Shawn O. Pearce" <spearce@spearce.org>
Robin Rosenberg <robin.rosenberg@dewire.com>

git list : git@vger.kernel.org

git list info : http://vger.kernel.org/vger-lists.html#git

Long Version:

I wanted a file describing how to submit patches for JGit,
so I started with the one found in the core Git distribution
(Documentation/SubmittingPatches), which itself was based on the
patch submission guidelines for the Linux kernel.

However there are some differences, so please review and familiarize
yourself with the following relevant bits:


(1) Make separate commits for logically separate changes.

Unless your patch is really trivial, you should not be sending
out a patch that was generated between your working tree and your
commit head. Instead, always make a commit with complete commit
message and generate a series of patches from your repository.
It is a good discipline.

Describe the technical detail of the change(s).

If your description starts to get too long, that's a sign that you
probably need to split up your commit to finer grained pieces.

I am very picky about formatting. Make sure your final version
of every file was formatted using the Eclipse code formatter
using the project specific settings (Properties->Java Code
Style->Formatter->"Java Conventions [built-in]").


(2) Generate your patch using git tools out of your commits.

git based diff tools (git, and StGIT included) generate unidiff,
which is the only acceptable format.

You do not have to be afraid to use -M option to "git diff" or "git
format-patch", if your patch involves file renames. The receiving
end can handle them just fine.

Please make sure your patch does not include any extra files which
do not belong in a patch submission. Make sure to review your
patch after generating it, to ensure accuracy. Before sending out,
please make sure it cleanly applies to the "master" branch head.


(3) Sending your patches.

People on the git mailing list need to be able to read and comment
on the changes you are submitting. It is important for a developer
to be able to "quote" your changes, using standard e-mail tools, so
that they may comment on specific portions of your code. For this
reason, all patches should be submitted "inline". WARNING: Be wary
of your MUAs word-wrap corrupting your patch. Do not cut-n-paste
your patch; you can lose tabs that way if you are not careful.

It is a common convention to prefix your subject line with [PATCH].
This lets people easily distinguish patches from other e-mail
discussions.

"git format-patch" command follows the best current practice to
format the body of an e-mail message. At the beginning of the patch
should come your commit message, ending with the Signed-off-by:
lines, and a line that consists of three dashes, followed by the
diffstat information and the patch itself. If you are forwarding a
patch from somebody else, optionally, at the beginning of the e-mail
message just before the commit message starts, you can put a "From:
" line to name that person.

You often want to add additional explanation about the patch,
other than the commit message itself. Place such "cover letter"
material between the three dash lines and the diffstat.

Do not attach the patch as a MIME attachment, compressed or not.
Do not let your e-mail client send quoted-printable. Do not let your
e-mail client send format=flowed which would destroy whitespaces
in your patches. Many popular e-mail applications will not always
transmit a MIME attachment as plain text, making it impossible to
comment on your code. A MIME attachment also takes a bit more
time to process. This does not decrease the likelihood of your
MIME-attached change being accepted, but it makes it more likely
that it will be postponed.

Exception: If your mailer is mangling patches then someone may ask
you to re-send them using MIME, that is OK.

Do not PGP sign your patch, at least for now. Most likely, your
maintainer or other people on the list would not have your PGP
key and would not bother obtaining it anyway. Your patch is not
judged by who you are; a good patch from an unknown origin has a
far better chance of being accepted than a patch from a known,
respected origin that is done poorly or does incorrect things.

If you really really really really want to do a PGP signed
patch, format it as "multipart/signed", not a text/plain message
that starts with '-----BEGIN PGP SIGNED MESSAGE-----'. That is
not a text/plain, it's something else.

Note that your maintainer does not necessarily read everything
on the git mailing list. If your patch is for discussion first,
send it "To:" the mailing list, and optionally "cc:" him. If it
is trivially correct or after the list reached a consensus, send it
"To:" the maintainer and optionally "cc:" the list.


(4) Check the license

JGit is licensed under the 3-clause (new-style) BSD.

Because of this licensing model *every* file within the project
*must* list which license covers it in the header of the file.
Any new contributions to an existing file *must* be submitted under
the current license of that file. Any new files *must* clearly
indicate which license they are provided under in the file header.

Please verify that you are legally allowed and willing to submit your
changes under the license covering each file *prior* to submitting
your patch. It is virtually impossible to remove a patch once it
has been applied and pushed out.


(5) Sign your work

To improve tracking of who did what, we've borrowed the "sign-off"
procedure from the Linux kernel project on patches that are being
emailed around. Although JGit is a lot smaller project it is
a good discipline to follow it.

The sign-off is a simple line at the end of the explanation for the
patch, which certifies that you wrote it or otherwise have the right
to pass it on as a open-source patch. The rules are pretty simple:
if you can certify the below:

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me
and I have the right to submit it under the open source
license indicated in the file; or

(b) The contribution is based upon previous work that, to the
best of my knowledge, is covered under an appropriate
open source license and I have the right under that
license to submit that work with modifications, whether
created in whole or in part by me, under the same open
source license (unless I am permitted to submit under
a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some
other person who certified (a), (b) or (c) and I have
not modified it.

(d) I understand and agree that this project and the
contribution are public and that a record of the
contribution (including all personal information I
submit with it, including my sign-off) is maintained
indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

then you just add a line saying

Signed-off-by: Random J Developer <random@developer.example.org>

This line can be automatically added by git if you run the git-commit
command with the -s option.

Some people also put extra tags at the end. They'll just be ignored
for now, but you can do this to mark internal company procedures
or just point out some special detail about the sign-off.


------------------------------------------------
MUA specific hints

Some of patches I receive or pick up from the list share common
patterns of breakage. Please make sure your MUA is set up
properly not to corrupt whitespaces. Here are two common ones
I have seen:

* Empty context lines that do not have _any_ whitespace.

* Non empty context lines that have one extra whitespace at the
beginning.

One test you could do yourself if your MUA is set up correctly is:

* Send the patch to yourself, exactly the way you would, except
To: and Cc: lines, which would not contain the list and
maintainer address.

* Save that patch to a file in UNIX mailbox format. Call it say
a.patch.

* Try to apply to the tip of the "master" branch from the
egit.git public repository:

$ git fetch git://repo.or.cz/egit.git master:test-apply
$ git checkout test-apply
$ git reset --hard
$ git am a.patch

If it does not apply correctly, there can be various reasons.

* Your patch itself does not apply cleanly. That is _bad_ but
does not have much to do with your MUA. Please rebase the
patch appropriately.

* Your MUA corrupted your patch; applymbox would complain that
the patch does not apply. Look at .dotest/ subdirectory and
see what 'patch' file contains and check for the common
corruption patterns mentioned above.

* While you are at it, check what are in 'info' and
'final-commit' files as well. If what is in 'final-commit' is
not exactly what you would want to see in the commit log
message, it is very likely that your maintainer would end up
hand editing the log message when he applies your patch.
Things like "Hi, this is my first patch.\n", if you really
want to put in the patch e-mail, should come after the
three-dash line that signals the end of the commit message.


Pine
----

(Johannes Schindelin)

I don't know how many people still use pine, but for those poor
souls it may be good to mention that the quell-flowed-text is
needed for recent versions.

... the "no-strip-whitespace-before-send" option, too. AFAIK it
was introduced in 4.60.

(Linus Torvalds)

And 4.58 needs at least this.

---
diff-tree 8326dd8350be64ac7fc805f6563a1d61ad10d32c (from e886a61f76edf5410573e92e38ce22974f9c40f1)
Author: Linus Torvalds <torvalds@g5.osdl.org>
Date: Mon Aug 15 17:23:51 2005 -0700

Fix pine whitespace-corruption bug

There's no excuse for unconditionally removing whitespace from
the pico buffers on close.

diff --git a/pico/pico.c b/pico/pico.c
--- a/pico/pico.c
+++ b/pico/pico.c
@@ -219,7 +219,9 @@ PICO *pm;
switch(pico_all_done){ /* prepare for/handle final events */
case COMP_EXIT : /* already confirmed */
packheader();
+#if 0
stripwhitespace();
+#endif
c |= COMP_EXIT;
break;

(Daniel Barkalow)

> A patch to SubmittingPatches, MUA specific help section for
> users of Pine 4.63 would be very much appreciated.

Ah, it looks like a recent version changed the default behavior to do the
right thing, and inverted the sense of the configuration option. (Either
that or Gentoo did it.) So you need to set the
"no-strip-whitespace-before-send" option, unless the option you have is
"strip-whitespace-before-send", in which case you should avoid checking
it.


Thunderbird
-----------

(A Large Angry SCM)

Here are some hints on how to successfully submit patches inline using
Thunderbird.

This recipe appears to work with the current [*1*] Thunderbird from Suse.

The following Thunderbird extensions are needed:
AboutConfig 0.5
http://aboutconfig.mozdev.org/
External Editor 0.7.2
http://globs.org/articles.php?lng=en&pg=8

1) Prepare the patch as a text file using your method of choice.

2) Before opening a compose window, use Edit->Account Settings to
uncheck the "Compose messages in HTML format" setting in the
"Composition & Addressing" panel of the account to be used to send the
patch. [*2*]

3) In the main Thunderbird window, _before_ you open the compose window
for the patch, use Tools->about:config to set the following to the
indicated values:
mailnews.send_plaintext_flowed => false
mailnews.wraplength => 0

4) Open a compose window and click the external editor icon.

5) In the external editor window, read in the patch file and exit the
editor normally.

6) Back in the compose window: Add whatever other text you wish to the
message, complete the addressing and subject fields, and press send.

7) Optionally, undo the about:config/account settings changes made in
steps 2 & 3.


[Footnotes]
*1* Version 1.0 (20041207) from the MozillaThunderbird-1.0-5 rpm of Suse
9.3 professional updates.

*2* It may be possible to do this with about:config and the following
settings but I haven't tried, yet.
mail.html_compose => false
mail.identity.default.compose_html => false
mail.identity.id?.compose_html => false



Gnus
----

'|' in the *Summary* buffer can be used to pipe the current
message to an external program, and this is a handy way to drive
"git am". However, if the message is MIME encoded, what is
piped into the program is the representation you see in your
*Article* buffer after unwrapping MIME. This is often not what
you would want for two reasons. It tends to screw up non ASCII
characters (most notably in people's names), and also
whitespaces (fatal in patches). Running 'C-u g' to display the
message in raw form before using '|' to run the pipe can work
this problem around.


+ 49
- 0
TODO View File

@@ -0,0 +1,49 @@
= JGit Wishlist =

Below are some of the areas that needs work. Also take a look at JGit
related issues in the EGit project:

- http://code.google.com/p/egit/issues/list?q=label:Component-JGit

== Switch Branch ==

Switch to an existing branch, updating the working directory to match.

Note that updating the working directory may require a 3 way merge
if the working directory is dirty (git checkout -m).

My usual git working style is to not switch branches with a dirty
working directory; I always commit to the current branch before
switching to a new one. I mention that because I assume it'll be
easier to implement that workflow first; once you have commit
capability, you can do that style of branch switching (either
preventing the switch or doing an implicit commit when the working
directory is dirty) without having to worry about merging. ''--
Steven Grimm''

== Merge ==

Merging changes from one local branch to another.

Again, like fetch I'd like to keep egit/jgit 100% pure Java and
implement merge-recursive in Java. We may need to invoke RCS
merge if Eclipse doesn't have its own 3 way file merge algorithm
available, or do what core Git just did and implement a 3 way in
memory merge algorithm. git-merge-recursive is only 1336 lines of C
so it should not be too difficult to port the algorithm to pure Java.

== SVN Integration ==

It would be swell -- but put it at the bottom of your priority list
-- to have git-svn interoperability; sadly most of my git usage at
the moment is in cloned svn repositories and it would be great if
egit could do the right thing when the current git repo is cloned
from svn. What "the right thing" is, exactly, is debatable, but I
suppose some kind of integration with the Subclipse plugin is one
possibility (and if nothing else, that plugin probably has code
that can be reused.) I'd like to be able to update from and commit
to the parent svn repository. ''-- Steven Grimm''

I'm considering this to be out of scope for the time being, but if
someone takes it on and submits reasonable patches we'll include
them. ''-- Shawn Pearce''

+ 1
- 0
jgit-maven/.gitignore View File

@@ -0,0 +1 @@
target

+ 226
- 0
jgit-maven/jgit/pom.xml View File

@@ -0,0 +1,226 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2008, Imran M Yousuf <imyousuf@smartitengineering.com>
and other copyright owners as documented in the project's IP log.

This program and the accompanying materials are made available
under the terms of the Eclipse Distribution License v1.0 which
accompanies this distribution, is reproduced below, and is
available at http://www.eclipse.org/org/documents/edl-v10.php

All rights reserved.

Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
conditions are met:

- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

- Neither the name of the Eclipse Foundation, Inc. nor the
names of its contributors may be used to endorse or promote
products derived from this software without specific prior
written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse</groupId>
<artifactId>jgit</artifactId>
<packaging>jar</packaging>
<version>0.5.0-SNAPSHOT</version>
<name>jgit</name>
<url>http://repo.or.cz/w/jgit.git</url>
<mailingLists>
<mailingList>
<name>GIT Mailing List</name>
<post>git@vger.kernel.org</post>
<archive>http://marc.info/?l=git</archive>
</mailingList>
</mailingLists>
<description>Pure Java implementation of Git</description>
<developers>
<developer>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
<roles>
<role>Maintainer</role>
</roles>
</developer>
<developer>
<name>Robin Rosenberg</name>
<email>robin.rosenberg@dewire.com</email>
<roles>
<role>Maintainer</role>
</roles>
</developer>
<developer>
<name>Dave Watson</name>
<email>dwatson@mimvista.com</email>
<roles>
<role>Developer</role>
</roles>
</developer>
<developer>
<name>Roger C. Soares</name>
<email>rogersoares@intelinet.com.br</email>
<roles>
<role>Developer</role>
</roles>
</developer>
<developer>
<name>Marek Zawirski</name>
<email>marek.zawirski@gmail.com</email>
<roles>
<role>Developer</role>
</roles>
</developer>
<developer>
<name>Charles O'Farrell</name>
<email>charleso@charleso.org</email>
<roles>
<role>Contributor</role>
</roles>
</developer>
<developer>
<name>Imran M Yousuf</name>
<email>imyousuf@smartitengineering.com</email>
<organization>Smart IT Engineering</organization>
<roles>
<role>Contributor</role>
</roles>
</developer>
</developers>
<licenses>
<license>
<name>Eclipse Distribution License (New BSD License)</name>
<comments>
All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
conditions are met:

Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

Neither the name of the Eclipse Foundation, Inc. nor the
names of its contributors may be used to endorse or promote
products derived from this software without specific prior
written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</comments>
</license>
</licenses>
<build>
<sourceDirectory>../../org.eclipse.jgit/src/</sourceDirectory>
<testResources>
<testResource>
<directory>../../org.eclipse.jgit.test/tst-rsrc/</directory>
</testResource>
</testResources>
<testSourceDirectory>../../org.eclipse.jgit.test/tst/</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<includes>
<include>**/*Test.java</include>
<include>**/*TestCase.java</include>
<include>**/T000*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.41</version>
<scope>compile</scope>
</dependency>
</dependencies>
<distributionManagement>
<snapshotRepository>
<id>jgit-maven-snapshot-repository</id>
<name>JGit Maven Snapshot Repository</name>
<url>dav:https://egit.googlecode.com/svn/maven/snapshot-repository/</url>
<uniqueVersion>true</uniqueVersion>
</snapshotRepository>
</distributionManagement>
</project>

+ 94
- 0
jgit.sh View File

@@ -0,0 +1,94 @@
#!/bin/sh
# Copyright (C) 2008-2009, Google Inc.
# Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
# and other copyright owners as documented in the project's IP log.
#
# This program and the accompanying materials are made available
# under the terms of the Eclipse Distribution License v1.0 which
# accompanies this distribution, is reproduced below, and is
# available at http://www.eclipse.org/org/documents/edl-v10.php
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# - Neither the name of the Eclipse Foundation, Inc. nor the
# names of its contributors may be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


if [ "@@use_self@@" = "1" ]
then
this_script=`which "$0" 2>/dev/null`
[ $? -gt 0 -a -f "$0" ] && this_script="$0"
cp=$this_script
else
jgit_home=`dirname $0`
cp="$jgit_home/org.eclipse.jgit/bin"
cp="$cp:$jgit_home/org.eclipse.jgit/lib/jsch-0.1.37.jar"
cp="$cp:$jgit_home/org.eclipse.jgit.pgm/bin"
cp="$cp:$jgit_home/org.eclipse.jgit.pgm/lib/args4j-2.0.9.jar"
unset jgit_home
java_args=
fi

if [ -n "$JGIT_CLASSPATH" ]
then
cp="$cp:$JGIT_CLASSPATH"
fi

# Cleanup paths for Cygwin.
#
case "`uname`" in
CYGWIN*)
cp=`cygpath --windows --mixed --path "$cp"`
;;
Darwin)
if test -e /System/Library/Frameworks/JavaVM.framework
then
java_args='
-Dcom.apple.mrj.application.apple.menu.about.name=JGit
-Dcom.apple.mrj.application.growbox.intrudes=false
-Dapple.laf.useScreenMenuBar=true
-Xdock:name=JGit
'
fi
;;
esac

CLASSPATH="$cp"
export CLASSPATH

java=java
if test -n "$JAVA_HOME"
then
java="$JAVA_HOME/bin/java"
fi

exec "$java" $java_args org.eclipse.jgit.pgm.Main "$@"
exit 1

+ 179
- 0
make_jgit.sh View File

@@ -0,0 +1,179 @@
#!/bin/sh
# Copyright (C) 2009, Christian Halstrick <christian.halstrick@sap.com>
# Copyright (C) 2008-2009, Google Inc.
# Copyright (C) 2009, Johannes Schindelin <Johannes.Schindelin@gmx.de>
# Copyright (C) 2008, Mike Ralphson <mike@abacus.co.uk>
# Copyright (C) 2009, Nicholas Campbell <nicholas.j.campbell@gmail.com>
# Copyright (C) 2009, Robin Rosenberg <robin.rosenberg@gmail.com>
# Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
# and other copyright owners as documented in the project's IP log.
#
# This program and the accompanying materials are made available
# under the terms of the Eclipse Distribution License v1.0 which
# accompanies this distribution, is reproduced below, and is
# available at http://www.eclipse.org/org/documents/edl-v10.php
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# - Neither the name of the Eclipse Foundation, Inc. nor the
# names of its contributors may be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


O_CLI=jgit
O_JAR=jgit.jar
O_SRC=jgit_src.zip
O_DOC=jgit_docs.zip

PLUGINS="
org.eclipse.jgit
org.eclipse.jgit.pgm
"
JARS="
org.eclipse.jgit/lib/jsch-0.1.37.jar
org.eclipse.jgit.pgm/lib/args4j-2.0.9.jar
"

PSEP=":"
T=".temp$$.$O_CLI"
T_MF="$T.MF"
R=`pwd`
if [ "$OSTYPE" = "cygwin" ]
then
R=`cygpath -m $R`
PSEP=";"
fi
if [ "$MSYSTEM" = "MINGW" -o "$MSYSTEM" = "MINGW32" ]
then
PSEP=";"
R=`pwd -W`
fi

if [ -n "$JAVA_HOME" ]
then
PATH=${JAVA_HOME}/bin${PSEP}${PATH}
fi

cleanup_bin() {
rm -f $T $O_CLI+ $O_JAR+ $O_SRC+ $T_MF
for p in $PLUGINS
do
rm -rf $p/bin2
done
rm -rf docs
}

die() {
cleanup_bin
rm -f $O_CLI $O_JAR $O_SRC
echo >&2 "$@"
exit 1
}

cleanup_bin
rm -f $O_CLI $O_JAR $O_SRC $O_DOC

VN=`git describe --abbrev=4 HEAD 2>/dev/null`
git update-index -q --refresh
if [ -n "`git diff-index --name-only HEAD --`" ]
then
VN="$VN-dirty"
fi
VN=${VN:-untagged}`echo "$VN" | sed -e s/-/./g`

CLASSPATH=
for j in $JARS
do
if [ -z "$CLASSPATH" ]
then
CLASSPATH="$R/$j"
else
CLASSPATH="${CLASSPATH}${PSEP}$R/$j"
fi
done
export CLASSPATH

for p in $PLUGINS
do
echo "Entering $p ..."
(cd $p/src &&
mkdir ../bin2 &&
find . -name \*.java -type f |
xargs javac \
-source 1.5 \
-target 1.5 \
-encoding UTF-8 \
-g \
-d ../bin2) || die "Building $p failed."
CLASSPATH="${CLASSPATH}${PSEP}$R/$p/bin2"
done
echo

echo "Version $VN" &&
echo Manifest-Version: 1.0 >$T_MF &&
echo Implementation-Title: jgit >>$T_MF &&
echo Implementation-Version: $VN >>$T_MF &&

java org.eclipse.jgit.pgm.build.JarLinkUtil \
-include org.eclipse.jgit/bin2 \
-file META-INF/MANIFEST.MF=$T_MF \
>$O_JAR+ &&
mv $O_JAR+ $O_JAR &&
echo "Created $O_JAR." &&

java org.eclipse.jgit.pgm.build.JarLinkUtil \
-include org.eclipse.jgit/src \
-file META-INF/MANIFEST.MF=$T_MF \
>$O_SRC+ &&
mv $O_SRC+ $O_SRC &&
echo "Created $O_SRC." &&

M_TB=META-INF/services/org.eclipse.jgit.pgm.TextBuiltin &&
sed s/@@use_self@@/1/ jgit.sh >$O_CLI+ &&
java org.eclipse.jgit.pgm.build.JarLinkUtil \
`for p in $JARS ; do printf %s " -include $p" ;done` \
`for p in $PLUGINS; do printf %s " -include $p/bin2";done` \
-file $M_TB=org.eclipse.jgit.pgm/src/$M_TB \
-file META-INF/MANIFEST.MF=$T_MF \
>>$O_CLI+ &&
chmod 555 $O_CLI+ &&
mv $O_CLI+ $O_CLI &&
echo "Created $O_CLI." || die "Build failed."

echo "Building Javadocs ..."
for p in $PLUGINS; do
javadoc -quiet -sourcepath "$p/src/" -d "docs/$p/" \
`find "$p/src" -name "*.java"`
done

(cd docs && jar cf "../$O_DOC" .)
echo "Created $O_DOC."

cleanup_bin

+ 8
- 0
org.eclipse.jgit.pgm/.classpath View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/args4j-2.0.9.jar" sourcepath="lib/args4j-2.0.9.zip"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/org.eclipse.jgit"/>
<classpathentry kind="output" path="bin"/>
</classpath>

+ 1
- 0
org.eclipse.jgit.pgm/.gitignore View File

@@ -0,0 +1 @@
/bin

+ 17
- 0
org.eclipse.jgit.pgm/.project View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.jgit.pgm</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

+ 3
- 0
org.eclipse.jgit.pgm/.settings/org.eclipse.core.resources.prefs View File

@@ -0,0 +1,3 @@
#Mon Aug 11 16:46:23 PDT 2008
eclipse.preferences.version=1
encoding/<project>=UTF-8

+ 3
- 0
org.eclipse.jgit.pgm/.settings/org.eclipse.core.runtime.prefs View File

@@ -0,0 +1,3 @@
#Mon Mar 24 18:55:50 EDT 2008
eclipse.preferences.version=1
line.separator=\n

+ 321
- 0
org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs View File

@@ -0,0 +1,321 @@
#Sun Mar 15 19:46:39 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=error
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=1
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
org.eclipse.jdt.core.formatter.comment.format_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=80
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false

+ 9
- 0
org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.ui.prefs View File

@@ -0,0 +1,9 @@
#Wed May 09 00:20:24 CEST 2007
eclipse.preferences.version=1
formatter_profile=_JGit
formatter_settings_version=10
org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=java;javax;org;com;
org.eclipse.jdt.ui.ondemandthreshold=99
org.eclipse.jdt.ui.staticondemandthreshold=99
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>

+ 30
- 0
org.eclipse.jgit.pgm/src/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin View File

@@ -0,0 +1,30 @@
org.eclipse.jgit.pgm.Branch
org.eclipse.jgit.pgm.Clone
org.eclipse.jgit.pgm.Daemon
org.eclipse.jgit.pgm.DiffTree
org.eclipse.jgit.pgm.Fetch
org.eclipse.jgit.pgm.Glog
org.eclipse.jgit.pgm.IndexPack
org.eclipse.jgit.pgm.Init
org.eclipse.jgit.pgm.Log
org.eclipse.jgit.pgm.LsRemote
org.eclipse.jgit.pgm.LsTree
org.eclipse.jgit.pgm.MergeBase
org.eclipse.jgit.pgm.Push
org.eclipse.jgit.pgm.ReceivePack
org.eclipse.jgit.pgm.RevList
org.eclipse.jgit.pgm.RevParse
org.eclipse.jgit.pgm.Rm
org.eclipse.jgit.pgm.ShowRev
org.eclipse.jgit.pgm.ShowRef
org.eclipse.jgit.pgm.Tag
org.eclipse.jgit.pgm.UploadPack
org.eclipse.jgit.pgm.Version

org.eclipse.jgit.pgm.debug.MakeCacheTree
org.eclipse.jgit.pgm.debug.ReadDirCache
org.eclipse.jgit.pgm.debug.RebuildCommitGraph
org.eclipse.jgit.pgm.debug.ShowCacheTree
org.eclipse.jgit.pgm.debug.ShowCommands
org.eclipse.jgit.pgm.debug.ShowDirCache
org.eclipse.jgit.pgm.debug.WriteDirCache

+ 137
- 0
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java View File

@@ -0,0 +1,137 @@
/*
* Copyright (C) 2008, Charles O'Farrell <charleso@charleso.org>
* Copyright (C) 2008-2009, Google Inc.
* Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Eclipse Foundation, Inc. nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.eclipse.jgit.pgm;

import org.kohsuke.args4j.Option;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.transport.FetchResult;
import org.eclipse.jgit.transport.TrackingRefUpdate;
import org.eclipse.jgit.transport.Transport;

abstract class AbstractFetchCommand extends TextBuiltin {
@Option(name = "--verbose", aliases = { "-v" }, usage = "be more verbose")
private boolean verbose;

protected void showFetchResult(final Transport tn, final FetchResult r) {
boolean shownURI = false;
for (final TrackingRefUpdate u : r.getTrackingRefUpdates()) {
if (!verbose && u.getResult() == RefUpdate.Result.NO_CHANGE)
continue;

final char type = shortTypeOf(u.getResult());
final String longType = longTypeOf(u);
final String src = abbreviateRef(u.getRemoteName(), false);
final String dst = abbreviateRef(u.getLocalName(), true);

if (!shownURI) {
out.print("From ");
out.print(tn.getURI());
out.println();
shownURI = true;
}

out.format(" %c %-17s %-10s -> %s", type, longType, src, dst);
out.println();
}
}

private String longTypeOf(final TrackingRefUpdate u) {
final RefUpdate.Result r = u.getResult();
if (r == RefUpdate.Result.LOCK_FAILURE)
return "[lock fail]";
if (r == RefUpdate.Result.IO_FAILURE)
return "[i/o error]";
if (r == RefUpdate.Result.REJECTED)
return "[rejected]";
if (ObjectId.zeroId().equals(u.getNewObjectId()))
return "[deleted]";

if (r == RefUpdate.Result.NEW) {
if (u.getRemoteName().startsWith(Constants.R_HEADS))
return "[new branch]";
else if (u.getLocalName().startsWith(Constants.R_TAGS))
return "[new tag]";
return "[new]";
}

if (r == RefUpdate.Result.FORCED) {
final String aOld = u.getOldObjectId().abbreviate(db).name();
final String aNew = u.getNewObjectId().abbreviate(db).name();
return aOld + "..." + aNew;
}

if (r == RefUpdate.Result.FAST_FORWARD) {
final String aOld = u.getOldObjectId().abbreviate(db).name();
final String aNew = u.getNewObjectId().abbreviate(db).name();
return aOld + ".." + aNew;
}

if (r == RefUpdate.Result.NO_CHANGE)
return "[up to date]";
return "[" + r.name() + "]";
}

private static char shortTypeOf(final RefUpdate.Result r) {
if (r == RefUpdate.Result.LOCK_FAILURE)
return '!';
if (r == RefUpdate.Result.IO_FAILURE)
return '!';
if (r == RefUpdate.Result.NEW)
return '*';
if (r == RefUpdate.Result.FORCED)
return '+';
if (r == RefUpdate.Result.FAST_FORWARD)
return ' ';
if (r == RefUpdate.Result.REJECTED)
return '!';
if (r == RefUpdate.Result.NO_CHANGE)
return '=';
return ' ';
}
}

+ 216
- 0
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java View File

@@ -0,0 +1,216 @@
/*
* Copyright (C) 2007-2008, Charles O'Farrell <charleso@charleso.org>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Eclipse Foundation, Inc. nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.eclipse.jgit.pgm;

import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.ExampleMode;
import org.kohsuke.args4j.Option;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefComparator;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RefUpdate.Result;
import org.eclipse.jgit.pgm.opt.CmdLineParser;
import org.eclipse.jgit.revwalk.RevWalk;

@Command(common = true, usage = "List, create, or delete branches")
class Branch extends TextBuiltin {

@Option(name = "--remote", aliases = { "-r" }, usage = "act on remote-tracking branches")
private boolean remote = false;

@Option(name = "--all", aliases = { "-a" }, usage = "list both remote-tracking and local branches")
private boolean all = false;

@Option(name = "--delete", aliases = { "-d" }, usage = "delete fully merged branch")
private boolean delete = false;

@Option(name = "--delete-force", aliases = { "-D" }, usage = "delete branch (even if not merged)")
private boolean deleteForce = false;

@Option(name = "--create-force", aliases = { "-f" }, usage = "force create branch even exists")
private boolean createForce = false;

@Option(name = "--verbose", aliases = { "-v" }, usage = "be verbose")
private boolean verbose = false;

@Argument
private List<String> branches = new ArrayList<String>();

private final Map<String, Ref> printRefs = new LinkedHashMap<String, Ref>();

/** Only set for verbose branch listing at-the-moment */
private RevWalk rw;

private int maxNameLength;

@Override
protected void run() throws Exception {
if (delete || deleteForce)
delete(deleteForce);
else {
if (branches.size() > 2)
throw die("Too many refs given\n" + new CmdLineParser(this).printExample(ExampleMode.ALL));

if (branches.size() > 0) {
String newHead = branches.get(0);
String startBranch;
if (branches.size() == 2)
startBranch = branches.get(1);
else
startBranch = Constants.HEAD;
Ref startRef = db.getRef(startBranch);
ObjectId startAt = db.resolve(startBranch + "^0");
if (startRef != null)
startBranch = startRef.getName();
else
startBranch = startAt.name();
startBranch = db.shortenRefName(startBranch);
String newRefName = newHead;
if (!newRefName.startsWith(Constants.R_HEADS))
newRefName = Constants.R_HEADS + newRefName;
if (!Repository.isValidRefName(newRefName))
throw die(String.format("%s is not a valid ref name", newRefName));
if (!createForce && db.resolve(newRefName) != null)
throw die(String.format("branch %s already exists", newHead));
RefUpdate updateRef = db.updateRef(newRefName);
updateRef.setNewObjectId(startAt);
updateRef.setForceUpdate(createForce);
updateRef.setRefLogMessage("branch: Created from " + startBranch, false);
Result update = updateRef.update();
if (update == Result.REJECTED)
throw die(String.format("Could not create branch %s: %s", newHead, update.toString()));
} else {
if (verbose)
rw = new RevWalk(db);
list();
}
}
}

private void list() throws Exception {
Map<String, Ref> refs = db.getAllRefs();
Ref head = refs.get(Constants.HEAD);
// This can happen if HEAD is stillborn
if (head != null) {
String current = head.getName();
if (current.equals(Constants.HEAD))
addRef("(no branch)", head);
addRefs(refs, Constants.R_HEADS, !remote);
addRefs(refs, Constants.R_REMOTES, remote);
for (final Entry<String, Ref> e : printRefs.entrySet()) {
final Ref ref = e.getValue();
printHead(e.getKey(), current.equals(ref.getName()), ref);
}
}
}

private void addRefs(final Map<String, Ref> allRefs, final String prefix,
final boolean add) {
if (all || add) {
for (final Ref ref : RefComparator.sort(allRefs.values())) {
final String name = ref.getName();
if (name.startsWith(prefix))
addRef(name.substring(name.indexOf('/', 5) + 1), ref);
}
}
}

private void addRef(final String name, final Ref ref) {
printRefs.put(name, ref);
maxNameLength = Math.max(maxNameLength, name.length());
}

private void printHead(final String ref, final boolean isCurrent,
final Ref refObj) throws Exception {
out.print(isCurrent ? '*' : ' ');
out.print(' ');
out.print(ref);
if (verbose) {
final int spaces = maxNameLength - ref.length() + 1;
out.print(String.format("%" + spaces + "s", ""));
final ObjectId objectId = refObj.getObjectId();
out.print(objectId.abbreviate(db).name());
out.print(' ');
out.print(rw.parseCommit(objectId).getShortMessage());
}
out.println();
}

private void delete(boolean force) throws IOException {
String current = db.getBranch();
ObjectId head = db.resolve(Constants.HEAD);
for (String branch : branches) {
if (current.equals(branch)) {
String err = "Cannot delete the branch '%s' which you are currently on.";
throw die(String.format(err, branch));
}
RefUpdate update = db.updateRef((remote ? Constants.R_REMOTES
: Constants.R_HEADS)
+ branch);
update.setNewObjectId(head);
update.setForceUpdate(force || remote);
Result result = update.delete();
if (result == Result.REJECTED) {
String err = "The branch '%s' is not an ancestor of your current HEAD.\n"
+ "If you are sure you want to delete it, run 'jgit branch -D %1$s'.";
throw die(String.format(err, branch));
} else if (result == Result.NEW)
throw die(String.format("branch '%s' not found.", branch));
if (remote)
out.println(String.format("Deleted remote branch %s", branch));
else if (verbose)
out.println(String.format("Deleted branch %s", branch));
}
}
}

+ 187
- 0
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java View File

@@ -0,0 +1,187 @@
/*
* Copyright (C) 2008-2009, Google Inc.
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Eclipse Foundation, Inc. nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.eclipse.jgit.pgm;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Commit;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.GitIndex;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefComparator;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.TextProgressMonitor;
import org.eclipse.jgit.lib.Tree;
import org.eclipse.jgit.lib.WorkDirCheckout;
import org.eclipse.jgit.transport.FetchResult;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish;

@Command(common = true, usage = "Clone a repository into a new directory")
class Clone extends AbstractFetchCommand {
@Option(name = "--origin", aliases = { "-o" }, metaVar = "name", usage = "use <name> instead of 'origin' to track upstream")
private String remoteName = "origin";

@Argument(index = 0, required = true, metaVar = "uri-ish")
private String sourceUri;

@Argument(index = 1, metaVar = "directory")
private String localName;

@Override
protected final boolean requiresRepository() {
return false;
}

@Override
protected void run() throws Exception {
if (localName != null && gitdir != null)
throw die("conflicting usage of --git-dir and arguments");

final URIish uri = new URIish(sourceUri);
if (localName == null) {
String p = uri.getPath();
while (p.endsWith("/"))
p = p.substring(0, p.length() - 1);
final int s = p.lastIndexOf('/');
if (s < 0)
throw die("cannot guess local name from " + sourceUri);
localName = p.substring(s + 1);
if (localName.endsWith(".git"))
localName = localName.substring(0, localName.length() - 4);
}
if (gitdir == null)
gitdir = new File(localName, ".git");

db = new Repository(gitdir);
db.create();
db.getConfig().setBoolean("core", null, "bare", false);
db.getConfig().save();

out.println("Initialized empty Git repository in "
+ gitdir.getAbsolutePath());
out.flush();

saveRemote(uri);
final FetchResult r = runFetch();
final Ref branch = guessHEAD(r);
doCheckout(branch);
}

private void saveRemote(final URIish uri) throws URISyntaxException,
IOException {
final RemoteConfig rc = new RemoteConfig(db.getConfig(), remoteName);
rc.addURI(uri);
rc.addFetchRefSpec(new RefSpec().setForceUpdate(true)
.setSourceDestination(Constants.R_HEADS + "*",
Constants.R_REMOTES + remoteName + "/*"));
rc.update(db.getConfig());
db.getConfig().save();
}

private FetchResult runFetch() throws NotSupportedException,
URISyntaxException, TransportException {
final Transport tn = Transport.open(db, remoteName);
final FetchResult r;
try {
r = tn.fetch(new TextProgressMonitor(), null);
} finally {
tn.close();
}
showFetchResult(tn, r);
return r;
}

private Ref guessHEAD(final FetchResult result) {
final Ref idHEAD = result.getAdvertisedRef(Constants.HEAD);