Skip to content

Commit

Permalink
Merge pull request #19 from zauberzeug/better_summary
Browse files Browse the repository at this point in the history
Allow git summary when syncing sub dir of repo
  • Loading branch information
falkoschindler authored Dec 31, 2023
2 parents 5826972 + 1826355 commit 7b360d8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions livesync/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,13 @@ def _get_ignores(self) -> List[str]:

def get_summary(self) -> str:
summary = f'{self.source_path} --> {self.target}\n'
if not (self.source_path / '.git').exists():
return summary
try:
cmd = ['git', 'log', '--pretty=format:[%h]\n', '-n', '1']
summary += subprocess.check_output(cmd, cwd=self.source_path).decode()
cmd = ['git', 'status', '--short', '--branch']
summary += subprocess.check_output(cmd, cwd=self.source_path).decode().strip() + '\n'
except Exception:
pass # maybe git is not installed
pass # not a git repo, git is not installed, or something else
return summary

async def watch(self) -> None:
Expand Down

0 comments on commit 7b360d8

Please sign in to comment.