git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Digging through old vendor code
@ 2008-01-13 16:28 linux
  2008-01-13 17:04 ` Jon Smirl
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: linux @ 2008-01-13 16:28 UTC (permalink / raw)
  To: git, jonsmirl, torvalds; +Cc: linux

> Heh. Maybe you could just use the rename logic?
>
> [How-to snipped]

Clever idea, but I think the real problem was to figure out what VERSION
of the file was the base; i.e. to look through history.

Still, it should be possible to adapt the technique...

#!/bin/sh

# List of files we are looking to copy from
SRC="drivers/serial/"
# Temporary work directory
DST=/tmp/work
git-clone -l -n -s . $DST
{ cd $DST; git-symbolic-ref HEAD refs/heads/DELETEME; }
for i in `git-rev-list v2.6.20..v2.6.24-rc6 -- $SRC`; do
        j=`git-describe $i`
        git-archive --prefix="$j/" $i -- $SRC | tar xf - -C $DST
        # This is abusing the index, but it saves space...
        { cd $DST; git add $j; rm -rf $j; }
done

# And  now proceed as per Linus's idea...
# Except we have it all in the index; no need
# to actually make a commit...

cd $DST
cp $target_file $DST
{ cd $DST; git-diff-files -M...; }


Maybe a real git wizard will show me how to insert the index entries
directly without ever doing anything as pedestrian as extracting, hashing,
and then deleting the files, but it's still not that bad.

And it's kind of a neat example of using the index as a staging area
for a commit.

(Exercise for the reader: the above gets a complete copy of every file in
the directory for every commit in qhich ANY file in the directory changed.
Better would be to do the git-rev-list per-file, so you only add unique
file versions.  This requires an outer loop over file names and a more
careful pathname specification to git add in the inner loop.)

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Digging through old vendor code
@ 2008-01-13  4:09 Jon Smirl
  2008-01-13  4:41 ` Linus Torvalds
  0 siblings, 1 reply; 7+ messages in thread
From: Jon Smirl @ 2008-01-13  4:09 UTC (permalink / raw)
  To: Git Mailing List

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-01-14 14:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-13 16:28 Digging through old vendor code linux
2008-01-13 17:04 ` Jon Smirl
2008-01-13 17:31 ` Jon Smirl
2008-01-14 12:08 ` Jeff King
2008-01-14 14:49   ` Jon Smirl
  -- strict thread matches above, loose matches on Subject: below --
2008-01-13  4:09 Jon Smirl
2008-01-13  4:41 ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).