Skip to content

Detect changes in remote repositories when listing dependencies #302

@SebastianBalle

Description

@SebastianBalle

I would like Gitman to be able to detect changes/committed changes in dependency repositories as changes are often implemented directly within the project for testing when using the dependency repository as a submodule.

I have an example of gitman.yaml

location: .gitman
sources:
  - repo: https://[org]@dev.azure.com/[org]/[project]/_git/[repo]
    name: utils
    rev: main
    type: git
    params:
    sparse_paths:
      -
    links:
      - source: ''
        target: .config
      - source: .pre-commit-config.yaml
        target: .pre-commit-config.yaml

Assume I am making a change directly in the .pre-commit-config.yaml in the root project then I expect git to detect the changes/commited changes as they do for git submodules.

cd .gitman/utils
gitman list --fail-if-dirt  # OK

echo '#' >> .pre-commit-config.yaml
gitman list --fail-if-dirt  # Uncommitted changes

git add .pre-commit-config.yaml
gitman list --fail-if-dirt  # Uncommitted changes

git commit -m"test"
gitman list --fail-if-dirt # OK, but it's not OK - the change has not been pushed to remote repo

If I run git status from the root I also don't see any changes. I would like to have an indication from Gitman that the dependency repository is in state "Your branch is ahead of 'origin/main' by X commit".

One way to mitigate this would be to configure a git alias alias git='f(){ if ! gitman list --fail-if-dirt > /dev/null; then gitman list --fail-if-dirt; fi; git "$@"; unset -f f; }; f' to make sure this command is executed before any git commands. However, this will not capture the committed changes. This command also returns exit code 0 even though ´gitman` returns an error. I would expect exit code 1.

If this is not resolved I am affraid that users will forget that they made any changes to a dependency project and suddenly a lot of changes might be missed and forgotten.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions