Skip to content

Instantly share code, notes, and snippets.

@samueljohn

samueljohn/gist:5280700

Last active Dec 15, 2015
Embed
What would you like to do?
Moving homebrew formulae from one repo (mxcl/master) into another one... Based on @jacknagel's instructions.
diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://1048576`
cd $(brew --repository)
git checkout -b moveit
git filter-branch --prune-empty --index-filter 'git ls-files --full-name --cached | grep -F --invert-match --file=/tmp/list --color=never | xargs git rm --quiet --cached --ignore−unmatch' --subdirectory-filter 'Library/Formula' -d /Volumes/ramdisk -f moveit
cd the-target-repro
git fetch $(brew --repository)
git merge moveit
@samueljohn

This comment has been minimized.

Copy link
Owner Author

@samueljohn samueljohn commented Mar 31, 2013

The git ls-files --full-name --cached | grep -F --invert-match --file=/tmp/list --color=never part seems to work fine, it lists all files/dirs but not the formulae names listed in /tmp/list.

The output is something like:

rm: /Volumes/ramdisk: Resource busy
Rewrite b48bb58df7ba6dbe35a1d6d6c1d165ed957e97dc (9748/16197)

...and seems to succeed. I am not sure if the "Resource busy" is a problem or not.

@samueljohn

This comment has been minimized.

Copy link
Owner Author

@samueljohn samueljohn commented Mar 31, 2013

The ramdisk is populated with a temporary git repository during this process (so files are being written).

@samueljohn

This comment has been minimized.

Copy link
Owner Author

@samueljohn samueljohn commented Mar 31, 2013

I guess I know what is going on ... the xargs has a unnecessary -0 in my case.

@samueljohn

This comment has been minimized.

Copy link
Owner Author

@samueljohn samueljohn commented Mar 31, 2013

updated the gist

@adamv

This comment has been minimized.

Copy link

@adamv adamv commented Aug 31, 2013

Where is the file to keep specified?

@samueljohn

This comment has been minimized.

Copy link
Owner Author

@samueljohn samueljohn commented Dec 4, 2013

The files to move are in /tmp/files in this example. I should update the gist with a line to populate that file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment