rtyley / bfg-repo-cleaner

Removes large or troublesome blobs like git-filter-branch does, but faster. And written in Scala
https://rtyley.github.io/bfg-repo-cleaner/
GNU General Public License v3.0
11.03k stars 545 forks source link

wish list: move files #84

Open jwaterloo opened 9 years ago

jwaterloo commented 9 years ago

could you provide an option to move files as found in http://stackoverflow.com/questions/2314652/is-it-possible-to-move-rename-files-in-git-and-maintain-their-history, in particular git filter-branch --tree-filter 'if [ -f old ]; then mkdir dir && mv old dir/new; fi' HEAD

The use case is I am migrating a project to maven and I want the files to be in the standard directory layout with all of the individual files history in tact as if it was always structured so.

rtyley commented 9 years ago

Hi @jwaterloo, there's a fundraiser for that exact functionality here https://www.bountysource.com/teams/bfg-repo-cleaner/fundraiser

jwaterloo commented 9 years ago

On 2/26/2015 10:19 AM, Roberto Tyley wrote:

Hi @jwaterloo https://github.com/jwaterloo, there's a fundraiser for that exact functionality here https://www.bountysource.com/teams/bfg-repo-cleaner/fundraiser

— Reply to this email directly or view it on GitHub https://github.com/rtyley/bfg-repo-cleaner/issues/84#issuecomment-76195695.

Thanks, the link is about path based deleting but it doesn't say anything about moving. Am I the only one who want to be able to move files. I have been googling and haven't found anyone of similar mind.

rtyley commented 9 years ago

Yep, it mentions deleting, but the work is specifically to address the BFG not supporting path-based operations (which, of course, is what moving a file between folders requires) - path-based ops are the main blocker to the BFG providing that functionality.

astorije commented 8 years ago

Hi @rtyley, any news on moving files in a repository?

I have to move all files of a repo to a subfolder (about 20k commits) and it takes about an hour and a half using git filter-branch. Any chance I can do that using BFG?

Thanks!

rtyley commented 8 years ago

Moving files is a path operation, and unfortunately the _Support Paths in the _BFG! fundraiser raised only 4% of the goal amount, so I haven't been able to spend any more time on it. If you'd like to sponsor this work, let me know! On 11 Jan 2016 23:25, "Jérémie Astori" notifications@github.com wrote:

Hi @rtyley https://github.com/rtyley, any news on moving files in a repository?

I have to move all files of a repo to a subfolder (about 20k commits) and it takes about an hour and a half using git filter-branch. Any chance I can do that using BFG?

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/rtyley/bfg-repo-cleaner/issues/84#issuecomment-170730728 .

javabrett commented 8 years ago

I started taking a look at this - with a simple scope of being able to insert a single-level single-directory entry into the root tree, and then move all the existing root entries to nest under that single directory. That would be accomplished by creating a new root tree, the subtree entry in it, then make that subtree's entries those of the original root tree. Then assign that tree to the commit.

Sounds simple enough, but it's not completely obvious how to achieve this with the current scala-git library classes. They may need some additional access points, I'm not sure yet. Any tips appreciated :).

javabrett commented 8 years ago

I got the feeling that I would be best to do this in ObjectIdCleaner so that replacement of the root tree could be properly memoized. But since cleanTree must be called recursively I need a way to specify that the root-tree replacement should only be made on the initial call. I'd find this easy enough in Java, but with the way these memo functions are built it is less-clear how to create a special case there.