Skip to main content

Scenario: moved-with-unpushed-commits

A splice with an unpushed commit is moved with git mv. The next push sends the unpushed commit with its own message and author. The move changes no file inside the folder, so it doesn't reach the upstream at all.

push rebuilds the commits that changed the splice's folder. It follows the folder through the move, by the splice's id, and rebuilds the commits from before it under the old path. The move commit m leaves .splice as it was, so it's no last sync: B is still a, and R is b', a copy of b. m changes no file inside the folder, so it has no copy.

Pushed before the move instead, and changed after it: pushed before the move.

Output​

setup.bash builds this state:

$ build_scenario scenario_moved_with_unpushed_commits

Before the move, the local commit is waiting to be pushed:

$ git splice log
=== vendor/a (main)
< e859a6b local change (Test <test@example.com>)

Someone else reorganizes the folders:

$ git mv vendor/a libs/a &&
> git -c user.name=Mover -c user.email=mover@example.com commit -q -m "m: reorganize folders"

After the move m: the monorepo commits a, b and m, where m is H and a is B; in the lane libs/a/, R is b prime on top of k, and m has no copy

The local commit is still the one to push:

$ git splice log
=== libs/a (main)
< e859a6b local change (Test <test@example.com>)
$ git splice push libs/a
ok libs/a: pushed e859a6b to main
$ git -C "$UPSTREAM" log --format='%s (%an)' main
local change (Test)
seed (Test)
$ git splice status
On branch main

up to date libs/a