Hi, is there a "nice" way to tell if a directory I am in has an initialized stacked git instance or not?
Purpose: to augment other high-level management tools to be aware if it is in a stgit context or not "automatically", and then "do the right thing."
My best attempt so far, trying to leverage the existing error checking in stgit:
```
#!/usr/bin/env python3
try:
import stgit.lib.stack
USE_STGIT = True
except ModuleNotFoundError:
USE_STGIT = False
def has_stgit_branch():
if not USE_STGIT:
return False
try:
repo = stgit.lib.stack.StackRepository.default()
stack = repo.get_stack()
except stgit.exception.StgException:
return False
return True
if __name__ == '__main__':
print("stgit? {}".format(has_stgit_branch()))
```