search - Finding where source has branched from git -


i have git repository (covering more or less project history) , separate sources (just tarball few files) have forked time ago (actually somewhere in 2004 or 2005).

the sources tarball have undergone quite lot of changes i'd incorporate some. question - how find out branch point changed sources minimal diff of has happened there.

so want find place in git history, code similar tarball of sources have. , don't want manually.

it worth mentioning changed sources include subset of files , have split files more. code in there seem small modifications , several additions.

if want play yourself, tarball sources here , git hosted @ gitorious: git://gitorious.org/gammu/mainline.git

in general case, you'd have examine every single commit, because have no way of knowing if might have huge diff in one, small diff next, huge diff, medium diff...

your best bet going to limit specific files. if consider single file, should not take long iterate through versions of file (use git rev-list <path> list, don't have test every commit). each commit modified file, can check size of diff, , find minimum. handful of files, they'll agree!

the best way set diffing make temporary commit copying in tarball, can have branch called tarball compare against. way, this:

git rev-list path/to/file | while read hash; echo -n "$hash "; git diff --numstat tarball $hash path/to/file; done 

to nice list of commits diff sizes (the first 3 columns sha1, number of lines added, , number of lines removed). pipe on awk '{print $1,$2+$3}' | sort -n -k 2, , you'd have sorted list of commits , diff sizes!

if can't limit small handful of files test, might tempted hand-implement similar git-bisect - try narrow way down small diff, making assumption in likelihood, commits near best case have smaller diffs, , commits far have larger diffs. (somewhere between newton's method , full on binary/grid search, probably?)

edit: possibility, suggested in douglas' answer, if think files might identical in commit, hash them using git-hash-object, , see commits in history have blob. there's question excellent answers how that. if handful of files - preferably ones have changed - might able narrow down target commit pretty quickly.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -