Skip to content

Commit

Permalink
Add simple warning in the case you use sparse-checkout and the output…
Browse files Browse the repository at this point in the history
… is empty possibly indicating error in the sparse paths defined in the config file
  • Loading branch information
Grokzen committed Aug 25, 2023
1 parent a1622f0 commit 6f2b74f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions subgit/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,21 @@ def pull(self, names):

# Set what paths we defined to be checked out
g.sparse_checkout("set", *repos)

# List all items (files and directories) in the cwd
items = list(p.iterdir())

# Filter out the '.git' folder
visible_items = [
item
for item in items
if item.name != '.git'
]

log.debug(f"Visible items after filtering {visible_items}")

if len(visible_items) == 0:
log.warning("You have sparse checkout enabled but no files was found in the git repo after your filter. Possible that your paths do not match any content in the git repo.")
else:
# By always setting disable as a default, this will automatically revert any repo
# that used to have sparse enabled but no longer is ensabled
Expand Down

0 comments on commit 6f2b74f

Please sign in to comment.