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

Extend batou.lib.git.Clone() to stop on unclean checkout target #298

Closed
frlan opened this issue Jul 28, 2022 · 1 comment
Closed

Extend batou.lib.git.Clone() to stop on unclean checkout target #298

frlan opened this issue Jul 28, 2022 · 1 comment
Assignees
Milestone

Comments

@frlan
Copy link
Member

frlan commented Jul 28, 2022

Currently batou.lib.git.Clone() does a Clone also in case of the git status is detecting some changed code inside the checkout target folder:

    def has_changes(self):
        with self.chdir(self.target):
            stdout, stderr = self.cmd("git status --porcelain")
        return bool(stdout.strip())

and from verify()

            if self.has_changes():
                output.annotate(
                    "Git clone at {} is dirty, going to lose changes.".format(
                        self.target
                    ),
                    red=True,
                )
                raise UpdateNeeded()

I think we might should add an flag to prevent this and rather failing the deployment.

Some applications like Wordpress are storing content created/manipulated by them inside the source folders all around the codebasis. It's not always 100% determinable where they will be. When proceeding with an unclean git status data/changes might get lost.

@ctheune
Copy link
Member

ctheune commented Aug 22, 2022

"no_clobber" could be a good option name as it's in line with unix philosophy. thanks @elikoga

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

3 participants