poly
Search…
Git
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:
1
cd ../../..
2
poly info
Copied!
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.
When a Polylith workspace is created, these git commands are executed:
1
git init
2
git add .
3
git commit -m "Workspace created."
Copied!
If we run git log from the workspace root, it returns something like this:
1
commit c91fdad4a34927d9aacfe4b04ea2f304f3303282 (HEAD -> main)
2
Author: lisa <[email protected]>
3
Date: Thu Sep 3 06:11:23 2020 +0200
4
5
Workspace created.
Copied!
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:
1
git diff c91fdad4a34927d9aacfe4b04ea2f304f3303282 --name-only
Copied!
We can also run the diff command, which will execute the same git statement internally:
1
poly diff
Copied!
The output is the same (this assumes that you have added the files to your git repository):
1
bases/cli/resources/cli/.keep
2
bases/cli/src/se/example/cli/core.clj
3
bases/cli/test/se/example/cli/core_test.clj
4
components/user/resources/user/.keep
5
components/user/src/se/example/user/core.clj
6
components/user/src/se/example/user/interface.clj
7
components/user/test/se/example/user/interface_test.clj
8
deps.edn
9
development/src/dev/lisa.clj
10
projects/command-line/deps.edn
11
scripts/build-cli-uberjar.sh
12
scripts/build-uberjar.sh
13
workspace.edn
Copied!
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:
1
**/classes
2
**/target
Copied!
Let's add and commit the changed files:
1
git add --all
2
git commit -m "Created the user and cli bricks."
Copied!
Let's have a look at our workspace repository again:
1
git log --pretty=oneline
Copied!
1
e7ebe683a775ec28b7c2b5d77e01e79d48149d13 (HEAD -> main) Created the user and cli bricks.
2
c91fdad4a34927d9aacfe4b04ea2f304f3303282 Workspace created.
Copied!
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.
Last modified 1mo ago
Copy link