All of lore.kernel.org
 help / color / mirror / Atom feed
* GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo
@ 2011-04-23 17:04 Siddique Hameed
  2011-04-24  7:59 ` Chris Packham
  0 siblings, 1 reply; 5+ messages in thread
From: Siddique Hameed @ 2011-04-23 17:04 UTC (permalink / raw)
  To: git

I don't want to categorize this as bug until I hear expert panel's
opinion. Spare me if its a known issue or if I am doing something
silly :) I did enough research online and couldn't find a good answer.

Here it goes..

Let's say if I have a folder called "ParentGITRepo" which is a local
GIT repo. I have sub folders called "Child1Repo" and "Child2" with
some files on it. For some reason, whether accidentally or
deliberately, I make "Child1Repo" a GIT repo on its own. GIT
recognizes ParentGITRepo & Child1Repo as separate GIT repositories.
But, if I clone "ParentGITRepo" into somewhere else, I am missing
everything from Child1Repo. The worse thing is, even if I cleanup
"Child1Repo" by removing it's .git folder, the parent GIT repo is
ignoring any activity I do in that folder.

I think, the right way to do this setup is probably using git sub
modules or something. But given this scenario, what is the expected
behaviour? Am i missing? It would really make more sense if you can go
thro the following steps (test cases) outlined below.


# Setting up ParentGITRepo & Child1Repo and Child2
$ cd ~
$ mkdir ParentGITRepo
$ cd ParentGITRepo/
$ git init .
$ mkdir Child1Repo
$ mkdir Child2
$ cd Child1Repo/
$ git init .
$ echo "Child1RepoFile" > Child1RepoFile.txt
$ git add .
$ git commit -a -m "Adding Child1Repo content"
[master (root-commit) 01ccc52] Adding Child1Repo content
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 Child1RepoFile.txt

$ cd ../Child2/
$ echo "Child2 file content" > Child2File.txt
$ cd ..
$ echo "Parentfile" > ParentFile.txt
$ git add .
$ git commit -a -m "Adding Parent content"
[master (root-commit) b31d0a5] Adding Parent content
 3 files changed, 3 insertions(+), 0 deletions(-)
 create mode 160000 Child1Repo
 create mode 100644 Child2/Child2File.txt
 create mode 100644 ParentFile.txt

---------------------------------------
 # Now verify ParentGITRepo & Child1Repo working independently
$ cd ~/ParentGITRepo/
$ git log
commit b31d0a5aef19c6b119d89718f560905ad0f34aa7
Author: Siddique Hameed <siddii+git@gmail.com>
Date:   Fri Apr 22 11:25:15 2011 -0500

   Adding Parent content

$ cd ~/ParentGITRepo/Child1Repo/
$ git log
commit 01ccc52931f8b40f6d92b29769300a254d8dd411
Author: Siddique Hameed <siddii+git@gmail.com>
Date:   Fri Apr 22 11:22:00 2011 -0500

   Adding Child1Repo content

--------------------------------------------

# Now try cloning ParentGITRepo & verify the contents inside it
$ cd ~
$ git clone ParentGITRepo/ ParentGITRepoClone/
Cloning into ParentGITRepoClone...
done.
$ cd ParentGITRepoClone/
$ ls -a
./  ../  .git/  Child1Repo/  Child2/  ParentFile.txt

$ cd Child1Repo/
$ ls -a
./  ../

$ git log
commit b31d0a5aef19c6b119d89718f560905ad0f34aa7
Author: Siddique Hameed <siddii+git@gmail.com>
Date:   Fri Apr 22 11:25:15 2011 -0500

   Adding Parent content

--------------------------------------------

As you can see there is nothing in Child1Repo after its was cloned. I
also tried the reverse of this. Like, having a child folder as GIT
repo and make a ParentFolder a repo on its own & clone the parent
folder and the cloned folder doesnt contain anything from child repo.

Let me know if you have more questions.

Thanks,

Siddique

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

* Re: GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo
  2011-04-23 17:04 GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo Siddique Hameed
@ 2011-04-24  7:59 ` Chris Packham
  2011-04-24 11:25   ` Off-topic Thunderbird wrapping (was Re: GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo) Chris Packham
  2011-04-25 22:34   ` GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo Siddique Hameed
  0 siblings, 2 replies; 5+ messages in thread
