Here's an alternative script:
mkdir ${checkoutDirectory}
cd ${checkoutDirectory}
git init
git remote add -t ${siteBranch} origin ${gitRepoUrl}
git fetch
git checkout ${siteBranch}
<replace the contents of the checkout directory, except for the .git
subdirectory, with the site docs>
git add .
git commit -a -m "Deploy site documentation"
git push
rm -Rf ${checkoutDirectory}
-K
On Apr 2, 2010, at 11:28 AM, Kathryn Huxtable wrote:
> So looking at the git SCM code (git-commons and gitexe) and at the wagon-scm
> code, the problem I see is that there is no syntax in the git SCM url to
> specify a branch to which to deploy the site. Not a surprise, since git
> generally wants to clone an entire repository and then push and pull things.
>
> The desired process would be something along the lines of the following. (In
> UN*X-y/scripty/Velocity-y format.)
>
> mkdir ${checkoutDirectory}
> cd ${checkoutDirectory}
> git init
> git remote add origin ${gitRepoUrl}
> git pull origin refs/heads/${siteBranch}
> <replace the contents of the checkout directory, except for the .git
> subdirectory, with the site docs>
> git add .
> git commit -a -m "Deploy site documentation."
> git push origin master:${siteBranch}
> rm -Rf ${checkoutDirectory}
>
> This works.
>
> Obviously, we wouldn't want to mess up the git SCM for other uses. Does the
> release plugin use the wagon? I *really* don't want to end up looking at all
> the Maven source code.
>
> Any ideas on where changes need to be made? In wagon-scm? In gitexe or
> git-commons?
>
> I see no way to configure wagons, which I find a bit of a lack. I suppose the
> URL structure and username/password info in settings.xml is supposed to take
> care of everything. Should there be a "branch" element in the git scm url
> structure a la the "module" element in CVS scm urls?
>
> -K
>
> On Apr 1, 2010, at 4:24 PM, Kathryn Huxtable wrote:
>
>> Yeah, that's more or less what I mean. -K
>>
>> On Apr 1, 2010, at 4:09 PM, Mark Struberg wrote:
>>
>>> I honestly doubt that wagon-scm + CVS currently works when using branches
>>> (from glimpsing at the sources).
>>>
>>> And I'm not sure what you mean with forking it. Wouldn't it be much easier
>>> to simply checkout wagon-scm and if you found a way to provide the branch
>>> as ScmVersion (ScmBranch and ScmTag are subclassses of ScmVersion [3]),
>>> then simply open a Jira issue and add your changes as patch. Patches are
>>> always highly welcome :)
>>>
>>> txs and LieGrue,
>>> strub
>>>
>>> [3] http://maven.apache.org/scm/apidocs/org/apache/maven/scm/ScmBranch.html
>>>
>>>
>>> --- Kathryn Huxtable <[email protected]> schrieb am Do, 1.4.2010:
>>>
>>>> Von: Kathryn Huxtable <[email protected]>
>>>> Betreff: Re: Problem with wagon-scm and gitexe
>>>> An: "Maven Users List" <[email protected]>
>>>> Datum: Donnerstag, 1. April, 2010 22:43 Uhr
>>>> Thanks, Mark,
>>>>
>>>> These are good points.
>>>>
>>>> I'm thinking that the issues are in wagon-scm, which is
>>>> listed as being "in progress", so I can't really expect
>>>> perfection. And they *do* say it's only been tested with svn
>>>> and cvs. I'm thinking that I may be modding wagon-svn, more
>>>> to see what's going on than to fork a project.
>>>>
>>>> All of this is by the way. I really should be working on my
>>>> project, not fiddling with tools, but fiddling with tools is
>>>> fun sometimes.
>>>>
>>>> -K
>>>>
>>>> On Apr 1, 2010, at 3:37 PM, Mark Struberg wrote:
>>>>
>>>>> Kathryn,
>>>>>
>>>>> I haven't used wagon-scm, so I can only make vague
>>>> assumptions.
>>>>> Basically all the branches and tag stuff should be
>>>> working in maven-scm-provider-gitexe. But I'm not sure how
>>>> wagon-scm tells us what branch it likes to use.
>>>>>
>>>>> From looking at the source [1] I only can see that all
>>>> ScmVersion parameters are always given as null. So I'm not
>>>> sure if that could work at all.
>>>>>
>>>>> Please keep in mind that SVN is really exceptional
>>>> with handling branches by copying the trunk to a new
>>>> location. This way you get an own URL which you won't get in
>>>> most other SCMs like CVS, PVCS, git or hg. In fact SVN
>>>> doesn't have a 'real' branch and tag concept but internally
>>>> always performs a full shallow copy.
>>>>>
>>>>> So it would be interesting if this would also work
>>>> e.g. with CVS.
>>>>>
>>>>> LieGrue,
>>>>> strub
>>>>>
>>>>> [1]
>>>>> http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-scm/src/main/java/org/apache/maven/wagon/providers/scm/ScmWagon.java?view=markup
>>>>>
>>>>> --- Kathryn Huxtable <[email protected]>
>>>> schrieb am Do, 1.4.2010:
>>>>>
>>>>>> Von: Kathryn Huxtable <[email protected]>
>>>>>> Betreff: Re: Problem with wagon-scm and gitexe
>>>>>> An: "Maven Users List" <[email protected]>
>>>>>> Datum: Donnerstag, 1. April, 2010 19:21 Uhr
>>>>>> Since it seems to be my practice to
>>>>>> have second thought after sending a message, I'll
>>>> add that I
>>>>>> can check out the gh-pages branch of my git
>>>> repository into
>>>>>> a separate directory and deploy there using a
>>>> "file:" URL
>>>>>> and then commit that and push it.
>>>>>>
>>>>>> That works. I just think it should be able to be
>>>>>> automated.
>>>>>>
>>>>>> -K
>>>>>>
>>>>>> On Apr 1, 2010, at 12:14 PM, Kathryn Huxtable
>>>> wrote:
>>>>>>
>>>>>>> I know the docs say that wagon-scm has only
>>>> been
>>>>>> tested with CVS and Subversion, and I've run it
>>>> with
>>>>>> Subversion successfully.
>>>>>>>
>>>>>>> Is anyone working on getting it to work with
>>>> Git, or
>>>>>> does it already?
>>>>>>>
>>>>>>> I created a very simply project with a README
>>>> and a
>>>>>> pom.xml and nothing else. It's at
>>>>>>>
>>>>>>> http://github.com/khuxtable/test-project
>>>>>>>
>>>>>>> It uses versions 1.3 of the gitexe and
>>>>>> scm-manager-plexus extensions and version
>>>> 1.0-beta-6 of the
>>>>>> scm wagon.
>>>>>>>
>>>>>>> What I would like to do is deploy my site docs
>>>> (all
>>>>>> generated by the site plugin) to the gh-pages
>>>> branch of the
>>>>>> git repository. I don't see any way in the Git SCM
>>>> URL
>>>>>> structure to specify a branch. If there was a way
>>>> to do this
>>>>>> it would be cool.
>>>>>>>
>>>>>>> But at the moment, with the URL
>>>>>>>
>>>>>>> scm:git:ssh://[email protected]/khuxtable/test-project.git
>>>>>>>
>>>>>>> I get the following:
>>>>>>>
>>>>>>> [INFO] [site:deploy {execution: default-cli}]
>>>>>>>
>>>> scm:git:ssh://github.com/khuxtable/test-project.git -
>>>>>> Session: Opened
>>>>>>> Uploading: . to
>>>>>>
>>>> scm:git:ssh://github.com/khuxtable/test-project.git
>>>>>>>
>>>>>>> [INFO] Executing: /bin/sh -c cd
>>>>>>
>>>> /Users/huxtable/Documents/workspace/test-project/.
>>>>>> && git ls-files
>>>>>>> [INFO] Working directory:
>>>>>>
>>>> /Users/huxtable/Documents/workspace/test-project/.
>>>>>>> [INFO] Executing: /bin/sh -c cd
>>>>>> /var/folders/M+/M+95phY6GfOYTLYCJKW4Bk+++TI/-Tmp-
>>>> &&
>>>>>> git clone ssh://[email protected]/khuxtable/test-project.git/.
>>>>>>
>>>> /var/folders/M+/M+95phY6GfOYTLYCJKW4Bk+++TI/-Tmp-/wagon-scm223596417.checkout
>>>>>>> [INFO] Working directory:
>>>>>> /var/folders/M+/M+95phY6GfOYTLYCJKW4Bk+++TI/-Tmp-
>>>>>>> Transfer error:
>>>> org.apache.maven.scm.ScmException:
>>>>>> Unable to commit file. The git-clone command
>>>> failed. ERROR:
>>>>>> Repository not found. Make sure you include
>>>> the .git,
>>>>>> e.g. [email protected]:defunkt/ambition.git
>>>>>>> fatal: The remote end hung up unexpectedly
>>>>>>>
>>>>>>>
>>>> scm:git:ssh://github.com/khuxtable/test-project.git -
>>>>>> Session: Disconnecting
>>>>>>>
>>>> scm:git:ssh://github.com/khuxtable/test-project.git -
>>>>>> Session: Disconnected
>>>>>>>
>>>>>>> I particularly like the "/." after the
>>>> repository
>>>>>> name. Funny.
>>>>>>>
>>>>>>> The maven release plugin behaves fine with the
>>>> same
>>>>>> developerConnection as my site URL above.
>>>>>>>
>>>>>>> Any ideas? I'm happy to help out with making
>>>> this
>>>>>> work, though I'm not a committer at this point.
>>>>>>>
>>>>>>> -K
>>>>>>
>>>>>>
>>>>>>
>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>> For additional commands, e-mail: [email protected]
>>>>>>
>>>>>>
>>>>>
>>>>> __________________________________________________
>>>>> Do You Yahoo!?
>>>>> Sie sind Spam leid? Yahoo! Mail verfügt über einen
>>>> herausragenden Schutz gegen Massenmails.
>>>>> http://mail.yahoo.com
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>>
>>> __________________________________________________
>>> Do You Yahoo!?
>>> Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz
>>> gegen Massenmails.
>>> http://mail.yahoo.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]