We have already used the info command a couple of times without explaining everything in its output.
Let's execute the info command again to see the current state of the workspace:
cd ../../..
poly info
At the top we have the line stable since: c91fdad (you most likely have another git SHA/hash). To explain what this is, let's take it from the beginning.
If we pass in :commit when a Polylith workspace is created, these git commands are executed:
git init
git add .
git commit -m "Workspace created."
If we don't pass in :commit to the create workspace command, then we have to perform these (or similar) commands manually.
If we run git log from the workspace root, it returns something like this:
commit c91fdad4a34927d9aacfe4b04ea2f304f3303282 (HEAD -> main)
Author: lisa <[email protected]>
Date: Thu Sep 3 06:11:23 2020 +0200
Workspace created.
This is the first and only commit of this repository so far. This is also the first stable point in time of this workspace which the tool uses when it calculates what changes have been made (up till now). Notice that the first letters of the hash correspond to stable since: c91fdad and this is because it refers to this SHA-1 hash in git.
The command-line and development projects, and the user and cli bricks are all marked with an asterisk, *. The way the tool calculates changes is to ask git by running this command internally:
git diff c91fdad4a34927d9aacfe4b04ea2f304f3303282 --name-only
We can also run the diff command, which will execute the same git statement internally:
poly diff
The output is the same (this assumes that you have added the files to your git repository):
Here we have the answer to where the * signs come from. The paths that start with projects/command-line/, development/, components/user/ and bases/cli/ makes the tool understand that command-line, development, user and cli are changed.
When we created the workspace, a .gitignore file was also created for us. Now is a good time to add more rows here if needed:
Let's add and commit the changed files:
git add --all
git commit -m "Created the user and cli bricks."
Let's have a look at our workspace repository again:
git log --pretty=oneline
e7ebe683a775ec28b7c2b5d77e01e79d48149d13 (HEAD -> main) Created the user and cli bricks.
c91fdad4a34927d9aacfe4b04ea2f304f3303282 Workspace created.
If we run the info command again, it will return the same result as before, and the reason is that we haven't told git to move the stable point in time to our second commit.
We said that the diff command returns the same result as git diff SHA --name-only. This i normally true, except for the case when the workspace lives inside a git repo. In that case, the git diff command will also return the workspace directory in the path (which is stripped away by the poly tool). This directory can be shown by running the poly ws get:ws-local-dircommand.