Skip to content

Support of git submodules ? #818

@bertho-zero

Description

@bertho-zero

Discussed in #817

Originally posted by bertho-zero May 30, 2022
I have a monorepo organized with a git submodule and would like to know how this is handled for the git part if I start using changesets.

The monorepo is private and part of it is public, it looks like this:

/monorepo
  /packages
    /package-a
    /package-b
  /public # git submodule
    /package-c
    /package-d

So packages in public don't have the same git history as packages in packages, how do you think that will react?

For example, the cwd in the method applyReleasePlan is always the same:

let cwd = packages.root.dir;

But the method getCommitsThatAddFiles does not work without additional -C option to git:

await spawn(
"git",
[
"log",
"--diff-filter=A",
"--max-count=1",
"--pretty=format:%h:%p",
gitPath
],
{ cwd }
)

If I do the equivalent manually:

git log --diff-filter=A --max-count=1 --pretty=format:%h:%p -- public/package-c/package.json
# nothing

but the following works:

 git -C public log --diff-filter=A --max-count=1 --pretty=format:%h:%p -- package-c/package.json
# return 588fc62:b5271a4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions