Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a step-by-step git commiter #94

Open
sledigabel opened this issue Jun 12, 2023 · 3 comments
Open

Introduce a step-by-step git commiter #94

sledigabel opened this issue Jun 12, 2023 · 3 comments
Assignees

Comments

@sledigabel
Copy link
Contributor

sledigabel commented Jun 12, 2023

On large repo lists, one often has to run this kind of workflow:

turbolift clone
turbolift forearch <insert here the command to change the repo>

then, to validate the changes, they would run something like this:

turbolift foreach git diff
<frantically scroll through thousands of lines to figure out whether all repositories are successfully changed>
<then, trusting your eye sight, you stage and commit>
turbolift commit

It would be nice to have a way to commit those step-by-step with a visual validation from the user, introducing a --incremental.

The workflow would look like:

turbolift commit -i
-- Repository: REPOSITORY_NAME_1
<git diff on this specific repo>
<prompt for the user to confirm with a y/N>
-- Repository: REPOSITORY_NAME_2
...

We will log in the end the repo list that WASN'T updated, the user can decide what to do with it then.

@sledigabel sledigabel self-assigned this Jun 12, 2023
@sledigabel
Copy link
Contributor Author

@rnorth that's kinda what I talked about in the last TAB.
thoughts?

@sledigabel
Copy link
Contributor Author

Further questions: Should it be Y/n or y/N? Easier to start with no default to start with and see what happens.

@sledigabel
Copy link
Contributor Author

Started working on this, just to validate the proposed workflow:

  1. new flag incremental for commit, toggled off by default
  2. if activated:
    • it will start by printing the git diff (I suggest running -U1 which will only print a single line above and below the change), then
    • ask for user confirmation (there's already a prompt module in the project)
    • if green light, go ahead with the commit
    • if not, add to skip

The untracked files are explicitly excluded from the list, because by default git commit -a will not include them.
Perhaps we could highlight this in a future iteration but I don't think it's required now.

Does this workflow look alright? cc @rnorth @Dan7-7-7

sledigabel added a commit that referenced this issue Feb 1, 2024
While looking at #94, I've notived that the output of `turbolift commit`
includes a weird line:

```
Executing: /opt/homebrew/bin/zsh [-c ...]
```

This is because `isRepoChanged` function executes a command to figure out whether something is marked as changed. Every command executed generates an echo of the command for the user.

This PR introduces a new flag on the executor that will skip the echo.
This fixes the extraneous output in `isRepoChanged` but will also be
useful in future features.
sledigabel added a commit that referenced this issue Feb 26, 2024
* fix(executor): Adding silent mode and tests

While looking at #94, I've notived that the output of `turbolift commit`
includes a weird line:

```
Executing: /opt/homebrew/bin/zsh [-c ...]
```

This is because `isRepoChanged` function executes a command to figure out whether something is marked as changed. Every command executed generates an echo of the command for the user.

This PR introduces a new flag on the executor that will skip the echo.
This fixes the extraneous output in `isRepoChanged` but will also be
useful in future features.

* fix(executor): Fix unit test and condition pattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant