Example #1
0
 def checkout(self, check: bool = True, track: bool = False) -> None:
     current_commit = GitOffline.current_head_commit_sha(self.path)
     # TODO: Should this always check out detached HEAD?
     if current_commit == self.sha and GitOffline.is_detached(self.path):
         CONSOLE.stdout(' - On correct commit')
         return
     CONSOLE.stdout(f' - Checkout commit {Format.Git.ref(self.short_ref)}')
     super().checkout(check=check, track=track)
Example #2
0
    def wrapper(*args, **kwargs):
        """Wrapper"""

        instance = args[0]
        if GitOffline.is_detached(instance.path):
            CONSOLE.stdout(' - HEAD is detached')
            raise Exception('Detached HEAD')
        return func(*args, **kwargs)
Example #3
0
 def is_detached(self) -> bool:
     return GitOffline.is_detached(self.path)