All of lore.kernel.org
 help / color / mirror / Atom feed
* How to deal with mixed tree?
@ 2011-11-22 11:21 Pascal Obry
  2011-11-22 11:35 ` Holger Hellmuth
  0 siblings, 1 reply; 8+ messages in thread
From: Pascal Obry @ 2011-11-22 11:21 UTC (permalink / raw)
  To: Git Mailing List

A project P1 is under Git.

A project P2 is under Subversion.

P2 in fact replace a sub-directory (say SD) in P1. The project P2 is a
replacement (extension) of the code in P1.

How to deal with this?

If you clone P1, remove SD in P1 to replace it by P2:

   $ git diff

   -> will display all the changes in SD, is there a way to avoid that?

   $ git merge (between branches) will try to merge changes in SD

I'd like to really tell Git to ignore SD as if it was not there. Any solution?

Thanks,
Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

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

* Re: How to deal with mixed tree?
  2011-11-22 11:21 How to deal with mixed tree? Pascal Obry
@ 2011-11-22 11:35 ` Holger Hellmuth
  2011-11-22 14:20   ` Pascal Obry
  2011-11-22 18:29   ` Junio C Hamano
  0 siblings, 2 replies; 8+ messages in thread
From: Holger Hellmuth @ 2011-11-22 11:35 UTC (permalink / raw)
  To: Pascal Obry; +Cc: Git Mailing List

On 22.11.2011 12:21, Pascal Obry wrote:
> A project P1 is under Git.
>
> A project P2 is under Subversion.
>
> P2 in fact replace a sub-directory (say SD) in P1. The project P2 is a
> replacement (extension) of the code in P1.
>
> How to deal with this?

Remove SD in P1, make a logical link from P2 to SD, add SD to 
.git/info/exclude

(see "Bug report - local (and git ignored) file silently removed after 
checkout" on the mailing list why exclude is better than .gitignore at 
the moment)

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

* Re: How to deal with mixed tree?
  2011-11-22 11:35 ` Holger Hellmuth
@ 2011-11-22 14:20   ` Pascal Obry
  2011-11-22 15:08     ` Holger Hellmuth
  2011-11-22 18:29   ` Junio C Hamano
  1 sibling, 1 reply; 8+ messages in thread
From: Pascal Obry @ 2011-11-22 14:20 UTC (permalink / raw)
  To: Holger Hellmuth; +Cc: Git Mailing List


Holger,

> Remove SD in P1, make a logical link from P2 to SD, add SD to
> .git/info/exclude

Thanks for your quick reply. That's what I have tested but...

> (see "Bug report - local (and git ignored) file silently removed after
> checkout" on the mailing list why exclude is better than .gitignore at
> the moment)

Seems like this is working only if file names are different. This is not
my case as the replacement is very similar. With the following script
I'm expecting empty status and no diff:

<<
#!/bin/sh

# create sd (directory that will replace src2)
mkdir sd
echo sd1 > sd/file1
echo sd2 > sd/file2

# create Git repo
mkdir repo
cd repo
git init
mkdir src1
mkdir src2
echo file > src1/file
echo 3 > src2/file3
git add .
git ci -a -m "first"

# let's replace src2 by sd

rm -fr src2
# ln -s ../sd src2
cp -r ../sd src2

# make sure src2 is excluded

echo 'src2/*' >> .git/info/exclude

# the following output should be clean

echo '============== Status'
git status

echo '============== Diff'
git diff
>>

But the output is actually:

Initialized empty Git repository in /home/obry/tmp/repo/.git/
[master (root-commit) 527c7a1] first
 2 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 src1/file
 create mode 100644 src2/file3
cp: cannot stat `../src': No such file or directory
============== Status
# On branch master
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working
directory)
#
#	deleted:    src2/file3
#
no changes added to commit (use "git add" and/or "git commit -a")
============== Diff
diff --git a/src2/file3 b/src2/file3
deleted file mode 100644
index 00750ed..0000000
--- a/src2/file3
+++ /dev/null
@@ -1 +0,0 @@
-3

Any other idea?

Thanks.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B

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

* Re: How to deal with mixed tree?
  2011-11-22 14:20   ` Pascal Obry
@ 2011-11-22 15:08     ` Holger Hellmuth
  2011-11-22 15:21       ` Pascal Obry
  0 siblings, 1 reply; 8+ messages in thread
From: Holger Hellmuth @ 2011-11-22 15:08 UTC (permalink / raw)
  To: pascal; +Cc: Git Mailing List

On 22.11.2011 15:20, Pascal Obry wrote:
>
> Holger,
>
>> Remove SD in P1, make a logical link from P2 to SD, add SD to
>> .git/info/exclude
>
> Thanks for your quick reply. That's what I have tested but...
>
>> (see "Bug report - local (and git ignored) file silently removed after
>> checkout" on the mailing list why exclude is better than .gitignore at
>> the moment)
>
> Seems like this is working only if file names are different. This is not
> my case as the replacement is very similar. With the following script
> I'm expecting empty status and no diff:
>
> <<
> #!/bin/sh
>
> # create sd (directory that will replace src2)
> mkdir sd
> echo sd1>  sd/file1
> echo sd2>  sd/file2
>
> # create Git repo
> mkdir repo
> cd repo
> git init
> mkdir src1
> mkdir src2
> echo file>  src1/file
> echo 3>  src2/file3
> git add .
> git ci -a -m "first"
>
> # let's replace src2 by sd
>
> rm -fr src2
> # ln -s ../sd src2
> cp -r ../sd src2
>
> # make sure src2 is excluded
>
> echo 'src2/*'>>  .git/info/exclude
>
> # the following output should be clean

You should also remove src2 and all files in it from the git repository. 
Something like

git rm -r src2
git ci
echo 'src2' >> .git/info/exclude

instead of

rm -fr src2
echo 'src2/*' >> .git/info/exclude

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

* Re: How to deal with mixed tree?
  2011-11-22 15:08     ` Holger Hellmuth
@ 2011-11-22 15:21       ` Pascal Obry
  2011-11-22 16:14         ` Holger Hellmuth
  0 siblings, 1 reply; 8+ messages in thread
From: Pascal Obry @ 2011-11-22 15:21 UTC (permalink / raw)
  To: Holger Hellmuth; +Cc: Git Mailing List


Holger,

> You should also remove src2 and all files in it from the git repository.
> Something like
> 
> git rm -r src2
> git ci
> echo 'src2' >> .git/info/exclude
> 
> instead of
> 
> rm -fr src2
> echo 'src2/*' >> .git/info/exclude

Thanks this is working indeed. But it was not the whole story :)

In fact I want to do that in a branch (say work) and keep master as-is
as this branch is used to pull changes from origin. And in this case,
doing 'git diff master' still shows the files under src2. See script to
reproduce:

<<
#!/bin/sh

# create sd (directory that will replace src2)
mkdir sd
echo sd1 > sd/file1
echo sd2 > sd/file2

# create Git repo
mkdir repo
cd repo
git init
mkdir src1
mkdir src2
echo file > src1/file
echo 3 > src2/file3
git add .
git ci -a -m "first"

# let's replace src2 by sd in branch work

git checkout -b work
git rm src2/*
git ci -m "no more src2"
# ln -s ../sd src2
cp -r ../sd src2

# make sure src2 is excluded

echo 'src2' >> .git/info/exclude

# the following output should be clean

echo '============== Status'
git status

echo '============== Diff'
git diff

echo '============== Diff master'
git diff master
>>

Is that possible?

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B

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

* Re: How to deal with mixed tree?
  2011-11-22 15:21       ` Pascal Obry
@ 2011-11-22 16:14         ` Holger Hellmuth
  2011-11-22 17:29           ` Pascal Obry
  0 siblings, 1 reply; 8+ messages in thread
From: Holger Hellmuth @ 2011-11-22 16:14 UTC (permalink / raw)
  To: pascal; +Cc: Git Mailing List

On 22.11.2011 16:21, Pascal Obry wrote:
> In fact I want to do that in a branch (say work) and keep master as-is
> as this branch is used to pull changes from origin. And in this case,
> doing 'git diff master' still shows the files under src2. See script to
> reproduce:
[...]
> # let's replace src2 by sd in branch work
>
> git checkout -b work
> git rm src2/*
> git ci -m "no more src2"
> # ln -s ../sd src2
> cp -r ../sd src2
>
> # make sure src2 is excluded
>
> echo 'src2'>>  .git/info/exclude
>
> # the following output should be clean
>
> echo '============== Status'
> git status
>
> echo '============== Diff'
> git diff
>
> echo '============== Diff master'
> git diff master
>>>
>
> Is that possible?
>

In my not-really-expert opinion no. At least git diff master has to show 
something because there obviously is a difference between what is in 
master (that you can't gitignore) and your branch (whether you ignore it 
or not).

I would

a) use a different directory name for src2 and adapt the Makefile to 
cope with that

or

b) remove the src2 link from .git/info/exclude and commit it into the 
branch. That way whenever you switch branch and master, the correct dir 
or link will be present and still because of the link none of the files 
in the svn will be handled by git in any way

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

* Re: How to deal with mixed tree?
  2011-11-22 16:14         ` Holger Hellmuth
@ 2011-11-22 17:29           ` Pascal Obry
  0 siblings, 0 replies; 8+ messages in thread
From: Pascal Obry @ 2011-11-22 17:29 UTC (permalink / raw)
  To: Holger Hellmuth; +Cc: Git Mailing List


Holger,

> In my not-really-expert opinion no. At least git diff master has to show
> something because there obviously is a difference between what is in
> master (that you can't gitignore) and your branch (whether you ignore it
> or not).

I had come to the same conclusion. Sad, it would have been nice to have
an option to fully ignore a path in a repository.

Anyway, thanks a lot for your feedback.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B

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

* Re: How to deal with mixed tree?
  2011-11-22 11:35 ` Holger Hellmuth
  2011-11-22 14:20   ` Pascal Obry
@ 2011-11-22 18:29   ` Junio C Hamano
  1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2011-11-22 18:29 UTC (permalink / raw)
  To: Holger Hellmuth; +Cc: Pascal Obry, Git Mailing List

Holger Hellmuth <hellmuth@ira.uka.de> writes:

> (see "Bug report - local (and git ignored) file silently removed after
> checkout" on the mailing list why exclude is better than .gitignore at
> the moment)

Don't look at it or encourage people to rely on that bug to be
fixed. exclude and .gitignore should behave the same way.

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

end of thread, other threads:[~2011-11-22 18:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-22 11:21 How to deal with mixed tree? Pascal Obry
2011-11-22 11:35 ` Holger Hellmuth
2011-11-22 14:20   ` Pascal Obry
2011-11-22 15:08     ` Holger Hellmuth
2011-11-22 15:21       ` Pascal Obry
2011-11-22 16:14         ` Holger Hellmuth
2011-11-22 17:29           ` Pascal Obry
2011-11-22 18:29   ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.