From: Chris Packham @ 2011-04-24  7:59 UTC (permalink / raw)
  To: Siddique Hameed; +Cc: git

On 24/04/11 05:04, Siddique Hameed wrote:
> I don't want to categorize this as bug until I hear expert panel's
> opinion. Spare me if its a known issue or if I am doing something
> silly :) I did enough research online and couldn't find a good answer.

Not exactly an expert but I'll try to help.

> Here it goes..
>
> Let's say if I have a folder called "ParentGITRepo" which is a local
> GIT repo. I have sub folders called "Child1Repo" and "Child2" with
> some files on it. For some reason, whether accidentally or
> deliberately, I make "Child1Repo" a GIT repo on its own. GIT
> recognizes ParentGITRepo&  Child1Repo as separate GIT repositories.
> But, if I clone "ParentGITRepo" into somewhere else, I am missing
> everything from Child1Repo.

That's expected behaviour as far as I'm concerned (based on your 
example). ParentGITRepo and Child1Repo are completely independent at 
this point. Cloning ParentGITRepo won't get you any untracked files that 
happen to be in the work-tree of the repository you're cloning.

> The worse thing is, even if I cleanup
> "Child1Repo" by removing it's .git folder, the parent GIT repo is
> ignoring any activity I do in that folder.

So your options at this point are to make Child1Repo a submodule or to 
re-write ParentGITRepo and Child1Repo into a new repository combining 
the history of both. Depending on your exact needs one option may be 
better than the other so do some more googling to find something that 
suits your case.

> I think, the right way to do this setup is probably using git sub
> modules or something. But given this scenario, what is the expected
> behaviour? Am i missing? It would really make more sense if you can go
> thro the following steps (test cases) outlined below.
>
>
> # Setting up ParentGITRepo&  Child1Repo and Child2
> $ cd ~
> $ mkdir ParentGITRepo
> $ cd ParentGITRepo/
> $ git init .
> $ mkdir Child1Repo
> $ mkdir Child2
> $ cd Child1Repo/
> $ git init .
> $ echo "Child1RepoFile">  Child1RepoFile.txt
> $ git add .
> $ git commit -a -m "Adding Child1Repo content"

At this point you could have just treated Child1Repo as a normal 
subdirectory. One thing some people struggle with is the fact that git 
doesn't track empty directories, as soon as there a files in those 
directories it'll work just fine.

> [master (root-commit) 01ccc52] Adding Child1Repo content
>   1 files changed, 1 insertions(+), 0 deletions(-)
>   create mode 100644 Child1RepoFile.txt
>
> $ cd ../Child2/
> $ echo "Child2 file content">  Child2File.txt
> $ cd ..
> $ echo "Parentfile">  ParentFile.txt
> $ git add .
> $ git commit -a -m "Adding Parent content"
> [master (root-commit) b31d0a5] Adding Parent content
>   3 files changed, 3 insertions(+), 0 deletions(-)
>   create mode 160000 Child1Repo
>   create mode 100644 Child2/Child2File.txt
>   create mode 100644 ParentFile.txt
>
> ---------------------------------------
>   # Now verify ParentGITRepo&  Child1Repo working independently
> $ cd ~/ParentGITRepo/
> $ git log
> commit b31d0a5aef19c6b119d89718f560905ad0f34aa7
> Author: Siddique Hameed<siddii+git@gmail.com>
> Date:   Fri Apr 22 11:25:15 2011 -0500
>
>     Adding Parent content
>
> $ cd ~/ParentGITRepo/Child1Repo/
> $ git log
> commit 01ccc52931f8b40f6d92b29769300a254d8dd411
> Author: Siddique Hameed<siddii+git@gmail.com>
> Date:   Fri Apr 22 11:22:00 2011 -0500
>
>     Adding Child1Repo content
>
> --------------------------------------------
>
> # Now try cloning ParentGITRepo&  verify the contents inside it
> $ cd ~
> $ git clone ParentGITRepo/ ParentGITRepoClone/
> Cloning into ParentGITRepoClone...
> done.
> $ cd ParentGITRepoClone/
> $ ls -a
> ./  ../  .git/  Child1Repo/  Child2/  ParentFile.txt
>
> $ cd Child1Repo/
> $ ls -a
> ./  ../
>
> $ git log
> commit b31d0a5aef19c6b119d89718f560905ad0f34aa7
> Author: Siddique Hameed<siddii+git@gmail.com>
> Date:   Fri Apr 22 11:25:15 2011 -0500
>
>     Adding Parent content
>
> --------------------------------------------
>
> As you can see there is nothing in Child1Repo after its was cloned. I
> also tried the reverse of this. Like, having a child folder as GIT
> repo and make a ParentFolder a repo on its own&  clone the parent
> folder and the cloned folder doesnt contain anything from child repo.
>
> Let me know if you have more questions.
>
> Thanks,
>
> Siddique
> --

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

