git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git-svn 1.5.3 does not understand grafts?
@ 2007-09-07 16:41 Joakim Tjernlund
  2007-09-07 16:52 ` Joakim Tjernlund
  0 siblings, 1 reply; 8+ messages in thread
From: Joakim Tjernlund @ 2007-09-07 16:41 UTC (permalink / raw)
  To: git

svnadmin create /usr/local/src/TM/svn-tst/7720-svn/
svn mkdir  file:///usr/local/src/TM/svn-tst/7720-svn/trunk -m "Add trunk dir"
svn mkdir  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp -m "Add swp dir"

In my git repo I do
git-svn init  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp 
git-svn fetch
git branch svn remotes/git-svn
#make remotes/git-svn parent to the initial commit in my git tree
graftid=`git-show-ref -s svn`
echo da783cce390ce013b19f1d308ea6813269c6a6b5 $graftid > .git/info/grafts
#da783... is the initial commit in my git tree.
git-svn dcommit

fails with:
Committing to file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp ...
Commit da783cce390ce013b19f1d308ea6813269c6a6b5
has no parent commit, and therefore nothing to diff against.
You should be working from a repository originally created by git-svn


 Jocke

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

* Re: git-svn 1.5.3 does not understand grafts?
  2007-09-07 16:41 git-svn 1.5.3 does not understand grafts? Joakim Tjernlund
@ 2007-09-07 16:52 ` Joakim Tjernlund
  2007-09-07 20:23   ` Joakim Tjernlund
  0 siblings, 1 reply; 8+ messages in thread
From: Joakim Tjernlund @ 2007-09-07 16:52 UTC (permalink / raw)
  To: git

On Fri, 2007-09-07 at 18:41 +0200, Joakim Tjernlund wrote:
> svnadmin create /usr/local/src/TM/svn-tst/7720-svn/
> svn mkdir  file:///usr/local/src/TM/svn-tst/7720-svn/trunk -m "Add trunk dir"
> svn mkdir  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp -m "Add swp dir"
> 
> In my git repo I do
> git-svn init  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp 
> git-svn fetch
> git branch svn remotes/git-svn
> #make remotes/git-svn parent to the initial commit in my git tree
> graftid=`git-show-ref -s svn`
> echo da783cce390ce013b19f1d308ea6813269c6a6b5 $graftid > .git/info/grafts
> #da783... is the initial commit in my git tree.
> git-svn dcommit
> 
> fails with:
> Committing to file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp ...
> Commit da783cce390ce013b19f1d308ea6813269c6a6b5
> has no parent commit, and therefore nothing to diff against.
> You should be working from a repository originally created by git-svn
> 
> 
>  Jocke

Using filter-branch helps, but git-svn isn't too happy:

git-svn init  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp 
git-svn fetch
git branch svn remotes/git-svn
#make remotes/git-svn parent to the initial commit in my git tree
graftid=`git-show-ref -s svn`
echo da783cce390ce013b19f1d308ea6813269c6a6b5 $graftid > .git/info/grafts
#da783... is the initial commit in my git tree.
git filter-branch $graftid..HEAD
git-svn dcommit

Now I get alot of complaints, but it commits to svn.
It takes forever though:
r3 = 55a489bd4f66dd1f641a4676359d7b8911dc7d83 (git-svn)
W: HEAD and refs/remotes/git-svn differ, using rebase:
:100644 100644 f85ae11af7715a224015582724cb2bab87ec914a
7dc27f2dc58f6dd46cff79d5d762e630febfd419 M    Makefile :100644 100644
4fa08aee7d4cd193cb161115cc079e7c50326e23
0246a89da64f08b0b48f7aa16886bbb2b12df237 M   adc.c :100644 100644
84eba702cce3a9e4f125162f77f3ea52ae45aebc
78347f1f40f7526142bcc5db0708f50dd6150c0a M      adc.h :100644 100644
890dfe7abdac0aa03eeca24572d98e3953db69d7
c2367a52e99af1f036dfc1de442f08cb187a58ab M   bmi.c :100644 100644
92ae3ce7c8c0b3a664dc4ace8ce29b9ac7fd2d9b
40fb9b886e3a51189e662d54cbdbb968e244aa53 M       bmi.h :100644 100644
a21005f15af34cd17e6acd8f1de974e3d82af0f4
ba2c2c4b19bbbfdabae6d3a9980132c4e1e1c07c M      cdrbug.c :100644 100644
5a299761b62ca83fc22d30086b9a082c4de23ee4
3f885b0d8b7c29e7970997ed608df12e23d78644 M   config.c :100644 100644
8a0a8ed90e50d18a9865fa2f5e644ca083a8b783
a2153ef48a59ffdf5a84ca6b93106c98dcb27a9c M control.c :100644 100644
760b828d8e55f6314d313e176578546e3d76b22b
143b44923e1f40d89fa9e87a30dd63abc48cea57 M  database.c :100644 100644
e7cab9865317c1ab4cbe8ecb47b5fda7c0eddcd8
ff519b51ae5428b93504f124ea1f24452b69fa94 M database.h :100644 100644
a28219bc7b5bc692242639fae0e5b54cfaec7bc3
78c8df626c1cf9c989f127f96161850f92cd4588 M defines.h :100644 100644
21e68f9a09a2618493eed4f4c1796293db78c828
68659b3a1bc25a90b103824e089c7c6126f5367b M        eeprom.c :100644
100644 3095638b3f28d5b8e04be1c660fc37bf82e034c2
7ea0835e82aa230f1834b9977ec6a634c400e244 M   eeprom.h :100644 000000
8f7368e29d7ba3dbe34c8e6ad7a3738b68dd1d78
0000000000000000000000000000000000000000 D   fpga.c :100644 000000
2dded257891ada8228f684e9be213b86b6c1fda5
0000000000000000000000000000000000000000 D   fpga.h :100644 100644
97ccea82dd35a7d5973199511d7a9127981f74d3
3758a9334cf04bb670ae2563ad5f2b95af257f3b M     fwrev.h :100644 100644
cd80946581062ead075ba6047d51ae2605e4cc14
2ef670ea229b62bc1b10d087ab2bd3850f08e91a M    glitch.c :100644 100644
d14716ec4351b610dbac81637623a9ca3a8e8902
9e1789933635a5b9e2c562a3c69a973e07b31b7b M   i2cmux.c :100644 100644
6551153cf879ba87d73aa53aa6b768867b026842
4a2813b41231461ab4b316829f9e59ac36498813 M i2cmux.h :100644 100644
2967bc6e21ab9581a47266966867ded04d8076f1
5294b80cbad8d7501fa8c415a0b7b0e1a3343262 M   led.c :100644 100644
9b8016b9c3f13a5fb4446a1f31d1d2311ece32df
2014113eaff9c22f4efd347031d3b7651aa78648 M      led.h :100644 100644
e4d50a5a735105187304f0458cde9102c64aa163
faba2f86b6f86f944ce4995ec5cab2edea0d3bb6 M   lvd.c :100644 100644
aa86ba2a2c313ca688700e75a4353a4d66846b54
bbc2a887b404a06d28ee77c5343278f3a309371f M       main.c :100644 100644
d0f5f5f6538924cfe757e8cdb328f4d7bf9858bd
25e10d528df873425cf32b366c42c01a84367459 M     memmap.c :100644 100644
9bdc8d928ce77ed2f529a0709a3f54a882c37b8b
086b7fc9dd915e43f21e94e963a18184669d361d M   optosfp.c :000000 100644
0000000000000000000000000000000000000000
bb8184467f03194f7aa8cc964a5dfe37603539e3 A        pld.c :000000 100644
0000000000000000000000000000000000000000
405486a29ca8be8212bc307017404ebbed904fe0 A      pld.h :100644 100644
b361784c0b617bdceac5e297e0c3dbb96b2a3dae
869bf82b2e8b710150abf88ca34a9e12378f1415 M      protocol.c :100644
100644 988233f538e9df6c681b2f60a19279567ca2536d
55d9627846575f5f63d907a6dd07979040c64552 M       protocol.h :100644
100644 b43a0c32977e11ad6ccbe9704ce8fdace8914e4d
7872778d025990cdc014d6ca907a3cf9e75050b1 M shell.c :100644 100644
0134ff4ca1a1f8b8d760eb4e367057dbb88b68ed
cda0e129d5fc1390dd7d1e1dd5b9695651c5dcdd M    spi.c :100644 100644
3ea874f32fa1eab87f4d2261a922dc293f379947
24e1be7f8bfe9570464260b6d210cbf7771edaab M      task.c :100644 100644
ca1f966200e5f7126fe0b61a768a5e4b1d49bc94
87a516572095292add8b1b19687a624c38ad205f M   trans.c :100644 100644
b298cc58873100e5e74f53d2a3f62028caba8951
853c18b6c42f9d463f14eede3b84ed700b00dcd5 M    transceiver.cFirst,
rewinding head to replay your work on top of it...
HEAD is now at 55a489b... Initial import of 7700, sws100034.

I get alot similar messages until it is finished.

    Jocke 

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

* Re: git-svn 1.5.3 does not understand grafts?
  2007-09-07 16:52 ` Joakim Tjernlund
@ 2007-09-07 20:23   ` Joakim Tjernlund
  2007-09-08  5:01     ` Eric Wong
  0 siblings, 1 reply; 8+ messages in thread
From: Joakim Tjernlund @ 2007-09-07 20:23 UTC (permalink / raw)
  To: git; +Cc: Eric Wong

On Fri, 2007-09-07 at 18:52 +0200, Joakim Tjernlund wrote:
> On Fri, 2007-09-07 at 18:41 +0200, Joakim Tjernlund wrote:
> > svnadmin create /usr/local/src/TM/svn-tst/7720-svn/
> > svn mkdir  file:///usr/local/src/TM/svn-tst/7720-svn/trunk -m "Add trunk dir"
> > svn mkdir  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp -m "Add swp dir"
> > 
> > In my git repo I do
> > git-svn init  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp 
> > git-svn fetch
> > git branch svn remotes/git-svn
> > #make remotes/git-svn parent to the initial commit in my git tree
> > graftid=`git-show-ref -s svn`
> > echo da783cce390ce013b19f1d308ea6813269c6a6b5 $graftid > .git/info/grafts
> > #da783... is the initial commit in my git tree.
> > git-svn dcommit
> > 
> > fails with:
> > Committing to file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp ...
> > Commit da783cce390ce013b19f1d308ea6813269c6a6b5
> > has no parent commit, and therefore nothing to diff against.
> > You should be working from a repository originally created by git-svn
> > 
> > 
> >  Jocke
> 
> Using filter-branch helps, but git-svn isn't too happy:
> 
> git-svn init  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp 
> git-svn fetch
> git branch svn remotes/git-svn
> #make remotes/git-svn parent to the initial commit in my git tree
> graftid=`git-show-ref -s svn`
> echo da783cce390ce013b19f1d308ea6813269c6a6b5 $graftid > .git/info/grafts
> #da783... is the initial commit in my git tree.
> git filter-branch $graftid..HEAD
> git-svn dcommit
> 
> Now I get alot of complaints, but it commits to svn.
> It takes forever though:
> r3 = 55a489bd4f66dd1f641a4676359d7b8911dc7d83 (git-svn)
> W: HEAD and refs/remotes/git-svn differ, using rebase:
> :100644 100644 f85ae11af7715a224015582724cb2bab87ec914a
[SNIP]

Just wanted to add that 1.5.2.2 works with grafts and 
that I suspect sub read_commit_parents in git-svn, but as I don't
do perl I am stuck.

     Jocke
Oh, Eric W. CC:ed as well this time

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

* Re: git-svn 1.5.3 does not understand grafts?
  2007-09-07 20:23   ` Joakim Tjernlund
@ 2007-09-08  5:01     ` Eric Wong
  2007-09-08 11:04       ` Joakim Tjernlund
  2007-09-08 17:43       ` Joakim Tjernlund
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Wong @ 2007-09-08  5:01 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: git

Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:
> On Fri, 2007-09-07 at 18:52 +0200, Joakim Tjernlund wrote:
> > On Fri, 2007-09-07 at 18:41 +0200, Joakim Tjernlund wrote:
> > > svnadmin create /usr/local/src/TM/svn-tst/7720-svn/
> > > svn mkdir  file:///usr/local/src/TM/svn-tst/7720-svn/trunk -m "Add trunk dir"
> > > svn mkdir  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp -m "Add swp dir"
> > > 
> > > In my git repo I do
> > > git-svn init  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp 
> > > git-svn fetch
> > > git branch svn remotes/git-svn
> > > #make remotes/git-svn parent to the initial commit in my git tree
> > > graftid=`git-show-ref -s svn`
> > > echo da783cce390ce013b19f1d308ea6813269c6a6b5 $graftid > .git/info/grafts
> > > #da783... is the initial commit in my git tree.
> > > git-svn dcommit
> > > 
> > > fails with:
> > > Committing to file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp ...
> > > Commit da783cce390ce013b19f1d308ea6813269c6a6b5
> > > has no parent commit, and therefore nothing to diff against.
> > > You should be working from a repository originally created by git-svn
> > 
> > Using filter-branch helps, but git-svn isn't too happy:
> > 
> > git-svn init  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp 
> > git-svn fetch
> > git branch svn remotes/git-svn
> > #make remotes/git-svn parent to the initial commit in my git tree
> > graftid=`git-show-ref -s svn`
> > echo da783cce390ce013b19f1d308ea6813269c6a6b5 $graftid > .git/info/grafts
> > #da783... is the initial commit in my git tree.
> > git filter-branch $graftid..HEAD
> > git-svn dcommit
> > 
> > Now I get alot of complaints, but it commits to svn.
> > It takes forever though:
> > r3 = 55a489bd4f66dd1f641a4676359d7b8911dc7d83 (git-svn)
> > W: HEAD and refs/remotes/git-svn differ, using rebase:
> > :100644 100644 f85ae11af7715a224015582724cb2bab87ec914a

I haven't used filter-branch myself, but you probably need to remove all
.rev_db* files in $GIT_DIR after running it (git-svn can recreate them
unless you use the svmRevProps or noMetadata options.

> [SNIP]
> 
> Just wanted to add that 1.5.2.2 works with grafts and 
> that I suspect sub read_commit_parents in git-svn, but as I don't
> do perl I am stuck.

Crap, it looks like I completely forgot about the existence
of grafts while doing this function.

>      Jocke
> Oh, Eric W. CC:ed as well this time

Thanks.

-- 
Eric Wong

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

* RE: git-svn 1.5.3 does not understand grafts?
  2007-09-08  5:01     ` Eric Wong
@ 2007-09-08 11:04       ` Joakim Tjernlund
  2007-09-08 17:43       ` Joakim Tjernlund
  1 sibling, 0 replies; 8+ messages in thread
From: Joakim Tjernlund @ 2007-09-08 11:04 UTC (permalink / raw)
  To: 'Eric Wong'; +Cc: 'git'

> -----Original Message-----
> From: Eric Wong [mailto:normalperson@yhbt.net] 
> Sent: den 8 september 2007 07:02
> To: Joakim Tjernlund
> Cc: git
> Subject: Re: git-svn 1.5.3 does not understand grafts?
> 
> Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:
> > On Fri, 2007-09-07 at 18:52 +0200, Joakim Tjernlund wrote:
> > > On Fri, 2007-09-07 at 18:41 +0200, Joakim Tjernlund wrote:
> > > > svnadmin create /usr/local/src/TM/svn-tst/7720-svn/
> > > > svn mkdir  
> file:///usr/local/src/TM/svn-tst/7720-svn/trunk -m "Add trunk dir"
> > > > svn mkdir  
> file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp -m "Add swp dir"
> > > > 
> > > > In my git repo I do
> > > > git-svn init  
> file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp 
> > > > git-svn fetch
> > > > git branch svn remotes/git-svn
> > > > #make remotes/git-svn parent to the initial commit in 
> my git tree
> > > > graftid=`git-show-ref -s svn`
> > > > echo da783cce390ce013b19f1d308ea6813269c6a6b5 $graftid 
> > .git/info/grafts
> > > > #da783... is the initial commit in my git tree.
> > > > git-svn dcommit
> > > > 
> > > > fails with:
> > > > Committing to 
> file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp ...
> > > > Commit da783cce390ce013b19f1d308ea6813269c6a6b5
> > > > has no parent commit, and therefore nothing to diff against.
> > > > You should be working from a repository originally 
> created by git-svn
> > > 
> > > Using filter-branch helps, but git-svn isn't too happy:
> > > 
> > > git-svn init  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp 
> > > git-svn fetch
> > > git branch svn remotes/git-svn
> > > #make remotes/git-svn parent to the initial commit in my git tree
> > > graftid=`git-show-ref -s svn`
> > > echo da783cce390ce013b19f1d308ea6813269c6a6b5 $graftid > 
> .git/info/grafts
> > > #da783... is the initial commit in my git tree.
> > > git filter-branch $graftid..HEAD
> > > git-svn dcommit
> > > 
> > > Now I get alot of complaints, but it commits to svn.
> > > It takes forever though:
> > > r3 = 55a489bd4f66dd1f641a4676359d7b8911dc7d83 (git-svn)
> > > W: HEAD and refs/remotes/git-svn differ, using rebase:
> > > :100644 100644 f85ae11af7715a224015582724cb2bab87ec914a
> 
> I haven't used filter-branch myself, but you probably need to 
> remove all
> .rev_db* files in $GIT_DIR after running it (git-svn can recreate them
> unless you use the svmRevProps or noMetadata options.

havn't used it either, but I wanted to see if it makes a difference.
I will remember to remove the .rev_db* files next time I try.

filter branch is overkill if the grafts file works as git-svn will rewrite
the commits so once the first dcommit has been made, I can remove the
grafts file.

I do have another project though were I want to fix som odd parenting caused
by set-tree, there I will have to used filter-branch to make it permanet.

> 
> > [SNIP]
> > 
> > Just wanted to add that 1.5.2.2 works with grafts and 
> > that I suspect sub read_commit_parents in git-svn, but as I don't
> > do perl I am stuck.
> 
> Crap, it looks like I completely forgot about the existence
> of grafts while doing this function.

:)
Do you have to worry about grafts in git-svn? 
Can't git plumbing do this for you?

> 
> >      Jocke
> > Oh, Eric W. CC:ed as well this time
> 
> Thanks.
> 
> -- 
> Eric Wong
> 
> 

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

* RE: git-svn 1.5.3 does not understand grafts?
  2007-09-08  5:01     ` Eric Wong
  2007-09-08 11:04       ` Joakim Tjernlund
@ 2007-09-08 17:43       ` Joakim Tjernlund
  2007-09-08 19:53         ` Junio C Hamano
  1 sibling, 1 reply; 8+ messages in thread
From: Joakim Tjernlund @ 2007-09-08 17:43 UTC (permalink / raw)
  To: 'Eric Wong'; +Cc: 'git'

 

> -----Original Message-----
> From: Eric Wong [mailto:normalperson@yhbt.net] 
> Sent: den 8 september 2007 07:02
> To: Joakim Tjernlund
> Cc: git
> Subject: Re: git-svn 1.5.3 does not understand grafts?
> 
> Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:
> > On Fri, 2007-09-07 at 18:52 +0200, Joakim Tjernlund wrote:
> > > On Fri, 2007-09-07 at 18:41 +0200, Joakim Tjernlund wrote:
> > > > svnadmin create /usr/local/src/TM/svn-tst/7720-svn/
> > > > svn mkdir  
> file:///usr/local/src/TM/svn-tst/7720-svn/trunk -m "Add trunk dir"
> > > > svn mkdir  
> file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp -m "Add swp dir"
> > > > 
> > > > In my git repo I do
> > > > git-svn init  
> file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp 
> > > > git-svn fetch
> > > > git branch svn remotes/git-svn
> > > > #make remotes/git-svn parent to the initial commit in 
> my git tree
> > > > graftid=`git-show-ref -s svn`
> > > > echo da783cce390ce013b19f1d308ea6813269c6a6b5 $graftid 
> > .git/info/grafts
> > > > #da783... is the initial commit in my git tree.
> > > > git-svn dcommit
> > > > 
> > > > fails with:
> > > > Committing to 
> file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp ...
> > > > Commit da783cce390ce013b19f1d308ea6813269c6a6b5
> > > > has no parent commit, and therefore nothing to diff against.
> > > > You should be working from a repository originally 
> created by git-svn
> > > 
> > > Using filter-branch helps, but git-svn isn't too happy:
> > > 
> > > git-svn init  file:///usr/local/src/TM/svn-tst/7720-svn/trunk/swp 
> > > git-svn fetch
> > > git branch svn remotes/git-svn
> > > #make remotes/git-svn parent to the initial commit in my git tree
> > > graftid=`git-show-ref -s svn`
> > > echo da783cce390ce013b19f1d308ea6813269c6a6b5 $graftid > 
> .git/info/grafts
> > > #da783... is the initial commit in my git tree.
> > > git filter-branch $graftid..HEAD
> > > git-svn dcommit
> > > 
> > > Now I get alot of complaints, but it commits to svn.
> > > It takes forever though:
> > > r3 = 55a489bd4f66dd1f641a4676359d7b8911dc7d83 (git-svn)
> > > W: HEAD and refs/remotes/git-svn differ, using rebase:
> > > :100644 100644 f85ae11af7715a224015582724cb2bab87ec914a
> 
> I haven't used filter-branch myself, but you probably need to 
> remove all
> .rev_db* files in $GIT_DIR after running it (git-svn can recreate them
> unless you use the svmRevProps or noMetadata options.
> 
> > [SNIP]
> > 
> > Just wanted to add that 1.5.2.2 works with grafts and 
> > that I suspect sub read_commit_parents in git-svn, but as I don't
> > do perl I am stuck.
> 
> Crap, it looks like I completely forgot about the existence
> of grafts while doing this function.

hmm, I think git-cat-file is to blame.
git-cat-file commit da783cce390ce013b19f1d308ea6813269c6a6b5 does
not list list any parent even though I did
graftid=`git-show-ref -s remotes/git-svn`
echo da783cce390ce013b19f1d308ea6813269c6a6b5 $graftid > .git/info/grafts

 Jocke

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

* Re: git-svn 1.5.3 does not understand grafts?
  2007-09-08 17:43       ` Joakim Tjernlund
@ 2007-09-08 19:53         ` Junio C Hamano
  2007-09-08 23:33           ` [PATCH] git-svn: understand grafts when doing dcommit Eric Wong
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2007-09-08 19:53 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: 'Eric Wong', 'git'

"Joakim Tjernlund" <joakim.tjernlund@transmode.se> writes:

> hmm, I think git-cat-file is to blame.
> git-cat-file commit da783cce390ce013b19f1d308ea6813269c6a6b5 does
> not list list any parent...

The plumbing cat-file does not deal with grafts and this is
deliberate.  Otherwise you would not be able to find the true
set of parents when you'd want to.

So do not blame cat-file, but blame the Porcelain that uses
cat-file to read a commit object, without annotating what it
read with what is in grafts, in this case your command line
experiment ;-).

The log family of commands and rev-list plumbing while
traversing commit ancestry chain do take grafts into account.

One caveat is pretty=raw output format shows true parents
without grafts on "parent " header line, while the "commit "
fake header prepended in the output for each commit shows the
parents that takes into account.

To illustrate, if you forge the history and say the parent of
1ddea77 is 5da1606 (when the true parent is 820eca68) with
grafts mechanism, here is what happens:

    $ echo '1ddea77e449ef28d8a7c74521af21121ab01abc0 5da1606d0bf5b970fadfa0ca91618a1e871f6755' >.git/info/grafts
    $ git show -s --pretty=raw --parents 1ddea77
    commit 1ddea77e449ef28d8a7c74521af21121ab01abc0 5da1606d0bf5b970fadfa0ca91618a1e871f6755
    tree e9e61bc801438062978ff47b0963c536ed1e51a9
    parent 820eca68c2577d7499d203d7f4f7ae479b577683
    author Nick Hengeveld <nickh@reactrix.com> 1127757131 -0700
    committer Junio C Hamano <junkio@cox.net> 1127805558 -0700

        [PATCH] Return CURL error message when object transfer fails

        Return CURL error message when object transfer fails
        ...
    $ git-cat-file commit 1ddea77
    tree e9e61bc801438062978ff47b0963c536ed1e51a9
    parent 820eca68c2577d7499d203d7f4f7ae479b577683
    author Nick Hengeveld <nickh@reactrix.com> 1127757131 -0700
    committer Junio C Hamano <junkio@cox.net> 1127805558 -0700

    [PATCH] Return CURL error message when object transfer fails

    Return CURL error message when object transfer fails
    ...

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

* [PATCH] git-svn: understand grafts when doing dcommit
  2007-09-08 19:53         ` Junio C Hamano
@ 2007-09-08 23:33           ` Eric Wong
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Wong @ 2007-09-08 23:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Joakim Tjernlund, git

Use the rev-list --parents functionality to read the parents
of the commit.  cat-file only shows the raw object with the
original parents and doesn't take into account grafts; so
we'll rely on rev-list machinery for the smarts here.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
  Junio C Hamano <gitster@pobox.com> wrote:
  > "Joakim Tjernlund" <joakim.tjernlund@transmode.se> writes:
  > 
  > > hmm, I think git-cat-file is to blame.
  > > git-cat-file commit da783cce390ce013b19f1d308ea6813269c6a6b5 does
  > > not list list any parent...
  > 
  > The plumbing cat-file does not deal with grafts and this is
  > deliberate.  Otherwise you would not be able to find the true
  > set of parents when you'd want to.
  > 
  > So do not blame cat-file, but blame the Porcelain that uses
  > cat-file to read a commit object, without annotating what it
  > read with what is in grafts, in this case your command line
  > experiment ;-).
  > 
  > The log family of commands and rev-list plumbing while
  > traversing commit ancestry chain do take grafts into account.
  > 
  > One caveat is pretty=raw output format shows true parents
  > without grafts on "parent " header line, while the "commit "
  > fake header prepended in the output for each commit shows the
  > parents that takes into account.
  > 
  > To illustrate, if you forge the history and say the parent of
  > 1ddea77 is 5da1606 (when the true parent is 820eca68) with
  > grafts mechanism, here is what happens:
  > 
  >     $ echo '1ddea77e449ef28d8a7c74521af21121ab01abc0 5da1606d0bf5b970fadfa0ca91618a1e871f6755' >.git/info/grafts
  >     $ git show -s --pretty=raw --parents 1ddea77
  >     commit 1ddea77e449ef28d8a7c74521af21121ab01abc0 5da1606d0bf5b970fadfa0ca91618a1e871f6755
  >     tree e9e61bc801438062978ff47b0963c536ed1e51a9
  >     parent 820eca68c2577d7499d203d7f4f7ae479b577683
  >     author Nick Hengeveld <nickh@reactrix.com> 1127757131 -0700
  >     committer Junio C Hamano <junkio@cox.net> 1127805558 -0700
  > 
  >         [PATCH] Return CURL error message when object transfer fails
  > 
  >         Return CURL error message when object transfer fails
  >         ...

  Interesting.  I didn't know about the --parents option before.

 git-svn.perl |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index fbd4691..f818160 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -841,14 +841,9 @@ sub working_head_info {
 
 sub read_commit_parents {
 	my ($parents, $c) = @_;
-	my ($fh, $ctx) = command_output_pipe(qw/cat-file commit/, $c);
-	while (<$fh>) {
-		chomp;
-		last if '';
-		/^parent ($sha1)/ or next;
-		push @{$parents->{$c}}, $1;
-	}
-	close $fh; # break the pipe
+	chomp(my $p = command_oneline(qw/rev-list --parents -1/, $c));
+	$p =~ s/^($c)\s*// or die "rev-list --parents -1 $c failed!\n";
+	@{$parents->{$c}} = split(/ /, $p);
 }
 
 sub linearize_history {
-- 
Eric Wong

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

end of thread, other threads:[~2007-09-09  8:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-07 16:41 git-svn 1.5.3 does not understand grafts? Joakim Tjernlund
2007-09-07 16:52 ` Joakim Tjernlund
2007-09-07 20:23   ` Joakim Tjernlund
2007-09-08  5:01     ` Eric Wong
2007-09-08 11:04       ` Joakim Tjernlund
2007-09-08 17:43       ` Joakim Tjernlund
2007-09-08 19:53         ` Junio C Hamano
2007-09-08 23:33           ` [PATCH] git-svn: understand grafts when doing dcommit Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).