bit init fails on submodules

Created on 28 Mar 2020  路  4Comments  路  Source: teambit/bit

Description

When executing bit init inside a submodule, command will fail and throw an error.
On submodule, ".git" is a file and bit is expecting a folder.

Why bit is messing with the git stuff ?

Steps to Reproduce

  1. Add bit-bin
  2. run bit init inside a submodule

Expected Behavior

Bit should initialized

Screenshots, exceptions and logs

Error thrown :
ENOTDIR: not a directory, mkdir '/mnt/c/my_project_folder/.git/bit/components'

Specifications

  • Bit version: 14.7.6
  • Node version: 13.0.1
  • yarn version: 1.9.4
  • Platform: Windows 10 using WSL (Ubuntu 18.04)

Additional context

I'm trying to initialize bit on a submodule (the same way I would run yarn init on a submodule)
Yarn is used
This error happen if I install bit locally OR globally (same error in both cases)

typbug

Most helpful comment

Thanks for reporting this. We will fix it.

All 4 comments

A solution I found is to use -T flag for a standalone implementation.
bit init -T
But I think git submodules should be handled.

Thanks for reporting this. We will fix it.

Why bit is messing with the git stuff ?

It's not that Bit is messing with Git, it uses the .git directory as an ignored location to put the .bit directory. Bit does not touch or manages any of Git's resources.

Glad you found the -t option. As @GiladShoham mentioned, this should be a rather easy fix. Thanks for submitting it.

It's not that Bit is messing with Git, it uses the .git directory

I understand, but the .git directory is git folder and I don't think it's a good practice to hide ignored stuff here. I think hiding stuff there is the exact definition of "messing with git stuff" ;)

I think it would make more sense to have the .bit folder at the project root and to add it on .gitignore It's just my opinion.

Thank you for your replies.
Kevin

Was this page helpful?
0 / 5 - 0 ratings