* Off-topic Thunderbird wrapping (was Re: GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo)
  2011-04-24  7:59 ` Chris Packham
@ 2011-04-24 11:25   ` Chris Packham
  2011-04-24 11:54     ` Tor Arntsen
  2011-04-25 22:34   ` GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo Siddique Hameed
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Packham @ 2011-04-24 11:25 UTC (permalink / raw)
  To: git

On 24/04/11 19:59, Chris Packham wrote:
>
> That's expected behaviour as far as I'm concerned (based on your
> example). ParentGITRepo and Child1Repo are completely independent at
> this point. Cloning ParentGITRepo won't get you any untracked files that
> happen to be in the work-tree of the repository you're cloning.

So this is the 2nd response I've sent recently that Thunderbird didn't 
wrap correctly (yet it looks fine in the composer). Can anybody tell me 
(or point me at a webpage) how to set it up to post to mailing lists nicely?

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

* Re: Off-topic Thunderbird wrapping (was Re: GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo)
  2011-04-24 11:25   ` Off-topic Thunderbird wrapping (was Re: GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo) Chris Packham
@ 2011-04-24 11:54     ` Tor Arntsen
  0 siblings, 0 replies; 5+ messages in thread
From: Tor Arntsen @ 2011-04-24 11:54 UTC (permalink / raw)
  To: Chris Packham; +Cc: git

On Sun, Apr 24, 2011 at 13:25, Chris Packham <judge.packham@gmail.com> wrote:

> So this is the 2nd response I've sent recently that Thunderbird didn't wrap
> correctly (yet it looks fine in the composer). Can anybody tell me (or point
> me at a webpage) how to set it up to post to mailing lists nicely?

See SubmittingPatches in the Git Documentation/ subdirectory (comes
with the distro).
I used that to fix my own Thunderbird setup.

-Tor

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

* Re: GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo
  2011-04-24  7:59 ` Chris Packham
  2011-04-24 11:25   ` Off-topic Thunderbird wrapping (was Re: GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo) Chris Packham
@ 2011-04-25 22:34   ` Siddique Hameed
  1 sibling, 0 replies; 5+ messages in thread
From: Siddique Hameed @ 2011-04-25 22:34 UTC (permalink / raw)
  To: Chris Packham; +Cc: git

Hi Chris,

Thanks for your response. I figured out what I was doing wrong -
http://groups.google.com/group/git-users/browse_thread/thread/d34523680b0ad093

On Sun, Apr 24, 2011 at 2:59 AM, Chris Packham <judge.packham@gmail.com> wrote:
> On 24/04/11 05:04, Siddique Hameed wrote:
>>
>> I don't want to categorize this as bug until I hear expert panel's
>> opinion. Spare me if its a known issue or if I am doing something
>> silly :) I did enough research online and couldn't find a good answer.
>
> Not exactly an expert but I'll try to help.
>
>> Here it goes..
>>
>> Let's say if I have a folder called "ParentGITRepo" which is a local
>> GIT repo. I have sub folders called "Child1Repo" and "Child2" with
>> some files on it. For some reason, whether accidentally or
>> deliberately, I make "Child1Repo" a GIT repo on its own. GIT
>> recognizes ParentGITRepo&  Child1Repo as separate GIT repositories.
>> But, if I clone "ParentGITRepo" into somewhere else, I am missing
>> everything from Child1Repo.
>
> That's expected behaviour as far as I'm concerned (based on your example).
> ParentGITRepo and Child1Repo are completely independent at this point.
> Cloning ParentGITRepo won't get you any untracked files that happen to be in
> the work-tree of the repository you're cloning.
>
>> The worse thing is, even if I cleanup
>> "Child1Repo" by removing it's .git folder, the parent GIT repo is
>> ignoring any activity I do in that folder.
>
> So your options at this point are to make Child1Repo a submodule or to
> re-write ParentGITRepo and Child1Repo into a new repository combining the
> history of both. Depending on your exact needs one option may be better than
> the other so do some more googling to find something that suits your case.
>
>> I think, the right way to do this setup is probably using git sub
>> modules or something. But given this scenario, what is the expected
>> behaviour? Am i missing? It would really make more sense if you can go
>> thro the following steps (test cases) outlined below.
>>
>>
>> # Setting up ParentGITRepo&  Child1Repo and Child2
>> $ cd ~
>> $ mkdir ParentGITRepo
>> $ cd ParentGITRepo/
>> $ git init .
>> $ mkdir Child1Repo
>> $ mkdir Child2
>> $ cd Child1Repo/
>> $ git init .
>> $ echo "Child1RepoFile">  Child1RepoFile.txt
>> $ git add .
>> $ git commit -a -m "Adding Child1Repo content"
>
> At this point you could have just treated Child1Repo as a normal
> subdirectory. One thing some people struggle with is the fact that git
> doesn't track empty directories, as soon as there a files in those
> directories it'll work just fine.
>
>> [master (root-commit) 01ccc52] Adding Child1Repo content
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>  create mode 100644 Child1RepoFile.txt
>>
>> $ cd ../Child2/
>> $ echo "Child2 file content">  Child2File.txt
>> $ cd ..
>> $ echo "Parentfile">  ParentFile.txt
>> $ git add .
>> $ git commit -a -m "Adding Parent content"
>> [master (root-commit) b31d0a5] Adding Parent content
>>  3 files changed, 3 insertions(+), 0 deletions(-)
>>  create mode 160000 Child1Repo
>>  create mode 100644 Child2/Child2File.txt
>>  create mode 100644 ParentFile.txt
>>
>> ---------------------------------------
>>  # Now verify ParentGITRepo&  Child1Repo working independently
>> $ cd ~/ParentGITRepo/
>> $ git log
>> commit b31d0a5aef19c6b119d89718f560905ad0f34aa7
>> Author: Siddique Hameed<siddii+git@gmail.com>
>> Date:   Fri Apr 22 11:25:15 2011 -0500
>>
>>    Adding Parent content
>>
>> $ cd ~/ParentGITRepo/Child1Repo/
>> $ git log
>> commit 01ccc52931f8b40f6d92b29769300a254d8dd411
>> Author: Siddique Hameed<siddii+git@gmail.com>
>> Date:   Fri Apr 22 11:22:00 2011 -0500
>>
>>    Adding Child1Repo content
>>
>> --------------------------------------------
>>
>> # Now try cloning ParentGITRepo&  verify the contents inside it
>> $ cd ~
>> $ git clone ParentGITRepo/ ParentGITRepoClone/
>> Cloning into ParentGITRepoClone...
>> done.
>> $ cd ParentGITRepoClone/
>> $ ls -a
>> ./  ../  .git/  Child1Repo/  Child2/  ParentFile.txt
>>
>> $ cd Child1Repo/
>> $ ls -a
>> ./  ../
>>
>> $ git log
>> commit b31d0a5aef19c6b119d89718f560905ad0f34aa7
>> Author: Siddique Hameed<siddii+git@gmail.com>
>> Date:   Fri Apr 22 11:25:15 2011 -0500
>>
>>    Adding Parent content
>>
>> --------------------------------------------
>>
>> As you can see there is nothing in Child1Repo after its was cloned. I
>> also tried the reverse of this. Like, having a child folder as GIT
>> repo and make a ParentFolder a repo on its own&  clone the parent
>> folder and the cloned folder doesnt contain anything from child repo.
>>
>> Let me know if you have more questions.
>>
>> Thanks,
>>
>> Siddique
>> --
>

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

end of thread, other threads:[~2011-04-25 22:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-23 17:04 GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo Siddique Hameed
2011-04-24  7:59 ` Chris Packham
2011-04-24 11:25   ` Off-topic Thunderbird wrapping (was Re: GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo) Chris Packham
2011-04-24 11:54     ` Tor Arntsen
2011-04-25 22:34   ` GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo Siddique Hameed

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.