equivalent of svn export...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

equivalent of svn export...

Eliot Miranda-2
 
Hi All,

    I have build.linux32ARM which is full of generated crap.  I have renamed it to build.linux32ARMv6 via git mv build.linux32ARM build.linux32ARMv6.  So far so good.  Now I want to clone the clean state of build.linux32ARMv6 (or of https://github.com/OpenSmalltalk/vm/build.linux32ARMv6) to create the clean state of build.linux32ARMv7. But I can't?!?!?

In Subversion one can extract a subdirectory of the entire repository; great for Travis builds, where one doesn't waste time cloning the entire repository.  Does git simply not support this?  I see
but it doesn't appear to offer a solution beyond cloning the entire repository :-(
_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: equivalent of svn export...

Eliot Miranda-2
 


On Mon, Jun 27, 2016 at 11:08 AM, Eliot Miranda <[hidden email]> wrote:
Hi All,

    I have build.linux32ARM which is full of generated crap.  I have renamed it to build.linux32ARMv6 via git mv build.linux32ARM build.linux32ARMv6.  So far so good.  Now I want to clone the clean state of build.linux32ARMv6 (or of https://github.com/OpenSmalltalk/vm/build.linux32ARMv6) to create the clean state of build.linux32ARMv7. But I can't?!?!?

In Subversion one can extract a subdirectory of the entire repository; great for Travis builds, where one doesn't waste time cloning the entire repository.  Does git simply not support this?  I see
but it doesn't appear to offer a solution beyond cloning the entire repository :-(
_,,,^..^,,,_
best, Eliot


BTW, my hack is to maintain a clone of the repository I'm calling oscogvm.clean, as a sibling of my oscogvm clone of OpenSmalltalk/vm, and when I want to access it I'll do a git pull and then copy what I want.  Expensive, and error-prone, but functional.

_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: equivalent of svn export...

Jakob Reschke-2
In reply to this post by Eliot Miranda-2
 
Hi Elliot,

as far as I know, git does not support cloning only part of a
repository (you can checkout only parts of it, but need to clone the
entire history anyway). However, I think these people have all the
answers for you:
http://stackoverflow.com/questions/7106012/download-a-single-folder-or-directory-from-a-github-repo

In short: Since GitHub allows you to access repositories via svn, you
can simply use svn export to extract a clean subdirectory.

Otherwise you would use `git archive` for similar tasks; it creates
compressed files from arbitrary trees (e. g., git archive -o
build.linux32ARMv6.zip HEAD:build.linux32ARMv6, where HEAD can be any
revision). git archive also has a --remote option, which seems to
allow one to do similar things like svn export on remote repositories,
but GitHub does not support that. See this answer:
http://stackoverflow.com/a/15983139/383568

Best regards,
Jakob

2016-06-27 20:08 GMT+02:00 Eliot Miranda <[hidden email]>:
>
Reply | Threaded
Open this post in threaded view
|

Re: equivalent of svn export...

Tobias Pape
In reply to this post by Eliot Miranda-2

Hi Eliot
On 27.06.2016, at 20:08, Eliot Miranda <[hidden email]> wrote:

> Hi All,
>
>     I have build.linux32ARM which is full of generated crap.  I have renamed it to build.linux32ARMv6 via git mv build.linux32ARM build.linux32ARMv6.  So far so good.  Now I want to clone the clean state of build.linux32ARMv6 (or of https://github.com/OpenSmalltalk/vm/build.linux32ARMv6) to create the clean state of build.linux32ARMv7. But I can't?!?!?
>
> In Subversion one can extract a subdirectory of the entire repository; great for Travis builds, where one doesn't waste time cloning the entire repository.  Does git simply not support this?  I see
>   http://stackoverflow.com/questions/160608/do-a-git-export-like-svn-export
> but it doesn't appear to offer a solution beyond cloning the entire repository :-(

I have not yet grasped your use case, please help me there.

You want to maintain both build.linux32ARMv6  and build.linux32ARMv7, but
build.linux32ARMv7 is actually build.linux32ARM?

If so, what about:

mv build.linux32ARM build.linux32ARMv7 #note no git
git checkout -- build.linux32ARM
mv build.linux32ARM build.linux32ARMv6

and then `git add` the pieces of build.linux32ARMv6  and build.linux32ARMv7
as necessary and `commit` or replace the latter with `git mv`?

If it is only for local development to get a clean slate, it is quite similar, but
leave out the `commit` or `git mv` part…

HTH

Best
        -Tobias

Reply | Threaded
Open this post in threaded view
|

Re: equivalent of svn export...

Ben Coman
In reply to this post by Eliot Miranda-2

On Tue, Jun 28, 2016 at 2:08 AM, Eliot Miranda <[hidden email]> wrote:
>
> Hi All,
>
>     I have build.linux32ARM which is full of generated crap.  I have renamed it to build.linux32ARMv6 via git mv build.linux32ARM build.linux32ARMv6.  So far so good.  Now I want to clone the clean state of build.linux32ARMv6 (or of https://github.com/OpenSmalltalk/vm/build.linux32ARMv6) to create the clean state of build.linux32ARMv7. But I can't?!?!?

I was curious to learn the answer to this, so I found these...

Stack Overflow, Record file copy operation with Git:
Git does not do rename tracking nor copy tracking,
which means it doesn't record renames or copies.
What it does instead is rename and copy detection
http://stackoverflow.com/questions/1043388/record-file-copy-operation-with-git

One of the things Git gets right:
Fancy file rename and copy detection deduced merely by looking at the
commit graph. It doesn't need any metadata to be stored. If you store
metadata, you're locking yourself into the best algorithms you had at
the time of storage; if you forget metadata and instead deduce you can
always use the very best algorithms available at the time you examine
the history.
http://www.wincent.com/a/about/wincent/weblog/archives/2007/11/one_of_the_thin.php

Git Mail List, How to fork a file (git cp ?)
Øyvind A. Holm response:
Git has a rename command git mv, but that is just for
convenience. The effect is indistinguishable from removing the file and
adding another with different name and the same content
http://git.661346.n2.nabble.com/How-to-fork-a-file-git-cp-td6331860.html

Code Archaeology With Git:
takes a look at techniques for separating the interesting commits from
the uninteresting ones
http://jfire.io/blog/2012/03/07/code-archaeology-with-git/

Configure git diff to default to rename and copy detection:
    git config --global diff.renames copies
http://nuclearsquid.com/writings/git-tricks-tips-workflows/

>
> In Subversion one can extract a subdirectory of the entire repository; great for Travis builds, where one doesn't waste time cloning the entire repository.  Does git simply not support this?  I see
>   http://stackoverflow.com/questions/160608/do-a-git-export-like-svn-export
> but it doesn't appear to offer a solution beyond cloning the entire repository :-(

Build systems can use a shallow clone...
   git clone --depth depth remote-url
or single branch clone...
  git clone URL --branch branch_name --single-branch [folder]
http://blogs.atlassian.com/2014/05/handle-big-repositories-git/

cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: equivalent of svn export...

Ben Coman

On Tue, Jun 28, 2016 at 8:28 AM, Ben Coman <[hidden email]> wrote:

> On Tue, Jun 28, 2016 at 2:08 AM, Eliot Miranda <[hidden email]> wrote:
>>
>> Hi All,
>>
>>     I have build.linux32ARM which is full of generated crap.  I have renamed it to build.linux32ARMv6 via git mv build.linux32ARM build.linux32ARMv6.  So far so good.  Now I want to clone the clean state of build.linux32ARMv6 (or of https://github.com/OpenSmalltalk/vm/build.linux32ARMv6) to create the clean state of build.linux32ARMv7. But I can't?!?!?
>
> I was curious to learn the answer to this, so I found these...
>
> Stack Overflow, Record file copy operation with Git:
> Git does not do rename tracking nor copy tracking,
> which means it doesn't record renames or copies.
> What it does instead is rename and copy detection
> http://stackoverflow.com/questions/1043388/record-file-copy-operation-with-git
>
> One of the things Git gets right:
> Fancy file rename and copy detection deduced merely by looking at the
> commit graph. It doesn't need any metadata to be stored. If you store
> metadata, you're locking yourself into the best algorithms you had at
> the time of storage; if you forget metadata and instead deduce you can
> always use the very best algorithms available at the time you examine
> the history.
> http://www.wincent.com/a/about/wincent/weblog/archives/2007/11/one_of_the_thin.php
>
> Git Mail List, How to fork a file (git cp ?)
> Øyvind A. Holm response:
> Git has a rename command git mv, but that is just for
> convenience. The effect is indistinguishable from removing the file and
> adding another with different name and the same content
> http://git.661346.n2.nabble.com/How-to-fork-a-file-git-cp-td6331860.html
>
> Code Archaeology With Git:
> takes a look at techniques for separating the interesting commits from
> the uninteresting ones
> http://jfire.io/blog/2012/03/07/code-archaeology-with-git/
>
> Configure git diff to default to rename and copy detection:
>     git config --global diff.renames copies
> http://nuclearsquid.com/writings/git-tricks-tips-workflows/
>
>>
>> In Subversion one can extract a subdirectory of the entire repository; great for Travis builds, where one doesn't waste time cloning the entire repository.  Does git simply not support this?  I see
>>   http://stackoverflow.com/questions/160608/do-a-git-export-like-svn-export
>> but it doesn't appear to offer a solution beyond cloning the entire repository :-(
>
> Build systems can use a shallow clone...
>    git clone --depth depth remote-url
> or single branch clone...
>   git clone URL --branch branch_name --single-branch [folder]
> http://blogs.atlassian.com/2014/05/handle-big-repositories-git/
>
> cheers -ben

A couple more useful reads...

gitdiffcore(7) - Linux man page
Authoritative reference, with worked example.
scroll down to... DIFFCORE-RENAME
http://linux.die.net/man/7/gitdiffcore

Git Secrets Revealed
Git heuristically ferrets out renames and copies between successive
versions. In fact, it can detect chunks of code being moved or copied
around between files! [Also read the short section on "Blobs"]
http://www-cs-students.stanford.edu/~blynn/gitmagic/ch08.html



I'm not at a computer where I can test this, but in summary I would just try...
$ git checkout -b splitARM Cog
$ mv build.linux32ARM build.linux32ARMv6
$ cp -r build.linux32ARMv6 build.linux32ARMv7
$ git add build.linux32ARMv6 build.linux32ARMv7
$ git commit -m "Split ARM build into ARMv6/ARMv7"
$ git diff -M -C --summary Cog

You might first want to
$ cp -r oscogvm oscogvm.practice

cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: equivalent of svn export...

EstebanLM
 
Hi, 


On 28 Jun 2016, at 02:57, Ben Coman <[hidden email]> wrote:

I'm not at a computer where I can test this, but in summary I would just try...
$ git checkout -b splitARM Cog
$ mv build.linux32ARM build.linux32ARMv6
$ cp -r build.linux32ARMv6 build.linux32ARMv7
$ git add build.linux32ARMv6 build.linux32ARMv7
$ git commit -m "Split ARM build into ARMv6/ARMv7"
$ git diff -M -C --summary Cog

I’m not sure either what’s the purpose of checking out just a directory… in git, since it does global versions for commits, it does not has much sense… also git is designed to do the branching a very easy/efficient task open a new branch… and then merging back is a second-time task). 
So I suppose this is the right way to do it… I imagine that different tools means sometimes different ways of doing things, and forcing “old way” can be not as effective as it was before. 

+1 for this step list :)

You might first want to
$ cp -r oscogvm oscogvm.practice

why? if you made a mistake you can just kill the branch :)

Esteban
Reply | Threaded
Open this post in threaded view
|

Re: equivalent of svn export...

Ben Coman

On Tue, Jun 28, 2016 at 3:21 PM, Esteban Lorenzano <[hidden email]> wrote:

>
> Hi,
>
>
> On 28 Jun 2016, at 02:57, Ben Coman <[hidden email]> wrote:
>
> I'm not at a computer where I can test this, but in summary I would just try...
> $ git checkout -b splitARM Cog
> $ mv build.linux32ARM build.linux32ARMv6
> $ cp -r build.linux32ARMv6 build.linux32ARMv7
> $ git add build.linux32ARMv6 build.linux32ARMv7
> $ git commit -m "Split ARM build into ARMv6/ARMv7"
> $ git diff -M -C --summary Cog
>
>
> I’m not sure either what’s the purpose of checking out just a directory… in git, since it does global versions for commits, it does not has much sense… also git is designed to do the branching a very easy/efficient task open a new branch… and then merging back is a second-time task).
> So I suppose this is the right way to do it… I imagine that different tools means sometimes different ways of doing things, and forcing “old way” can be not as effective as it was before.
>
> +1 for this step list :)
>
> You might first want to
> $ cp -r oscogvm oscogvm.practice
>
>
> why? if you made a mistake you can just kill the branch :)
>

You are right.  But it can give a bit a freedom while experimenting to
build confidence with a new system.
cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: equivalent of svn export...

Eliot Miranda-2
In reply to this post by EstebanLM
 
Hi Esteban,

On Jun 28, 2016, at 12:21 AM, Esteban Lorenzano <[hidden email]> wrote:

Hi, 


On 28 Jun 2016, at 02:57, Ben Coman <[hidden email]> wrote:

I'm not at a computer where I can test this, but in summary I would just try...
$ git checkout -b splitARM Cog
$ mv build.linux32ARM build.linux32ARMv6
$ cp -r build.linux32ARMv6 build.linux32ARMv7
$ git add build.linux32ARMv6 build.linux32ARMv7
$ git commit -m "Split ARM build into ARMv6/ARMv7"
$ git diff -M -C --summary Cog

I’m not sure either what’s the purpose of checking out just a directory… in git, since it does global versions for commits, it does not has much sense… also git is designed to do the branching a very easy/efficient task open a new branch… and then merging back is a second-time task). 

At Cadence there are automatic build of only VMs derived from nsspursrc and only on build.linux32x86, so when we were on subversion we would check out these and processors and build and save time and space.  Now we have to check out the whole thing.

So I suppose this is the right way to do it… I imagine that different tools means sometimes different ways of doing things, and forcing “old way” can be not as effective as it was before. 

+1 for this step list :)

You might first want to
$ cp -r oscogvm oscogvm.practice

why? if you made a mistake you can just kill the branch :)

+1


Esteban