Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git notes after BFG?

I migrated from SVN to git and i had a note in each git commit referencing to SVN revision number. After repo import i used BFG repo cleaner to clean git history from binary files and other trash. Unfortunately now i do not see notes when i type git log. I suppose BFG forgets to update references on commits for notes. BFG leaves a *.txt report with mapping old object id to new object id in the following format:

0001b24011381e8885683cd1119ba4cb077fa64b c81149b1b52b9e1e1767d6141f292891d715edb5
00024eecdc31f2f6e67018f7d6f00e7c1ad03f1f 326ee3b508e3dd2934ec1f50069195f86ea1a1c7
00028e04dcc2d59bd835b447bd3a207ae481696c 3d18e9b9d3336e59d62093200b81603ffefcc747

Can you suggest some script to quickly fix notes given the above mapping?

PS: I am almost sure the problem is caused by not updated refs, because when i type git notes in second place i can see refs which are considered old in BFG repot object-id-map.old-new.txt

like image 265
Kirill Avatar asked Nov 21 '16 13:11

Kirill


1 Answers

I wrote the following bash script to transfer my notes from old objects. The solution is slow in single thread, not sure if it is safe to run several git notes commands in parallel.

while read string; do
    hashesArray=($string)
    git notes copy ${hashesArray[0]} ${hashesArray[1]}
    git notes remove --ignore-missing ${hashesArray[0]}
done <object-id-map.old-new.txt
like image 63
Kirill Avatar answered Oct 06 '22 00:10

Kirill