How can I figure out what commits relate to a given diff?
I have a patch file, and I'd like to figure out which commits were used to produce it.
For example, one of the diffs in the patch file begins with:
Makefile +0 -0
Is there a way to map a blob SHA1 to a commit? In this example, I'd like to map 9ceadaa and ad31bc6 to their commits. It seems easy to go the other way, seeing what is in a commit, but I've not been able to find a method for going "backwards" from a blob to a commit.
Thanks,
Steve
Quoted 4 lines · Steven A. Falco
Is there a way to map a blob SHA1 to a commit? In this example, I'd like to map 9ceadaa and ad31bc6 to their commits. It seems easy to go the other way, seeing what is in a commit, but I've not been able to find a method for going "backwards" from a blob to a commit.
Something like:
for i in git rev-list HEAD
do
git ls-tree -r $i|grep -q cb4e8ed && echo "$i contains cb4e8ed"
done
could do it for you.
I don't think there is a --contains for blobs, like git branch --contains works for commits.
Quoted 10 lines · Miklos Vajna
Quoted 4 lines · Steven A. Falco
Is there a way to map a blob SHA1 to a commit? In this example, I'd like to map 9ceadaa and ad31bc6 to their commits. It seems easy to go the other way, seeing what is in a commit, but I've not been able to find a method for going "backwards" from a blob to a commit.
Something like:
for i in
git rev-list HEAD
do
Quoted 7 lines
git ls-tree -r $i|grep -q cb4e8ed && echo "$i contains cb4e8ed"done
could do it for you.
I don't think there is a --contains for blobs, like git branch --contains works for commits.
Thanks! It found the commit I needed.
Steve
Quoted 9 lines · Steven A. Falco
For example, one of the diffs in the patch file begins with:
Makefile +0
-0Is there a way to map a blob SHA1 to a commit? In this example, I'd like to map 9ceadaa and ad31bc6 to their commits. It seems easy to go the other way, seeing what is in a commit, but I've not been able to find a method for going "backwards" from a blob to a commit.
Miklos suggested a way of looking up trees and commits which contain blobs, but you can also look for that specific change of blobs:
git log --pretty=format:'%h %s' --raw |
perl -00 -ne 'print if /9ceadaa.*ad31bc6/'-Peff
Re: perforce import: git-p4 memory usage
In reply to Luke DiamandQuoted 7 lines · Luke Diamand
Hi!
I'm trying to import part of a perforce repo with git-p4.
However, git-p4 appears to try to read all the repo into memory (and moreover seems to need about twice as much memory as repo).
Quoted 8 lines
Once it runs out of swap, it dies (unsurprisingly).
I think it's failing in
readP4Files(), where it appears to read the entire repository in one go with "p4 -G -x - print".Can I just rework this function to do stuff one file at a time? Or is that dumb?
It's probably a lot slower, and since git works with changesets it probably won't work all that good unless you somehow construct some middle-stage which you can then feed to git-fastimport or some such.
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
Re: perforce import: git-p4 memory usage
In reply to Luke DiamandQuoted 10 lines · Luke Diamand
However, git-p4 appears to try to read all the repo into memory (and moreover seems to need about twice as much memory as repo).
Once it runs out of swap, it dies (unsurprisingly).
I think it's failing in
readP4Files(), where it appears to read the entire repository in one go with "p4 -G -x - print".Can I just rework this function to do stuff one file at a time? Or is that dumb?
I don't know if they were ever accepted into the mainline, but see the series of patches submitted by Tommy Thorn.
http://article.gmane.org/gmane.comp.version-control.git/72342
Signature · 4 lines
Logan Kennelly
,,,
(. .)
--ooO-(_)-Ooo--perforce import: git-p4 memory usage
In reply to Jeff KingHi!
I'm trying to import part of a perforce repo with git-p4.
However, git-p4 appears to try to read all the repo into memory (and moreover seems to need about twice as much memory as repo).
Once it runs out of swap, it dies (unsurprisingly).
I think it's failing in readP4Files(), where it appears to read the entire repository in one go with "p4 -G -x - print".
Can I just rework this function to do stuff one file at a time? Or is that dumb?
Thanks
Luke Diamand