{"thread":{"id":"11602","subject":"Digging through old vendor code","startedAt":"2008-01-13T04:09:27Z","lastAt":"2008-01-13T04:41:31Z","messageCount":2,"participants":["Jon Smirl","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"65226","messageId":"9e4733910801122009k5658488bx69c04a5cbf7d832a@mail.gmail.com","threadId":"11602","inReplyTo":null,"subject":"Digging through old vendor code","fromName":"Jon Smirl","fromEmail":"jonsmirl@gmail.com","sentAt":"2008-01-13T04:09:27Z","receivedAt":"2008-01-13T04:09:27Z","isPatch":false,"sender":{"key":"jonsmirl@gmail.com","avatar":"https://gravatar.com/avatar/cff3bf5bfdfa6708b905712ff91f0f9b8aaca161659f38c02b787920d5d28b7e?d=mp&s=160"},"body":"I have a file that a vendor has modified. It's a serial driver so I\nknow which directory the original file came from. Is there a way to\nask git to search through all of the past versions of all of the files\nin this directory and give me the top two or three choices as to what\nfile the vendor originally copied before staring to edit? This is the\nsame problem as picking the best diff base.\n\n-- \nJon Smirl\njonsmirl@gmail.com\n"},{"id":"65227","messageId":"alpine.LFD.1.00.0801122034090.2806@woody.linux-foundation.org","threadId":"11602","inReplyTo":"9e4733910801122009k5658488bx69c04a5cbf7d832a@mail.gmail.com","subject":"Re: Digging through old vendor code","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2008-01-13T04:41:31Z","receivedAt":"2008-01-13T04:41:31Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sat, 12 Jan 2008, Jon Smirl wrote:\n>\n> I have a file that a vendor has modified. It's a serial driver so I\n> know which directory the original file came from. Is there a way to\n> ask git to search through all of the past versions of all of the files\n> in this directory and give me the top two or three choices as to what\n> file the vendor originally copied before staring to edit? This is the\n> same problem as picking the best diff base.\n\nHeh. Maybe you could just use the rename logic?\n\nExample of what *might* work:\n\n - go to the directory in the git tree you think the file came from\n\n - delete all the files that are *potential* sources (eg \"rm *.c\")\n\n - add the new file to that directory\n\n - commit the end result\n\n - ask git to find the best rename possibility, using a low rename \n   detection score, something like:\n\n\tgit show -M1%\n\n(and no, I don't guarantee that that \"-M1%\" is the right syntax, and in \ngeneral you might well want to play with this concept a bit..)\n\nNo guarantees, but it just might work..\n\n\t\tLinus\n"}]}