git - find a branching off point for repo-less code -
git - find a branching off point for repo-less code -
i have rails plugin copied git repo script/plugin install @ point. later, local patches added it. want maintain code separate branch in fork of original plugin's own repo.
given git repo , code tree, what's way find commit closest new code, e.g. minimizing total amount of diff lines?
if can recover timestamp when cloned repo, commit closest , branch there. otherwise, going have hairy time.
you asking minimum edit distance between code , git repo, np-hard problem, , bad 1 in case since need tree diffs , edit distance of each git blob (that is, code files , other objects).
you seek find needle in haystack help of git-tree-diff, first cloning repo of plugin, making branch, committing changes on top of it. tree-diff allow assess difference, you'd have repeat every commit, , hell.
instead, take current code, above can 1 huge diff master's head of plugin repo, seek split changes many atomic commits can.
it'll hurt, might see end of it.
edit: here alternative may prove tractable, albeit still annoying. since have history , can earliest version, can calculate git hash blobs "original" files , find them in history of owner's repo. in history, check out plugin before made changes. allow calculate blob hash individual file , content. can search through git history on official repo blob hashes find. identify @ point, @ commit, plugin file @ when installed it. can compare , find oldest commit.
the kernel.org git docs provide illustration this:
git log --raw --abbrev=40 --pretty=oneline | grep -b 1 `git hash-object filename`
this find commit w/ hash, author, , timestamp. seek think of way of farther automating easily.
git ruby-on-rails-plugins
Comments
Post a Comment