[Vm-dev] equivalent of svn export...

Ben Coman btc at openinworld.com
Tue Jun 28 00:57:36 UTC 2016


On Tue, Jun 28, 2016 at 8:28 AM, Ben Coman <btc at openinworld.com> wrote:
> On Tue, Jun 28, 2016 at 2:08 AM, Eliot Miranda <eliot.miranda at gmail.com> 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


More information about the Vm-dev mailing list