# Digging through old vendor code

2 messages from 2008-01-13 to 2008-01-13. Participants: Jon Smirl, Linus Torvalds.
Thread: https://gitlist.dev/t/11602

## Jon Smirl, 2008-01-13 04:09

Subject: Digging through old vendor code
Message-ID: <9e4733910801122009k5658488bx69c04a5cbf7d832a@mail.gmail.com>
URL: https://gitlist.dev/e/9e4733910801122009k5658488bx69c04a5cbf7d832a%40mail.gmail.com

```
I have a file that a vendor has modified. It's a serial driver so I
know which directory the original file came from. Is there a way to
ask git to search through all of the past versions of all of the files
in this directory and give me the top two or three choices as to what
file the vendor originally copied before staring to edit? This is the
same problem as picking the best diff base.

-- 
Jon Smirl
jonsmirl@gmail.com

```

## Linus Torvalds, 2008-01-13 04:41

Subject: Re: Digging through old vendor code
Message-ID: <alpine.LFD.1.00.0801122034090.2806@woody.linux-foundation.org>
URL: https://gitlist.dev/e/alpine.LFD.1.00.0801122034090.2806%40woody.linux-foundation.org
In-Reply-To: <9e4733910801122009k5658488bx69c04a5cbf7d832a@mail.gmail.com>

```


On Sat, 12 Jan 2008, Jon Smirl wrote:
>
> I have a file that a vendor has modified. It's a serial driver so I
> know which directory the original file came from. Is there a way to
> ask git to search through all of the past versions of all of the files
> in this directory and give me the top two or three choices as to what
> file the vendor originally copied before staring to edit? This is the
> same problem as picking the best diff base.

Heh. Maybe you could just use the rename logic?

Example of what *might* work:

 - go to the directory in the git tree you think the file came from

 - delete all the files that are *potential* sources (eg "rm *.c")

 - add the new file to that directory

 - commit the end result

 - ask git to find the best rename possibility, using a low rename 
   detection score, something like:

	git show -M1%

(and no, I don't guarantee that that "-M1%" is the right syntax, and in 
general you might well want to play with this concept a bit..)

No guarantees, but it just might work..

		Linus

```
