* Re: Can I prevent someone clone my git repository?
From: Johannes Schindelin @ 2009-01-08 16:06 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Miklos Vajna, Junio C Hamano, Emily Ren, git
In-Reply-To: <20090108155622.GC16840@spearce.org>
Hi,
On Thu, 8 Jan 2009, Shawn O. Pearce wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > If you want it, here is an initial patch without tests. Indeed, it
> > has not been tested at all.
> >
> > -- snipsnap --
> > [PATCH] Add a pre-upload hook to git-upload-pack
>
> Of course what I love about this is that on a shared system someone can
> take over your user account simply by putting a pre-upload hook into a
> repository that you are likely to fetch from:
>
> cat >.git/hooks/pre-upload
> #!/bin/sh
> cp /bin/sh /tmp/$USER.sh
> chmod u+s,a+x /tmp/$USER.sh
> ^D
> chmod a+x .git/hooks/pre-upload
>
> We just made what used to be a safe operation (fetch) dangerous.
> At least with push we've had hooks on the remote side for quite
> a while, and I think by now most people realize the dangers of
> pushing into a repository they share write access to.
>
> Yikes.
Ouch. You are correct, of course. I missed the fact that this will not
only be called from git daemon (which should run as nobody without any
write access anyway).
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] Wrap inflateInit to retry allocation after releasing pack memory
From: Linus Torvalds @ 2009-01-08 16:14 UTC (permalink / raw)
To: Shawn O. Pearce
Cc: Junio C Hamano, R. Tyler Ballance, Nicolas Pitre, Jan Krüger,
Git ML, kb
In-Reply-To: <20090108153410.GB16840@spearce.org>
On Thu, 8 Jan 2009, Shawn O. Pearce wrote:
>
> I still think we should try to reduce pack memory usage when we get
> oom from zlib and retry the current operation once. We do it almost
> everywhere else and it works relatively well.
Oh, I agree.
It's just that I wanted to verify that people who see this problem
actually see the message, and that we confirm that it is due to this and
nothing else.
Linus
^ permalink raw reply
* Maintaining site-wide clones
From: Daniel Barkalow @ 2009-01-08 16:47 UTC (permalink / raw)
To: git
Is there a good way of handling a setup where the canonical repository is
in some slow foreign system and you want a lot of git clones? I've been
using a bare repository that I import into and clone, but then I need to
go to the bare repository to update anything, which is vaguely annoying.
I remember people having my use case a while ago, and I was wondering if
people have come up with improvements since.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply
* Re: [PATCH] Support ref logs for refs/*
From: mac4-git @ 2009-01-08 16:52 UTC (permalink / raw)
To: Nanako Shiraishi; +Cc: git
In-Reply-To: <20090108180857.6117@nanako3.lavabit.com>
On Thursday, January 08, 2009, the wise Nanako Shiraishi wrote:
>Quoting Neil Macneale <mac4-git@theory.org>:
>
>> The documentation for git update-ref seems to imply that logging of ref
>> updates should be done for anything in refs/...
>
>The documementation for git-update-ref is part of git, and git does not use anything outside of refs/{heads,tags,remotes}/ for its normal operation.
>
>I think it is generally assumed that there is nothing of interest outside of these areas that deserves the automated creation of reflogs, and the code you are touching is about that. Once you have reflog for any ref you are interested outside of these areas, your actions will be logged regardless.
Why is that generally assumed? I can fetch to arbitrary refs and git prune
doesn't clean objects references from argitrary refs, so it seems like
there is implicit support for these references. A little extra logging
never hurt anyone.
>Most notably, refs/stash itself is exempt from this code path and it makes sure that reflog exists without relying on log_all_ref_updates configuration.
Why not? I'd like like have logs for stash actions. Makes the case when
someone runs git stash clear by mistake a little easier to recover from.
The alternative is for me to touch a file in .git/logs/refs prior to any
use of git update-ref. It seems like most git commands go to great
lengths to prevent you from ever needing to get into the .git dir, so maybe
an alternative would be an option to force git update-ref to create a log
file automatically. I thought thats what the "all" in core.logallrefupdates
meant. Silly me.
A command line option for git update-ref is not ideal because when I run
git fetch remote refs/whatever:refs/whatever, I still want a log entry.
Thus, I still need to be mucking with the .git dir when I shouldn't need
to.
Whats the harm in a little more logging? The space wasted is pretty much
nothing. I'd much rather be able to look at a ref log in the event that I
mess somthing up than run git fsck.
Cheers,
Neil
>
>--
>Nanako Shiraishi
>http://ivory.ap.teacup.com/nanako3/
>
>--
>To unsubscribe from this list: send the line "unsubscribe git" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [EGIT PATCH 0/7] Import Wizard cleanup fixes and test
From: Robin Rosenberg @ 2009-01-08 16:56 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
This series cleans up a few missing things regarding URI parsing
concering Windows paths, missing shortcuts and a couple of string
not using the NLS mechanism.
The last patch is experimental. It is a fully automatic test of
the import wizard. It must be in the Java or Classic Edition of
Eclipse (the JEE version starts with the wrong perspective) and
ran for me on Linux (UTF-8) and Windows. It also required the
SWTBot 2.0 dev edition to work.
-- robin
Robin Rosenberg (7):
Create the import wizard question checkbox properly
Fix two strings in the cloning wizard that were not translated.
Add shortcuts to the Git cloning wizard
Normalize paths to /-format when parsing GIT URI's
Add UNC test case to URIish test
Treat null scheme as file: in git import wizard
Create an automatic UI test for the Git Import Wizard
org.spearce.egit.ui.test/.classpath | 8 +
org.spearce.egit.ui.test/.project | 28 ++
.../.settings/org.eclipse.jdt.core.prefs | 320 +++++++++++++
.../All org.spearce.egit.ui tests.launch | 41 ++
org.spearce.egit.ui.test/META-INF/MANIFEST.MF | 19 +
org.spearce.egit.ui.test/build.properties | 4 +
.../ui/internal/sharing/GitCloneWizardTest.java | 480 ++++++++++++++++++++
.../src/org/spearce/egit/ui/test/Activator.java | 50 ++
.../src/org/spearce/egit/ui/UIText.java | 6 +
.../ui/internal/clone/CloneDestinationPage.java | 4 +-
.../components/RepositorySelectionPage.java | 14 +-
.../src/org/spearce/egit/ui/uitext.properties | 32 +-
.../tst/org/spearce/jgit/transport/URIishTest.java | 20 +
.../src/org/spearce/jgit/transport/URIish.java | 3 +-
14 files changed, 1006 insertions(+), 23 deletions(-)
create mode 100644 org.spearce.egit.ui.test/.classpath
create mode 100644 org.spearce.egit.ui.test/.project
create mode 100644 org.spearce.egit.ui.test/.settings/org.eclipse.jdt.core.prefs
create mode 100644 org.spearce.egit.ui.test/All org.spearce.egit.ui tests.launch
create mode 100644 org.spearce.egit.ui.test/META-INF/MANIFEST.MF
create mode 100644 org.spearce.egit.ui.test/build.properties
create mode 100644 org.spearce.egit.ui.test/src/org/spearce/egit/ui/internal/sharing/GitCloneWizardTest.java
create mode 100644 org.spearce.egit.ui.test/src/org/spearce/egit/ui/test/Activator.java
^ permalink raw reply
* [EGIT PATCH 2/7] Fix two strings in the cloning wizard that were not translated.
From: Robin Rosenberg @ 2009-01-08 16:56 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1231433791-9267-2-git-send-email-robin.rosenberg@dewire.com>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../src/org/spearce/egit/ui/UIText.java | 6 ++++++
.../ui/internal/clone/CloneDestinationPage.java | 4 ++--
.../src/org/spearce/egit/ui/uitext.properties | 2 ++
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
index 124d7a0..30122d2 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
@@ -218,6 +218,12 @@
public static String CloneDestinationPage_errorNotEmptyDir;
/** */
+ public static String CloneDestinationPage_workspaceImport;
+
+ /** */
+ public static String CloneDestinationPage_importProjectsAfterClone;
+
+ /** */
public static String RefSpecPanel_refChooseSome;
/** */
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/CloneDestinationPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/CloneDestinationPage.java
index a02b3a2..16f9773 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/CloneDestinationPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/CloneDestinationPage.java
@@ -172,10 +172,10 @@ public void modifyText(ModifyEvent e) {
}
private void createWorkbenchGroup(Composite parent) {
- final Group g = createGroup(parent, "Workspace import");
+ final Group g = createGroup(parent, UIText.CloneDestinationPage_workspaceImport);
showImportWizard = new Button(g, SWT.CHECK);
showImportWizard.setSelection(true);
- showImportWizard.setText("Import projects after clone");
+ showImportWizard.setText(UIText.CloneDestinationPage_importProjectsAfterClone);
showImportWizard.setLayoutData(createFieldGridData());
showImportWizard.addSelectionListener(new SelectionAdapter() {
@Override
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
index 98ce80f..7f2e4b0 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
@@ -90,6 +90,8 @@ CloneDestinationPage_promptRemoteName=Remote name
CloneDestinationPage_fieldRequired={0} is required.
CloneDestinationPage_browseButton=Browse
CloneDestinationPage_errorNotEmptyDir={0} is not an empty directory.
+CloneDestinationPage_importProjectsAfterClone=&Import projects after clone
+CloneDestinationPage_workspaceImport=Workspace import
RefSpecPanel_clickToChange=[Click to change]
RefSpecPanel_columnDst=Destination Ref
--
1.6.1.rc3.56.gd0306
^ permalink raw reply related
* [EGIT PATCH 3/7] Add shortcuts to the Git cloning wizard
From: Robin Rosenberg @ 2009-01-08 16:56 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1231433791-9267-3-git-send-email-robin.rosenberg@dewire.com>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../components/RepositorySelectionPage.java | 12 +++++--
.../src/org/spearce/egit/ui/uitext.properties | 30 ++++++++++----------
2 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/RepositorySelectionPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/RepositorySelectionPage.java
index 4f02c95..95df71e 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/RepositorySelectionPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/RepositorySelectionPage.java
@@ -536,7 +536,7 @@ private void checkPage() {
if (uri.getPath() == null) {
selectionIncomplete(NLS.bind(
UIText.RepositorySelectionPage_fieldRequired,
- UIText.RepositorySelectionPage_promptPath, proto));
+ unamp(UIText.RepositorySelectionPage_promptPath), proto));
return;
}
@@ -552,7 +552,7 @@ else if (uri.getPass() != null)
selectionIncomplete(NLS
.bind(
UIText.RepositorySelectionPage_fieldNotSupported,
- badField, proto));
+ unamp(badField), proto));
return;
}
@@ -571,7 +571,7 @@ selectionIncomplete(NLS.bind(
if (uri.getHost() == null) {
selectionIncomplete(NLS.bind(
UIText.RepositorySelectionPage_fieldRequired,
- UIText.RepositorySelectionPage_promptHost, proto));
+ unamp(UIText.RepositorySelectionPage_promptHost), proto));
return;
}
@@ -585,7 +585,7 @@ else if (uri.getPass() != null)
selectionIncomplete(NLS
.bind(
UIText.RepositorySelectionPage_fieldNotSupported,
- badField, proto));
+ unamp(badField), proto));
return;
}
}
@@ -608,6 +608,10 @@ selectionIncomplete(NLS
}
}
+ private String unamp(String s) {
+ return s.replace("&","");
+ }
+
private void selectionIncomplete(final String errorMessage) {
setExposedSelection(null, null);
setErrorMessage(errorMessage);
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
index 7f2e4b0..3819047 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
@@ -28,7 +28,7 @@ WizardProjectsImportPage_CheckingMessage = Checking: {0}
WizardProjectsImportPage_SelectDialogTitle = Select root directory of the projects to import
WizardProjectImportPage_errorMessage = Creation Problems
WizardProjectsImportPage_CreateProjectsTask = Creating Projects
-WizardProjectsImportPage_enableGit = Enable Git Team operations on imported projects
+WizardProjectsImportPage_enableGit = Enable &Git Team operations on imported projects
SharingWizard_windowTitle=Configure Git Repository
SharingWizard_failed=Failed to initialize Git team provider.
@@ -56,13 +56,13 @@ RepositorySelectionPage_uriChoice=Custom URI
RepositorySelectionPage_groupLocation=Location
RepositorySelectionPage_groupAuthentication=Authentication
RepositorySelectionPage_groupConnection=Connection
-RepositorySelectionPage_promptURI=URI
-RepositorySelectionPage_promptHost=Host
-RepositorySelectionPage_promptPath=Repository path
-RepositorySelectionPage_promptUser=User
-RepositorySelectionPage_promptPassword=Password
-RepositorySelectionPage_promptScheme=Protocol
-RepositorySelectionPage_promptPort=Port
+RepositorySelectionPage_promptURI=UR&I
+RepositorySelectionPage_promptHost=&Host
+RepositorySelectionPage_promptPath=&Repository path
+RepositorySelectionPage_promptUser=&User
+RepositorySelectionPage_promptPassword=&Password
+RepositorySelectionPage_promptScheme=Protoco&l
+RepositorySelectionPage_promptPort=Por&t
RepositorySelectionPage_fieldRequired={0} required for {1} protocol.
RepositorySelectionPage_fieldNotSupported={0} not supported on {1} protocol.
RepositorySelectionPage_fileNotFound={0} does not exist.
@@ -70,9 +70,9 @@ RepositorySelectionPage_internalError=Internal error; consult Eclipse error log.
SourceBranchPage_title=Source Git Repository
SourceBranchPage_description=Select branches to clone from remote repository.
-SourceBranchPage_branchList=Branches of {0}:
-SourceBranchPage_selectAll=Select All
-SourceBranchPage_selectNone=Deselect All
+SourceBranchPage_branchList=Branches &of {0}:
+SourceBranchPage_selectAll=&Select All
+SourceBranchPage_selectNone=&Deselect All
SourceBranchPage_errorBranchRequired=At least one branch must be selected.
SourceBranchPage_transportError=Transport Error
SourceBranchPage_cannotListBranches=Cannot list the available branches.
@@ -84,11 +84,11 @@ CloneDestinationPage_title=Local Destination
CloneDestinationPage_description=Configure the local storage location for {0}.
CloneDestinationPage_groupDestination=Destination
CloneDestinationPage_groupConfiguration=Configuration
-CloneDestinationPage_promptDirectory=Directory
-CloneDestinationPage_promptInitialBranch=Initial branch
-CloneDestinationPage_promptRemoteName=Remote name
+CloneDestinationPage_promptDirectory=&Directory
+CloneDestinationPage_promptInitialBranch=Initial &branch
+CloneDestinationPage_promptRemoteName=Remote na&me
CloneDestinationPage_fieldRequired={0} is required.
-CloneDestinationPage_browseButton=Browse
+CloneDestinationPage_browseButton=Bro&wse
CloneDestinationPage_errorNotEmptyDir={0} is not an empty directory.
CloneDestinationPage_importProjectsAfterClone=&Import projects after clone
CloneDestinationPage_workspaceImport=Workspace import
--
1.6.1.rc3.56.gd0306
^ permalink raw reply related
* [EGIT PATCH 4/7] Normalize paths to /-format when parsing GIT URI's
From: Robin Rosenberg @ 2009-01-08 16:56 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1231433791-9267-4-git-send-email-robin.rosenberg@dewire.com>
This means '\' on Windows will be changed to '/'.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../tst/org/spearce/jgit/transport/URIishTest.java | 10 ++++++++++
.../src/org/spearce/jgit/transport/URIish.java | 3 ++-
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/URIishTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/URIishTest.java
index 2e5e847..8462dfc 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/URIishTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/URIishTest.java
@@ -62,6 +62,16 @@ public void testWindowsFile() throws Exception {
assertEquals(u, new URIish(str));
}
+ public void testWindowsFile2() throws Exception {
+ final String str = "D:\\m y";
+ URIish u = new URIish(str);
+ assertNull(u.getScheme());
+ assertFalse(u.isRemote());
+ assertEquals("D:/m y", u.getPath());
+ assertEquals("D:/m y", u.toString());
+ assertEquals(u, new URIish(str));
+ }
+
public void testFileProtoUnix() throws Exception {
final String str = "file:///home/m y";
URIish u = new URIish(str);
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/URIish.java b/org.spearce.jgit/src/org/spearce/jgit/transport/URIish.java
index f81a709..b86e00c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/URIish.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/URIish.java
@@ -51,7 +51,7 @@
*/
public class URIish {
private static final Pattern FULL_URI = Pattern
- .compile("^(?:([a-z0-9+-]+)://(?:([^/]+?)(?::([^/]+?))?@)?(?:([^/]+?))?(?::(\\d+))?)?((?:[A-Za-z]:)?/.+)$");
+ .compile("^(?:([a-z][a-z0-9+-]+)://(?:([^/]+?)(?::([^/]+?))?@)?(?:([^/]+?))?(?::(\\d+))?)?((?:[A-Za-z]:)?/.+)$");
private static final Pattern SCP_URI = Pattern
.compile("^(?:([^@]+?)@)?([^:]+?):(.+)$");
@@ -75,6 +75,7 @@
* @throws URISyntaxException
*/
public URIish(String s) throws URISyntaxException {
+ s = s.replace('\\', '/');
Matcher matcher = FULL_URI.matcher(s);
if (matcher.matches()) {
scheme = matcher.group(1);
--
1.6.1.rc3.56.gd0306
^ permalink raw reply related
* [EGIT PATCH 1/7] Create the import wizard question checkbox properly
From: Robin Rosenberg @ 2009-01-08 16:56 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1231433791-9267-1-git-send-email-robin.rosenberg@dewire.com>
This is necessary for good layout and to make the UI test work. Anyway, this
is the way checkboxes should be created.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../ui/internal/clone/CloneDestinationPage.java | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/CloneDestinationPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/CloneDestinationPage.java
index d017b60..a02b3a2 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/CloneDestinationPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/CloneDestinationPage.java
@@ -173,9 +173,9 @@ public void modifyText(ModifyEvent e) {
private void createWorkbenchGroup(Composite parent) {
final Group g = createGroup(parent, "Workspace import");
- newLabel(g, "Import projects after clone");
showImportWizard = new Button(g, SWT.CHECK);
showImportWizard.setSelection(true);
+ showImportWizard.setText("Import projects after clone");
showImportWizard.setLayoutData(createFieldGridData());
showImportWizard.addSelectionListener(new SelectionAdapter() {
@Override
--
1.6.1.rc3.56.gd0306
^ permalink raw reply related
* [EGIT PATCH 5/7] Add UNC test case to URIish test
From: Robin Rosenberg @ 2009-01-08 16:56 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1231433791-9267-5-git-send-email-robin.rosenberg@dewire.com>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../tst/org/spearce/jgit/transport/URIishTest.java | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/URIishTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/URIishTest.java
index 8462dfc..2ea9d60 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/URIishTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/URIishTest.java
@@ -72,6 +72,16 @@ public void testWindowsFile2() throws Exception {
assertEquals(u, new URIish(str));
}
+ public void testUNC() throws Exception {
+ final String str = "\\\\some\\place";
+ URIish u = new URIish(str);
+ assertNull(u.getScheme());
+ assertFalse(u.isRemote());
+ assertEquals("//some/place", u.getPath());
+ assertEquals("//some/place", u.toString());
+ assertEquals(u, new URIish(str));
+ }
+
public void testFileProtoUnix() throws Exception {
final String str = "file:///home/m y";
URIish u = new URIish(str);
--
1.6.1.rc3.56.gd0306
^ permalink raw reply related
* [EGIT PATCH 6/7] Treat null scheme as file: in git import wizard
From: Robin Rosenberg @ 2009-01-08 16:56 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1231433791-9267-6-git-send-email-robin.rosenberg@dewire.com>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../components/RepositorySelectionPage.java | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/RepositorySelectionPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/RepositorySelectionPage.java
index 95df71e..db177ec 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/RepositorySelectionPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/RepositorySelectionPage.java
@@ -429,7 +429,7 @@ private static boolean isGIT(final URIish uri) {
}
private static boolean isFile(final URIish uri) {
- if ("file".equals(uri.getScheme()))
+ if ("file".equals(uri.getScheme()) || uri.getScheme() == null)
return true;
if (uri.getHost() != null || uri.getPort() > 0 || uri.getUser() != null
|| uri.getPass() != null || uri.getPath() == null)
--
1.6.1.rc3.56.gd0306
^ permalink raw reply related
* [EGIT PATCH 7/7] Create an automatic UI test for the Git Import Wizard
From: Robin Rosenberg @ 2009-01-08 16:56 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1231433791-9267-7-git-send-email-robin.rosenberg@dewire.com>
Things like dialogs and such require a different approach. The
strategy is to use SWTBot for runnings UI-oriented tests.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
org.spearce.egit.ui.test/.classpath | 8 +
org.spearce.egit.ui.test/.project | 28 ++
.../.settings/org.eclipse.jdt.core.prefs | 320 +++++++++++++
.../All org.spearce.egit.ui tests.launch | 41 ++
org.spearce.egit.ui.test/META-INF/MANIFEST.MF | 19 +
org.spearce.egit.ui.test/build.properties | 4 +
.../ui/internal/sharing/GitCloneWizardTest.java | 480 ++++++++++++++++++++
.../src/org/spearce/egit/ui/test/Activator.java | 50 ++
8 files changed, 950 insertions(+), 0 deletions(-)
create mode 100644 org.spearce.egit.ui.test/.classpath
create mode 100644 org.spearce.egit.ui.test/.project
create mode 100644 org.spearce.egit.ui.test/.settings/org.eclipse.jdt.core.prefs
create mode 100644 org.spearce.egit.ui.test/All org.spearce.egit.ui tests.launch
create mode 100644 org.spearce.egit.ui.test/META-INF/MANIFEST.MF
create mode 100644 org.spearce.egit.ui.test/build.properties
create mode 100644 org.spearce.egit.ui.test/src/org/spearce/egit/ui/internal/sharing/GitCloneWizardTest.java
create mode 100644 org.spearce.egit.ui.test/src/org/spearce/egit/ui/test/Activator.java
diff --git a/org.spearce.egit.ui.test/.classpath b/org.spearce.egit.ui.test/.classpath
new file mode 100644
index 0000000..76279f3
--- /dev/null
+++ b/org.spearce.egit.ui.test/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.spearce.egit.ui.test/.project b/org.spearce.egit.ui.test/.project
new file mode 100644
index 0000000..caa9fa4
--- /dev/null
+++ b/org.spearce.egit.ui.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.spearce.egit.ui.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.spearce.egit.ui.test/.settings/org.eclipse.jdt.core.prefs b/org.spearce.egit.ui.test/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..fb77da2
--- /dev/null
+++ b/org.spearce.egit.ui.test/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,320 @@
+#Sun Feb 03 03:52:00 CET 2008
+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=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
+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=error
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+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=error
+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
diff --git a/org.spearce.egit.ui.test/All org.spearce.egit.ui tests.launch b/org.spearce.egit.ui.test/All org.spearce.egit.ui tests.launch
new file mode 100644
index 0000000..23a74e2
--- /dev/null
+++ b/org.spearce.egit.ui.test/All org.spearce.egit.ui tests.launch
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="net.sf.swtbot.eclipse.ui.launcher.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.spearce.egit.ui.test"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<mapAttribute key="org.eclipse.debug.core.environmentVariables">
+<mapEntry key="LC_ALL" value="C"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.spearce.egit.ui.test"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl en_US"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.spearce.egit.ui.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dnet.sf.swtbot.search.timeout=500000"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/org.spearce.egit.ui.test/META-INF/MANIFEST.MF b/org.spearce.egit.ui.test/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9059c4a
--- /dev/null
+++ b/org.spearce.egit.ui.test/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test Plug-in
+Bundle-SymbolicName: org.spearce.egit.ui.test
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.spearce.egit.ui.test.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.spearce.egit.ui;bundle-version="0.4.0",
+ net.sf.swtbot.eclipse.finder;bundle-version="2.0.0",
+ net.sf.swtbot.eclipse.spy;bundle-version="2.0.0",
+ net.sf.swtbot.eclipse.ui;bundle-version="2.0.0",
+ net.sf.swtbot.finder;bundle-version="2.0.0",
+ org.eclipse.swt;bundle-version="3.4.0",
+ org.eclipse.ui;bundle-version="3.4.0",
+ org.eclipse.core.resources;bundle-version="3.4.0",
+ org.spearce.jgit;bundle-version="0.4.0",
+ org.apache.log4j;bundle-version="1.2.13"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/org.spearce.egit.ui.test/build.properties b/org.spearce.egit.ui.test/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/org.spearce.egit.ui.test/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/org.spearce.egit.ui.test/src/org/spearce/egit/ui/internal/sharing/GitCloneWizardTest.java b/org.spearce.egit.ui.test/src/org/spearce/egit/ui/internal/sharing/GitCloneWizardTest.java
new file mode 100644
index 0000000..393ce8b
--- /dev/null
+++ b/org.spearce.egit.ui.test/src/org/spearce/egit/ui/internal/sharing/GitCloneWizardTest.java
@@ -0,0 +1,480 @@
+package org.spearce.egit.ui.internal.sharing;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import net.sf.swtbot.eclipse.finder.SWTBotEclipseTestCase;
+import net.sf.swtbot.wait.Conditions;
+import net.sf.swtbot.widgets.SWTBotShell;
+import net.sf.swtbot.widgets.SWTBotTree;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Platform;
+import org.spearce.jgit.lib.Repository;
+
+/**
+ * UI Tests for the Git import wizard.
+ * <p>
+ * Only UI aspects are interesting.
+ * <p>
+ * TODO:
+ * <ul>
+ * <li>Failure at fetch step
+ * <li>Failure during fetch step
+ * <li>Failure post fetch step (bad repo?)
+ * </ul>
+ */
+public class GitCloneWizardTest extends SWTBotEclipseTestCase {
+ /**
+ * Test that defaults and derived values in dialogs are set properly and
+ * that cloning starts and stops properly for a normal run. It also samples
+ * the cloned repository to see that a clone and checkout has occurred.
+ * <p>
+ * The clone is backgrounded so no import to the workspace, nor any sharing
+ * occurs.
+ *
+ * @throws Exception
+ */
+ public void testClone() throws Exception {
+ bot.view("Package Explorer").show();
+ bot.menu("File").click();
+ bot.menu("File").menu("Import...").click();
+ bot.shell("Import");
+
+ SWTBotTree tree = bot.tree(0);
+ tree.expandNode("Git").select("Git Repository");
+
+ bot.button("Next >").click();
+ bot.shell("Import Git Repository");
+ bot.textWithLabel("URI:").setText("git://www.jgit.org/EGIT");
+ assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "", true, "",
+ "", false, false);
+ bot.button("Next >").click();
+
+ assertEquals("master", bot.table().getTableItem(0).getText());
+ assertTrue(bot.table().getTableItem(0).isChecked());
+ bot.button("Next >").click();
+
+ File destRepo = new File(new File(ResourcesPlugin.getWorkspace()
+ .getRoot().getLocation().toFile().getParent(),
+ "junit-workspace"), "EGIT");
+ assertEquals(destRepo.toString(), bot.textWithLabel("Directory:")
+ .getText());
+ assertEquals("master", bot.comboBoxWithLabel("Initial branch:")
+ .getText());
+ assertEquals("origin", bot.textWithLabel("Remote name:").getText());
+ bot.checkBox("Import projects after clone").deselect();
+ bot.button("Finish").click();
+
+ SWTBotShell shell2 = bot.shell("Cloning from git://www.jgit.org/EGIT");
+
+ // This is not a performance test. Allow lots of time to complete
+ bot.waitUntil(Conditions.shellCloses(shell2), 120000);
+
+ // Some random sampling to see we got something. We do not test
+ // the integrity of the repository here. Only a few basic properties
+ // we'd expect from a clone made this way, that would possibly
+ // not hold true given other parameters in the GUI.
+ Repository repository = new Repository(new File(destRepo, ".git"));
+ // we always have an origin/master
+ assertNotNull(repository.resolve("origin/master"));
+ // and a local master initialized from origin/master (default!)
+ assertEquals(repository.resolve("origin/master"), repository
+ .resolve("origin/master"));
+ // A well known tag
+ assertEquals("90b818e596660b813b6fcf68f1e9e9b62c615130", repository
+ .resolve("refs/tags/v0.4.0").name());
+ // lots of refs
+ assertTrue(repository.getAllRefs().size() >= 10);
+ // and a README in the working dir
+ assertTrue(new File(destRepo, "README").exists());
+ assertFalse(repository.getIndex().isChanged());
+ assertFalse(repository.getIndex().getEntry("README").isModified(
+ destRepo));
+ // No project have been imported
+ assertEquals(0,
+ ResourcesPlugin.getWorkspace().getRoot().getProjects().length);
+ }
+
+ /**
+ * Basically the same as testClone, but using the same parameters will not
+ * work because the destination already exists and so the UI will not let
+ * the user finish the operation. This tests that case for default
+ * parameters.
+ *
+ * @throws Exception
+ */
+ public void testCloneDestExists() throws Exception {
+ File destRepo = new File(new File(ResourcesPlugin.getWorkspace()
+ .getRoot().getLocation().toFile().getParent(),
+ "junit-workspace"), "EGIT");
+ if (!destRepo.exists()) {
+ if (!destRepo.mkdirs())
+ throw new IOException("Ooops, failed to create " + destRepo);
+ new FileOutputStream(new File(destRepo, "afile")).close();
+ }
+ bot.view("Package Explorer").show();
+ bot.menu("File").click();
+ bot.menu("File").menu("Import...").click();
+
+ bot.shell("Import");
+
+ SWTBotTree tree = bot.tree(0);
+ tree.expandNode("Git").select("Git Repository");
+ bot.button("Next >").click();
+
+ bot.shell("Import Git Repository");
+ bot.textWithLabel("URI:");
+ bot.textWithLabel("URI:").setText("git://www.jgit.org/EGIT");
+ bot.button("Next >").click();
+
+ bot.button("Next >").click();
+
+ bot.checkBox("Import projects after clone").deselect();
+ assertFalse(bot.button("Finish").isEnabled());
+ assertEquals(" " + bot.textWithLabel("Directory:").getText()
+ + " is not an empty directory.", bot.text(2/* ! */).getText());
+
+ // Need to close or no other test can be performed
+ bot.activeShell().close();
+ }
+
+ /**
+ * Alter some parameters during clone
+ * @throws IOException
+ */
+ public void testCloneChangeSomeParameters() throws IOException {
+ bot.view("Package Explorer").show();
+ bot.menu("File").click();
+ bot.menu("File").menu("Import...").click();
+
+ bot.shell("Import");
+
+ SWTBotTree tree = bot.tree(0);
+ tree.expandNode("Git").select("Git Repository");
+ bot.button("Next >").click();
+
+ bot.shell("Import Git Repository");
+ bot.textWithLabel("URI:").setText("git://www.jgit.org/EGIT");
+ assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "", true, "",
+ "", false, false);
+ bot.button("Next >").click();
+
+ // Select only two branches
+ for (int i = 0; i < bot.table().rowCount(); ++i)
+ bot.table().getTableItem(i).uncheck();
+ assertEquals(" At least one branch must be selected.", bot.text(0)
+ .getText());
+ assertFalse(bot.button("Next >").isEnabled());
+ bot.table().getTableItem("stable").check(); // will enable
+ assertTrue(bot.button("Next >").isEnabled());
+ bot.table().getTableItem("release").check();
+ bot.button("Next >").click();
+
+ File destRepo = new File(new File(ResourcesPlugin.getWorkspace()
+ .getRoot().getLocation().toFile().getParent(),
+ "junit-workspace"), "EGIT2");
+ bot.textWithLabel("Directory:").setText(destRepo.toString());
+ assertEquals("release", bot.comboBoxWithLabel("Initial branch:")
+ .getText());
+ bot.comboBoxWithLabel("Initial branch:").setSelection("stable");
+ assertEquals("origin", bot.textWithLabel("Remote name:").getText());
+ bot.textWithLabel("Remote name:").setText("src");
+ bot.checkBox("Import projects after clone").deselect();
+ bot.button("Finish").click();
+
+ SWTBotShell shell2 = bot.shell("Cloning from git://www.jgit.org/EGIT");
+
+ // This is not a performance test. Allow lots of time to complete
+ bot.waitUntil(Conditions.shellCloses(shell2), 120000);
+
+ // Some random sampling to see we got something. We do not test
+ // the integrity of the repo here. Only a few basic properties
+ // we'd expect from a clone made this way, that would possibly
+ // not hold true given othe parameters in the GUI.
+ Repository repository = new Repository(new File(destRepo, ".git"));
+ assertNotNull(repository.resolve("src/stable"));
+ assertNotNull(repository.resolve("src/release"));
+ // we didn't clone that one
+ assertNull(repository.resolve("src/master"));
+ // and a local master initialized from origin/master (default!)
+ assertEquals(repository.resolve("stable"), repository
+ .resolve("src/stable"));
+ // A well known tag
+ assertEquals("90b818e596660b813b6fcf68f1e9e9b62c615130", repository
+ .resolve("refs/tags/v0.4.0").name());
+ // lots of refs
+ assertTrue(repository.getAllRefs().size() >= 10);
+
+ // Skip testing working dir, we did that in #testClone
+ }
+
+ /**
+ * Exercise editing of fields and verify that derived fields are updated and
+ * enabled/disabled properly along with a proper error message when needed.
+ * No clone is actually made.
+ */
+ public void testParameterEditing() {
+ bot.view("Package Explorer").show();
+ bot.menu("File").click();
+ bot.menu("File").menu("Import...").click();
+ bot.shell("Import");
+
+ SWTBotTree tree = bot.tree(0);
+ tree.expandNode("Git").select("Git Repository");
+ bot.button("Next >").click();
+
+ bot.shell("Import Git Repository");
+ // Start the test now
+ bot.textWithLabel("URI:").setText("git://www.jgit.org/EGIT");
+ assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "", true, "",
+ "", false, false);
+
+ bot.textWithLabel("URI:").typeText("X");
+ assertSourceParams(null, "www.jgit.org", "/EGITX", "git", "", true, "",
+ "", false, false);
+
+ bot.textWithLabel("URI:").setText("git://www.jgit.org/EGIT");
+ assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "", true, "",
+ "", false, false);
+
+ bot.textWithLabel("URI:").setText("git://user:hi@www.jgit.org/EGIT");
+ assertSourceParams(" User not supported on git protocol.",
+ "www.jgit.org", "/EGIT", "git", "", true, "user", "hi", false,
+ false);
+ // UI doesn't change URI even when password is entered in clear text as
+ // part of URI. Opinions on this may vary.
+ assertEquals("git://user:hi@www.jgit.org/EGIT", bot.textWithLabel(
+ "URI:").getText());
+
+ bot.textWithLabel("URI:").setText("ssh://user@www.jgit.org/EGIT");
+ assertSourceParams(null, "www.jgit.org", "/EGIT", "git+ssh", "", true,
+ "user", "", true, true);
+
+ bot.textWithLabel("URI:").setText("ssh://user@www.jgit.org/EGIT");
+ assertSourceParams(null, "www.jgit.org", "/EGIT", "git+ssh", "", true,
+ "user", "", true, true);
+
+ bot.textWithLabel("URI:").setText("ssh://user:hi@www.jgit.org:33/EGIT");
+ assertSourceParams(null, "www.jgit.org", "/EGIT", "git+ssh", "33",
+ true, "user", "hi", true, true);
+
+ bot.textWithLabel("URI:").setText("ssh:///EGIT");
+ assertSourceParams(" Host required for ssh protocol.", "", "/EGIT",
+ "git+ssh", "", true, "", "", true, true);
+
+ bot.textWithLabel("URI:").setText("file:///some/place");
+ if (Platform.getOS().equals(Platform.OS_WIN32))
+ assertSourceParams(" " + System.getProperty("user.dir")
+ + "\\.\\some\\place does not exist.", "", "/some/place",
+ "file", "", false, "", "", false, false);
+ else
+ assertSourceParams(" /some/place does not exist.", "",
+ "/some/place", "file", "", false, "", "", false, false);
+
+ // Now try changing some fields other than URI and see how the URI field
+ // gets changed
+ bot.textWithLabel("URI:").setText("ssh://user@www.jgit.org/EGIT");
+
+ // ..change host
+ bot.textWithLabel("Host:").setText("example.com");
+ assertEquals("ssh://user@example.com/EGIT", bot.textWithLabel("URI:")
+ .getText());
+ assertSourceParams(null, "example.com", "/EGIT", "git+ssh", "", true,
+ "user", "", true, true);
+
+ // ..change user
+ bot.textWithLabel("User:").setText("gitney");
+ assertEquals("ssh://gitney@example.com/EGIT", bot.textWithLabel("URI:")
+ .getText());
+ assertSourceParams(null, "example.com", "/EGIT", "git+ssh", "", true,
+ "gitney", "", true, true);
+
+ // ..change password
+ bot.textWithLabel("Password:").setText("fsck");
+ // Password is not written into the URL here!
+ assertEquals("ssh://gitney@example.com/EGIT", bot.textWithLabel("URI:")
+ .getText());
+ assertSourceParams(null, "example.com", "/EGIT", "git+ssh", "", true,
+ "gitney", "fsck", true, true);
+
+ // change port number
+ bot.textWithLabel("Port:").setText("99");
+ assertEquals("ssh://gitney@example.com:99/EGIT", bot.textWithLabel(
+ "URI:").getText());
+ assertSourceParams(null, "example.com", "/EGIT", "git+ssh", "99", true,
+ "gitney", "fsck", true, true);
+
+ // change protocol to another with user/password capability
+ bot.comboBoxWithLabel("Protocol:").setSelection("ftp");
+ assertEquals("ftp://gitney@example.com:99/EGIT", bot.textWithLabel(
+ "URI:").getText());
+ assertSourceParams(null, "example.com", "/EGIT", "ftp", "99", true,
+ "gitney", "fsck", true, true);
+
+ // change protocol to one without user/password capability
+ bot.comboBoxWithLabel("Protocol:").setSelection("git");
+ assertEquals("git://gitney@example.com:99/EGIT", bot.textWithLabel(
+ "URI:").getText());
+ assertSourceParams(" User not supported on git protocol.",
+ "example.com", "/EGIT", "git", "99", true, "gitney", "fsck",
+ false, false);
+
+ // change protocol to one without host capability
+ bot.comboBoxWithLabel("Protocol:").setSelection("file");
+ assertEquals("file://gitney@example.com:99/EGIT", bot.textWithLabel(
+ "URI:").getText());
+ assertSourceParams(" Host not supported on file protocol.",
+ "example.com", "/EGIT", "file", "99", false, "gitney", "fsck",
+ false, false);
+
+ // Local protocol with file: prefix. We need to make sure the
+ // local path exists as a directory so we choose user.home as
+ // that one should exist.
+ if (Platform.getOS().equals(Platform.OS_WIN32))
+ bot.textWithLabel("URI:").setText(
+ "file:///" + System.getProperty("user.home"));
+ else
+ bot.textWithLabel("URI:").setText(
+ "file://" + System.getProperty("user.home"));
+ assertSourceParams(null, "", System.getProperty("user.home").replace(
+ '\\', '/'), "file", "", false, "", "", false, false);
+
+ // Local protocol without file: prefix
+ bot.textWithLabel("URI:").setText(System.getProperty("user.home"));
+ assertSourceParams(null, "", System.getProperty("user.home").replace(
+ '\\', '/'), "file", "", false, "", "", false, false);
+
+ // On windows the use can choose forward or backward slashes, so add
+ // a case for forward slashes using the non prefixed local protocol.
+ if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ bot.textWithLabel("URI:").setText(
+ System.getProperty("user.home").replace('\\', '/'));
+ assertSourceParams(null, "", System.getProperty("user.home")
+ .replace('\\', '/'), "file", "", false, "", "", false,
+ false);
+ }
+ bot.button("Cancel").click();
+ }
+
+ /**
+ * Try not giving a hostname that does not exist. Should yield an error and
+ * disable the next/finish buttons.
+ */
+ public void testNoSuchHost() {
+ bot.view("Package Explorer").show();
+ bot.menu("File").click();
+ bot.menu("File").menu("Import...").click();
+ bot.shell("Import");
+
+ SWTBotTree tree = bot.tree(0);
+ tree.expandNode("Git").select("Git Repository");
+
+ bot.button("Next >").click();
+ bot.shell("Import Git Repository");
+ bot.textWithLabel("URI:").setText("git://no.example.com/EGIT");
+ assertSourceParams(null, "no.example.com", "/EGIT", "git", "", true,
+ "", "", false, false);
+ bot.button("Next >").click();
+ assertEquals(" git://no.example.com/EGIT: unknown host", bot.text(0)
+ .getText());
+ assertTrue(bot.button("Cancel").isEnabled());
+ assertTrue(bot.button("< Back").isEnabled());
+ assertFalse(bot.button("Next >").isEnabled());
+ assertFalse(bot.button("Finish").isEnabled());
+ bot.button("Cancel").click();
+ }
+
+ /**
+ * Try connecting to a non-git socket.
+ */
+ public void testWrongSocket() {
+ bot.view("Package Explorer").show();
+ bot.menu("File").click();
+ bot.menu("File").menu("Import...").click();
+ bot.shell("Import");
+
+ SWTBotTree tree = bot.tree(0);
+ tree.expandNode("Git").select("Git Repository");
+
+ bot.button("Next >").click();
+ bot.shell("Import Git Repository");
+ bot.textWithLabel("URI:").setText("git://www.jgit.org:80/EGIT");
+ assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "80", true,
+ "", "", false, false);
+ bot.button("Next >").click();
+ assertEquals(" git://www.jgit.org:80/EGIT: not found.", bot.text(0)
+ .getText());
+ assertTrue(bot.button("Cancel").isEnabled());
+ assertTrue(bot.button("< Back").isEnabled());
+ assertFalse(bot.button("Next >").isEnabled());
+ assertFalse(bot.button("Finish").isEnabled());
+ bot.button("Cancel").click();
+ }
+
+ /**
+ * Firewalled socket, no response.
+ */
+ public void testTimeoutToHost() {
+ bot.view("Package Explorer").show();
+ bot.menu("File").click();
+ bot.menu("File").menu("Import...").click();
+ bot.shell("Import");
+
+ SWTBotTree tree = bot.tree(0);
+ tree.expandNode("Git").select("Git Repository");
+
+ bot.button("Next >").click();
+ bot.shell("Import Git Repository");
+ bot.textWithLabel("URI:").setText("git://www.example.com/EGIT");
+ assertSourceParams(null, "www.example.com", "/EGIT", "git", "", true,
+ "", "", false, false);
+ bot.button("Next >").click();
+ // Timeout messages are platform and locale dependent it seems. This
+ // test has only been tried on Linux and Windows. We assume
+ // that the test is run with an english locale for this test to pass.
+ // -nl en_US and environment LC_ALL=en_US (or possibly the "C" locale).
+ assertStartsWith(" git://www.example.com/EGIT: Connection timed out",
+ bot.text(0).getText());
+ assertTrue(bot.button("Cancel").isEnabled());
+ assertTrue(bot.button("< Back").isEnabled());
+ assertFalse(bot.button("Next >").isEnabled());
+ assertFalse(bot.button("Finish").isEnabled());
+ bot.button("Cancel").click();
+ }
+
+ private void assertStartsWith(String expect, String actual) {
+ if (actual.length() < expect.length())
+ assertEquals("Wrong start of message", expect, actual);
+ else
+ assertEquals("Wrong start of message", expect, actual.substring(0,
+ expect.length()));
+ }
+
+ private void assertSourceParams(String message, String expectHost,
+ String expectPath, String expectProtocol, String expectPort,
+ boolean enablePort, String expectUser, String expectPassword,
+ boolean enabledUser, boolean enabledPass) {
+ if (message != null) {
+ assertEquals(message, bot.text(6).getText());
+ assertFalse(bot.button("Next >").isEnabled());
+ } else {
+ assertEquals("Enter the location of the source repository.", bot
+ .text(6).getText());
+ assertTrue(bot.button("Next >").isEnabled());
+ }
+ assertEquals(expectHost, bot.textWithLabel("Host:").getText());
+ assertEquals(expectPath, bot.textWithLabel("Repository path:")
+ .getText());
+ assertEquals(expectProtocol, bot.comboBoxWithLabel("Protocol:")
+ .getText());
+ assertEquals(expectPort, bot.textWithLabel("Port:").getText());
+ assertEquals(enablePort, bot.textWithLabel("Port:").isEnabled());
+ assertEquals(expectUser, bot.textWithLabel("User:").getText());
+ assertEquals(expectPassword, bot.textWithLabel("Password:").getText());
+ assertEquals(enabledUser, bot.textWithLabel("User:").isEnabled());
+ assertEquals(enabledPass, bot.label("Password:").isEnabled());
+ assertEquals(enabledPass, bot.textWithLabel("Password:").isEnabled());
+ }
+}
diff --git a/org.spearce.egit.ui.test/src/org/spearce/egit/ui/test/Activator.java b/org.spearce.egit.ui.test/src/org/spearce/egit/ui/test/Activator.java
new file mode 100644
index 0000000..b6ecb00
--- /dev/null
+++ b/org.spearce.egit.ui.test/src/org/spearce/egit/ui/test/Activator.java
@@ -0,0 +1,50 @@
+package org.spearce.egit.ui.test;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.spearce.egit.ui.test";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
--
1.6.1.rc3.56.gd0306
^ permalink raw reply related
* Re: Plans to put together an Info manual?
From: Teemu Likonen @ 2009-01-08 17:09 UTC (permalink / raw)
To: Tim Visher; +Cc: git
In-Reply-To: <c115fd3c0901080747p4dd1233fla2f877f39ffa9806@mail.gmail.com>
Tim Visher (2009-01-08 10:47 -0500) wrote:
> I wast just wondering A) If there is an info manual for Git, B) If
> there isn't, is one planned?
There is already something that _can_ be called "info manual for Git".
It's basically info version of Git User's Manual:
http://www.kernel.org/pub/software/scm/git/docs/user-manual.html
Regular man pages are also available in info format.
The info manuals are not written in native info format, though. They are
generated from the asciidoc markup files, through xml format. There are
some problems with typesetting as some characters simply disappear in
the "asciidoc -> xml -> texi -> info" conversion. Two dashes (--) turn
into one (-), for example. But if you are not too demanding the info
manuals are quite usable. You can compile them with "make info" command.
^ permalink raw reply
* Re: Maintaining site-wide clones
From: Sitaram Chamarty @ 2009-01-08 17:22 UTC (permalink / raw)
To: git
In-Reply-To: <alpine.LNX.1.00.0901081129500.19665@iabervon.org>
On 2009-01-08, Daniel Barkalow <barkalow@iabervon.org> wrote:
> Is there a good way of handling a setup where the canonical repository is
> in some slow foreign system and you want a lot of git clones? I've been
> using a bare repository that I import into and clone, but then I need to
> go to the bare repository to update anything, which is vaguely annoying.
Why? You can push to it too?
I don't have your use case but if I did, I'd do this:
- everyone clones from the local mirror
- one person clones the slow foreign system at whatever
interval he thinks appropriate, and pushes to the local
mirror
- (or the local mirror can do this via cron)
This works fine if you can sort of judge the average
frequency of updates, and not getting some of them
*immediately* is not earth shattering for local developers.
If the slow foreign system lets you put in a post-commit
hook that'll be even easier -- no more guesswork!
^ permalink raw reply
* Re: [RFC/PATCH 2/3] replace_object: add mechanism to replace objects found in "refs/replace/"
From: Christian Couder @ 2009-01-08 17:31 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vmye3a4pt.fsf@gitster.siamese.dyndns.org>
Le mercredi 7 janvier 2009, Junio C Hamano a écrit :
> Christian Couder <chriscool@tuxfamily.org> writes:
> > In "parse_commit_buffer", the parent sha1s from the original commit
> > or from a commit graft that match a ref name in "refs/replace/" are
> > replaced by the commit sha1 that has been read in the ref.
>
> I may be reading this wrong, but if you replace the parent of the commit,
> that won't improve anything over the graft mechanism, which we already
> have.
>
> What I was hoping to see was to give replacing commit back when a commit
> is asked for by normal callers,
Yeah, but read_sha1_file is called to read all object files, not just
commits. So putting the hook there will:
1) add a lookup overhead when reading any object,
2) make it possible to replace any object,
And there is also the following problem:
3) this function is often called like this:
buffer = read_sha1_file(sha1, &type, &size);
if (!buffer)
die("Cannot read %s", sha1_to_hex(sha1));
so in case of error, it will give an error message with a bad sha1
in it because the sha1 of the file that we cannot read is the sha1
in the replace ref not the one passed to read_sha1_file.
To avoid the above problems, maybe we can try to also improve what
read_sha1_file does:
1) allow callers to pass a type in the "type" argument and only lookup in
the replace refs if we say we want a commit, but this makes calling this
function more error prone
2) when we say we want an object with a given type, check if the object we
read has this type (and die if not)
3) die in read_sha1_file when there is an error and we are replacing so that
callers don't need to die themself and so that we can always report an
accurate sha1 in the error message
Something like this (totally untested):
void *read_sha1_file(const unsigned char *sha1, enum object_type *type,
unsigned long *size)
{
void *data;
enum object_type read_type;
int replacing = (type && *type == OBJ_COMMIT);
/* only replace commits when we ask for one */
if (replacing)
sha1 = lookup_replace_object(sha1);
data = read_object(sha1, &read_type, size);
/* legacy behavior is to die on corrupted objects */
if (!data && (has_loose_object(sha1) || has_packed_and_bad(sha1)))
die("object %s is corrupted", sha1_to_hex(sha1));
if (type && *type != OBJ_NONE && *type != read_type)
die("type of object %s (%d) is different from the type we want (%d)",
sha1_to_hex(sha1), read_type, *type);
if (!data && replacing)
die("Cannot read commit %s", sha1_to_hex(sha1));
return data;
}
Or perhaps it is better to leave read_sha1_file as it is and add a new
function like this:
void *read_commit(const unsigned char *sha1, unsigned long *size)
{
void *data;
enum object_type type;
sha1 = lookup_replace_object(sha1);
data = read_sha1_file(sha1, &type, size);
if (*type != OBJ_COMMIT)
die("read_commit: object %s is not a commit", sha1_to_hex(sha1));
if (!data)
die("read_commit: cannot read commit %s", sha1_to_hex(sha1));
return data;
}
The latter seems better to me. But I haven't looked much at the 60
read_sha1_file callers yet.
[...]
> Doing replacement at parse_commit_buffer() time is one step too late.
> For example, if you have replacement information for the commit that sits
> at the tip of 'master' branch, I think your "git log master" will ignore
> that replacement information. Creating one new commit on top of it and
> saying "git log master" then will show the new commit, and suddenly
> starts showing the replacement commit for the one you used to have at the
> tip of the branch.
Yeah, I agree there are drawbacks to do it at parse_commit_buffer time.
Thanks,
Christian.
^ permalink raw reply
* Re: Git (svn) merge - but ignore certain commits?
From: "Peter Valdemar Mørch (Lists)" @ 2009-01-08 17:49 UTC (permalink / raw)
To: Peter Harris git-at-peter.is-a-geek.org |Lists|, git
In-Reply-To: <eaa105840812271617n74406517x3335a05d224f5e0@mail.gmail.com>
First, a well-overdue thanks to Peter for your post.
Peter Harris git-at-peter.is-a-geek.org |Lists| wrote:
> If your branch is so ugly that you want to toss many of the commits
> anyway, maybe "git merge --squash" is what you are looking for? Or
> maybe you want to "git rebase -i" before merging?
It isn't. The whole reason for the branch was that there were 4
"beta-level" commits on trunk/master along with a whole bunch of good
stuff. And we wanted to add a little more good stuff, exclude the beta
stuff and create a release.
>> How do I do this "properly"?
>
> Use many short-lived feature branches, not few long-lived generic
> "development" branches. Merge-and-delete is easier than herding
> reverts.
I don't understand this, I'm affraid. Our "newbranch" was very short
lived. 4 reverts and 5 commits.
What I ended up doing was to create two git branches off of svn
"newbranch": One with all the fixes but without the reverts, and one
with just the reverts. Do all the development on the one with the fixes,
and then "git merge" them to both master and "gitnewbranch", then one
with the reverts. And then git svn dcommit them both.
However *the* problem was with repeated merges: I later discovered a
problem on the branch and need to add a commit for it to both master and
newbranch/gitnewbranch. Aside from git cherry-pick (where I take care of
the repeated merge problem) I still haven't found a good solution.
I ended up using git cherry-pick, and diff and patch / git diff and git
apply. Sub-optimal. :-( But small commits! :-)
Peter
--
Peter Valdemar Mørch
http://www.morch.com
^ permalink raw reply
* Re: [PATCH] Wrap inflateInit to retry allocation after releasing pack memory
From: R. Tyler Ballance @ 2009-01-08 18:15 UTC (permalink / raw)
To: Linus Torvalds
Cc: Shawn O. Pearce, Junio C Hamano, Nicolas Pitre, Jan Krüger,
Git ML, kb
In-Reply-To: <alpine.LFD.2.00.0901071941210.3283@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 2597 bytes --]
On Wed, 2009-01-07 at 19:54 -0800, Linus Torvalds wrote:
>
> On Wed, 7 Jan 2009, Shawn O. Pearce wrote:
> >
> > If we are running low on virtual memory we should release pack
> > windows if zlib's inflateInit fails due to an out of memory error.
> > It may be that we are running under a low ulimit and are getting
> > tight on address space. Shedding unused windows may get us
> > sufficient working space to continue.
>
> Let's do this (more complete) wrapping instead, ok?
>
> This one _just_ wraps things, btw - it doesn't do the "retry on low memory
> error" part, at least not yet. I think that's an independent issue from
> the reporting.
>
> Hmm?
>
> Tyler - does this make the corruption errors go away, and be replaced by
> hard failures with "out of memory" reporting?
Yeah, looks like it:
tyler@grapefruit:~/source/git/linux-2.6> export
START=56d18e9932ebf4e8eca42d2ce509450e6c9c1666
tyler@grapefruit:~/source/git/linux-2.6> git reset --hard
HEAD is now at 9e42d0c Merge
git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
tyler@grapefruit:~/source/git/linux-2.6> git reset --hard $START
HEAD is now at 56d18e9 Merge branch 'upstream' of
git://ftp.linux-mips.org/pub/scm/upstream-linus
tyler@grapefruit:~/source/git/linux-2.6> ulimit -v `echo "350 *
1024" | bc -l`
tyler@grapefruit:~/source/git/linux-2.6> limit
cputime unlimited
filesize unlimited
datasize unlimited
stacksize 8MB
coredumpsize 0kB
memoryuse 2561MB
maxproc 24564
descriptors 1024
memorylocked 64kB
addressspace 350MB
maxfilelocks unlimited
sigpending 24564
msgqueue 819200
nice 0
rt_priority 0
tyler@grapefruit:~/source/git/linux-2.6> git pull
Updating 56d18e9..9e42d0c
fatal: Out of memory? inflateInit failed
tyler@grapefruit:~/source/git/linux-2.6> which git
/home/tyler/bin/git
tyler@grapefruit:~/source/git/linux-2.6>
>
> This patch is potentially pretty noisy, on purpose. I didn't remove the
> reporting from places that already do so - some of them have stricter
> errors than this.
I'm assuming this patch is going to be reworked, if so, I'll back it out
of our internal 1.6.1 build and anxiously await The Real Deal(tm)
Cheers
--
-R. Tyler Ballance
Slide, Inc.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* [PATCH (topgit)] tg-patch: add support for generating patches against worktree and index
From: Kirill Smelkov @ 2009-01-08 18:22 UTC (permalink / raw)
To: Petr Baudis, Petr Baudis
Cc: Kirill Smelkov, martin f krafft, Git Mailing List
This implements `tg patch -i` and `tg patch -w` to see current patch as
generated against not-yet-committed index and worktree.
NOTE: unfortunately `git cat-file blob <file>` does not provide an option
to cat file from worktree (only from an object or from index), so I had to
unroll my own `cat file topic:file` with special support for '(i)' and
'(w)' topics.
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
---
README | 5 +++--
contrib/tg-completion.bash | 6 ++++++
tg-patch.sh | 31 +++++++++++++++++++++++++------
tg.sh | 21 +++++++++++++++++++++
4 files changed, 55 insertions(+), 8 deletions(-)
diff --git a/README b/README
index 1d38365..5796112 100644
--- a/README
+++ b/README
@@ -284,8 +284,9 @@ tg patch
tg patch will be able to automatically send the patches by mail
or save them to files. (TODO)
- TODO: tg patch -i to base at index instead of branch,
- -w for working tree
+ Options:
+ -i base patch generation on index instead of branch
+ -w base patch generation on working tree instead of branch
tg mail
~~~~~~~
diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash
index 9641d04..de8a7b5 100755
--- a/contrib/tg-completion.bash
+++ b/contrib/tg-completion.bash
@@ -359,6 +359,12 @@ _tg_patch ()
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
+ -*)
+ __tgcomp "
+ -i
+ -w
+ "
+ ;;
*)
__tgcomp "$(__tg_topics)"
esac
diff --git a/tg-patch.sh b/tg-patch.sh
index dc699d2..db1ad09 100644
--- a/tg-patch.sh
+++ b/tg-patch.sh
@@ -5,14 +5,25 @@
name=
+topic=
+diff_opts=
+diff_committed_only=yes # will be unset for index/worktree
+
## Parse options
while [ -n "$1" ]; do
arg="$1"; shift
case "$arg" in
+ -i)
+ topic='(i)'
+ diff_opts="$diff_opts --cached";;
+ diff_committed_only=;
+ -w)
+ topic='(w)'
+ diff_committed_only=;;
-*)
- echo "Usage: tg [...] patch [NAME]" >&2
+ echo "Usage: tg [...] patch [-i | -w] [NAME]" >&2
exit 1;;
*)
[ -z "$name" ] || die "name already specified ($name)"
@@ -20,31 +31,39 @@ while [ -n "$1" ]; do
esac
done
+
+[ -n "$name" -a -z "$diff_committed_only" ] &&
+ die "-i/-w are mutually exclusive with NAME"
+
[ -n "$name" ] || name="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" ||
die "not a TopGit-controlled branch"
+# if not index/worktree, topic is current branch
+[ -z "$topic" ] && topic="$name"
+
+
setup_pager
-git cat-file blob "$name:.topmsg"
+cat_file "$topic:.topmsg"
echo
-[ -n "$(git grep '^[-]--' "$name" -- ".topmsg")" ] || echo '---'
+[ -n "$(git grep $diff_opts '^[-]--' ${diff_committed_only:+"$name"} -- ".topmsg")" ] || echo '---'
# Evil obnoxious hack to work around the lack of git diff --exclude
git_is_stupid="$(mktemp -t tg-patch-changes.XXXXXX)"
-git diff-tree --name-only "$base_rev" "$name" |
+git diff --name-only $diff_opts "$base_rev" ${diff_committed_only:+"$name"} -- |
fgrep -vx ".topdeps" |
fgrep -vx ".topmsg" >"$git_is_stupid" || : # fgrep likes to fail randomly?
if [ -s "$git_is_stupid" ]; then
- cat "$git_is_stupid" | xargs git diff --patch-with-stat "$base_rev" "$name" --
+ cat "$git_is_stupid" | xargs git diff --patch-with-stat $diff_opts "$base_rev" ${diff_committed_only:+"$name"} --
else
echo "No changes."
fi
rm "$git_is_stupid"
echo '-- '
-echo "tg: ($base_rev..) $name (depends on: $(git cat-file blob "$name:.topdeps" | paste -s -d' '))"
+echo "tg: ($base_rev..) $name (depends on: $(cat_file "$topic:.topdeps" | paste -s -d' '))"
branch_contains "$name" "$base_rev" ||
echo "tg: The patch is out-of-date wrt. the base! Run \`$tg update\`."
diff --git a/tg.sh b/tg.sh
index b64fc3a..ab0db52 100644
--- a/tg.sh
+++ b/tg.sh
@@ -17,6 +17,27 @@ die()
exit 1
}
+# cat_file "topic:file"
+# Like `git cat-file blob $1`, but topics (i) and (w) means index and worktree
+cat_file()
+{
+ arg="$1"
+ case "$arg" in
+ '(w):'*)
+ arg=$(echo "$arg" | tail --bytes=+5)
+ cat "$arg"
+ return
+ ;;
+ '(i):'*)
+ # ':file' means cat from index
+ arg=$(echo "$arg" | tail --bytes=+5)
+ git cat-file blob ":$arg"
+ ;;
+ *)
+ git cat-file blob "$arg"
+ esac
+}
+
# setup_hook NAME
setup_hook()
{
--
tg: (a3a5be1..) t/tg-patch-worktree (depends on: t/tg-patch-setup-pager)
^ permalink raw reply related
* Re: Git (svn) merge - but ignore certain commits?
From: Peter Harris @ 2009-01-08 18:29 UTC (permalink / raw)
To: Peter Valdemar Mørch (Lists); +Cc: git
In-Reply-To: <49663CA2.90102@sneakemail.com>
On Thu, Jan 8, 2009 at 12:49 PM, "Peter Valdemar Mørch (Lists)" wrote:
>
> However *the* problem was with repeated merges: I later discovered a problem
> on the branch and need to add a commit for it to both master and
> newbranch/gitnewbranch. Aside from git cherry-pick (where I take care of the
> repeated merge problem) I still haven't found a good solution.
Well, the real problem is that it *isn't* a repeated merge. Subversion
rebased your trunk on you, so you...
> I ended up using git cherry-pick, and diff and patch / git diff and git
> apply.
...wind up needing to do this.
Don't rebase trunk (which implies ditching subversion,
(un)fortunately), and repeated merges should Just Work. See, for
example, the git repository itself, where the master branch is
repeatedly merged into next.
Peter Harris
^ permalink raw reply
* Re: [EGIT PATCH 7/7] Create an automatic UI test for the Git Import Wizard
From: Robin Rosenberg @ 2009-01-08 18:45 UTC (permalink / raw)
To: spearce; +Cc: git
In-Reply-To: <1231433791-9267-8-git-send-email-robin.rosenberg@dewire.com>
Oops. We should not require Java 6 yet. Please squash this in.
-- robin
diff --git a/org.spearce.egit.ui.test/.classpath b/org.spearce.egit.ui.test/.classpath
index 76279f3..13116da 100644
--- a/org.spearce.egit.ui.test/.classpath
+++ b/org.spearce.egit.ui.test/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
^ permalink raw reply related
* [PATCH, resend] git-commit: colored status when color.ui is set
From: Markus Heidelberg @ 2009-01-08 18:53 UTC (permalink / raw)
To: gitster; +Cc: git
When using "git commit" and there was nothing to commit (the editor
wasn't launched), the status output wasn't colored, even though color.ui
was set. Only when setting color.status it worked.
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
builtin-commit.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index e88b78f..2d90f74 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -945,6 +945,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
git_config(git_commit_config, NULL);
+ if (wt_status_use_color == -1)
+ wt_status_use_color = git_use_color_default;
+
argc = parse_and_validate_options(argc, argv, builtin_commit_usage, prefix);
index_file = prepare_index(argc, argv, prefix);
--
1.6.1.35.g0c23
^ permalink raw reply related
* [PATCH, resend] bash completion: add 'rename' subcommand to git-remote
From: Markus Heidelberg @ 2009-01-08 18:53 UTC (permalink / raw)
To: gitster; +Cc: git
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
contrib/completion/git-completion.bash | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 187f3de..4717c93 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1369,7 +1369,7 @@ _git_config ()
_git_remote ()
{
- local subcommands="add rm show prune update"
+ local subcommands="add rename rm show prune update"
local subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
@@ -1377,7 +1377,7 @@ _git_remote ()
fi
case "$subcommand" in
- rm|show|prune)
+ rename|rm|show|prune)
__gitcomp "$(__git_remotes)"
;;
update)
--
1.6.1.35.g0c23
^ permalink raw reply related
* [PATCH, resend] git-status -v: colored diff when color.ui is set
From: Markus Heidelberg @ 2009-01-08 18:53 UTC (permalink / raw)
To: gitster; +Cc: git
When using "git status -v", the diff output wasn't colored, even though
color.ui was set. Only when setting color.diff it worked.
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
builtin-commit.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 2d90f74..7cf227a 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -866,6 +866,9 @@ int cmd_status(int argc, const char **argv, const char *prefix)
if (wt_status_use_color == -1)
wt_status_use_color = git_use_color_default;
+ if (diff_use_color_default == -1)
+ diff_use_color_default = git_use_color_default;
+
argc = parse_and_validate_options(argc, argv, builtin_status_usage, prefix);
index_file = prepare_index(argc, argv, prefix);
--
1.6.1.35.g0c23
^ permalink raw reply related
* Re: [EGIT PATCH 7/7] Create an automatic UI test for the Git Import Wizard
From: Robin Rosenberg @ 2009-01-08 18:57 UTC (permalink / raw)
To: spearce; +Cc: git
In-Reply-To: <1231433791-9267-8-git-send-email-robin.rosenberg@dewire.com>
We could hold onto this patch. It might be better if we start the built in git daemon and clone
from it, or from file, instread of jgit.org, but please try it out and see if it looks like a good a approach to
use SWTBot for UI tests.
-- robin
^ permalink raw reply
* Re: Git (svn) merge - but ignore certain commits?
From: "Peter Valdemar Mørch (Lists)" @ 2009-01-08 19:17 UTC (permalink / raw)
To: Peter Harris git-at-peter.is-a-geek.org |Lists|; +Cc: git
In-Reply-To: <eaa105840901081029h220e06e4m1a1af693e908751e@mail.gmail.com>
Peter Harris git-at-peter.is-a-geek.org |Lists| wrote:
> Well, the real problem is that it *isn't* a repeated merge. Subversion
> rebased your trunk on you, so you...
>
>> I ended up using git cherry-pick, and diff and patch / git diff and git
>> apply.
>
> ...wind up needing to do this.
>
> Don't rebase trunk (which implies ditching subversion,
> (un)fortunately), and repeated merges should Just Work. See, for
> example, the git repository itself, where the master branch is
> repeatedly merged into next.
Ah, yes. I understand. Thanks for making it more clear to me. There are
two different problems at play here:
1) git svn doesn't help with the fact that svn can't handle the repeated
merge problem (just noise here)
2) The git-only repeated-merge problem still exists, if I want a commit
on the branch, but *do not* want it merged back to "master". This I
still don't see a solution for. E.g.:
---A---B---C---D--+ "master"
\--E---F---G-/ "branch"
Here I want F and G merged back to "master", but *not* E (which is a
quick-and-dirty but safe version of B). That still seems not to be
possible. What I did was:
---A---B---C---D--+- "master"
| /
|\--F---G----+ "devbranch"
| \
\--E----------+- "branch"
(So F and G got merged from "devbranch" to both "master" and "branch",
but E stayed on "branch" only)
I could do that because the system worked somewhat without E and I was
able to develop/test F and G without E. But I'd still be out of luck if
I needed to work on "branch". There seems to me to be no way in the
first two-branch scenario to do repeated merges from "branch" to
"master" if I need to avoid that E gets merged back to "master".
But thanks, Peter, for helping me understand. "git svn" and the fact
that E happened to be a revert where just noise and had nothing to do
with the core problem (2). That still has no solution, or am I missing
something?
Peter
--
Peter Valdemar Mørch
http://www.morch.com
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox