Skip to content

Always squash when pulling a different subrepo branch? #325

@svelez

Description

@svelez

While implementing some processes, I noticed that I pull doesn't behave as I expect it to... perhaps only when switching the branch tracked by the subrepo.

Instead of having all commits from the super-repos subrepo folder applied to the subrepo history on commit, I get a single, squashed commit.

To demonstrate this, I have published https://github.com/svelez/problem-superrepo-demo.

Once that is cloned, issue git subrepo pull --branch working sub

There is a conflict in that pull which lets me more easily demonstrate the resulting subrepo history:

$ git -C .git/tmp/subrepo/sub log --oneline
ee7e336 (HEAD -> subrepo/sub, refs/subrepo/sub/branch) Silly change
10c91b3 (refs/subrepo/sub/commit) making changes
ff1e95f init commit

Which shows just one change made in the superrepo after the subrepo clone when there were actually two.

Contrarily, if I simply execute the branch command, I get this:

$ git subrepo branch sub
Created branch 'subrepo/sub' and worktree '.git/tmp/subrepo/sub'.
$ git -C .git/tmp/subrepo/sub log --oneline
872e81e (HEAD -> subrepo/sub, refs/subrepo/sub/branch) Silly change
7d58f36 Adding file that is in other branch
10c91b3 (refs/subrepo/sub/commit) making changes
ff1e95f init commit

Which is what I would expect to see when resolving conflicts doing the pull.

Is this the intended behavior?

After some investigation, it appears to me that the current, actual behavior is caused by this line and if I comment it out, I get the behavior that I would expect.

However, I don't understand enough about the system to know if there is ever a valid case for hard-coding HEAD's parent.

Any insight you could provide would be appreciated. Is there a more correct method to do what I want to do (have the super repo start tracking a different branch of the subrepo)

I am working off of the release/0.4.0_rebase_to_master branch

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions