[ANNOUNCE] Example Cogito Addon - cogito-bundle

Jakub Narebski jnareb at gmail.com
Fri Oct 20 19:35:25 BST 2006

Jan Hudec wrote:
> On Fri, Oct 20, 2006 at 06:21:34PM +0200, Jakub Narebski wrote:
> > Aaron Bentley wrote:
> > 
> > > === added directory  // file-id:TREE_ROOT
> > 
> > Gaaah, so rename detection in bzr is done using file-ids?
> > Linus will tell you the inherent problems with that "solution".
> Ok, I tried to read
> http://permalink.gmane.org/gmane.comp.version-control.git/217
> It's all nice and well, but my question is whether the below cases work
> in git. Yes, they are particular cases, but they are particularly
> important. If they don't, I'd rather have file-id scheme, that is
> limited to just them, but handles them, than something with big plans,
> but nothing working.
> Let's consider following scenario:
> (where A$ means working in branch A, B$ means working in branch B and
>  VCT stands for version control tool of choice)

1077:jnareb at roke:/tmp/jnareb> mkdir tmp
1078:jnareb at roke:/tmp/jnareb> cd tmp/
1079:jnareb at roke:/tmp/jnareb/tmp> git init-db
defaulting to local storage area

> A$ echo Hello Warld! > hello.txt
1081:jnareb at roke:/tmp/jnareb/tmp> echo 'Hello Warld!' > hello.txt

> A$ VCT add hello.txt
1082:jnareb at roke:/tmp/jnareb/tmp> git add hello.txt

> A$ VCT commit -m "Created greeting"
1083:jnareb at roke:/tmp/jnareb/tmp> git commit -a -m "Created greeting"

(we use here still default branch 'master'. Let us change it to A)
1084:jnareb at roke:/tmp/jnareb/tmp> git branch A
1088:jnareb at roke:/tmp/jnareb/tmp> git checkout A

> $ VCT branch A B
1085:jnareb at roke:/tmp/jnareb/tmp> git branch B A
(create branch B based on A)

> A$ VCT mkdir data
1089:jnareb at roke:/tmp/jnareb/tmp> mkdir data

> A$ VCT mv hello.txt data/
1090:jnareb at roke:/tmp/jnareb/tmp> git mv hello.txt data/

> A$ VCT commit -m "Moved hello.txt to data dir"
1092:jnareb at roke:/tmp/jnareb/tmp> git commit -a -m "Moved hello.txt to data dir"

> B$ ed hello.txt
> ? 1s/Warld/World/
> ? wq
1094:jnareb at roke:/tmp/jnareb/tmp> ed hello.txt 

> B$ VCT commit -m "Fixed typo in greeting"
1096:jnareb at roke:/tmp/jnareb/tmp> git commit -a -m "Fixed typo in greeting"

> A$ VCT merge B
1097:jnareb at roke:/tmp/jnareb/tmp> git checkout A
1098:jnareb at roke:/tmp/jnareb/tmp> git pull . B
Trying really trivial in-index merge...
fatal: Merge requires file-level merging
Merging HEAD with 9de7290d385ec2b0c2ade9b888f6c3a6633ac926
5f0eb04467538f0f1414af85ec6481150107c0b2 Moved hello.txt to data dir 
9de7290d385ec2b0c2ade9b888f6c3a6633ac926 Fixed typo in greeting 
found 1 common ancestor(s): 
f49a520e40143cb9d84b00e9728c5742897c0a22 Created greeting 

Merge made by recursive.
 data/hello.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

> At this point, I expect the tree to look like this:
> A$ ls -R
1099:jnareb at roke:/tmp/jnareb/tmp> ls -R


> A$ cat data/hello.txt
1100:jnareb at roke:/tmp/jnareb/tmp> cat data/hello.txt 
Hello World!

> A$ VCT mv data greetings
1102:jnareb at roke:/tmp/jnareb/tmp> git mv data greetings

> A$ VCT commit -m "Renamed the data directory to greetings"
1105:jnareb at roke:/tmp/jnareb/tmp> git commit -a -m "Renamed the data directory to greetings"

> B$ echo "Goodbye World!" > data/goodbye.txt
1106:jnareb at roke:/tmp/jnareb/tmp> git checkout B
1109:jnareb at roke:/tmp/jnareb/tmp> echo 'Goodbye World!' > data/goodbye.txt
bash: data/goodbye.txt: There is no such file or directory
1110:jnareb at roke:/tmp/jnareb/tmp> ls -R

You need to revise your example.
Jakub Narebski

More information about the bazaar mailing list