Skip to content

Commit

Permalink
Revert "Avoid reinstalling img/ and README from dotfiles"
Browse files Browse the repository at this point in the history
  • Loading branch information
alichtman committed Mar 25, 2020
1 parent fc0bcb2 commit d14a9f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
31 changes: 14 additions & 17 deletions README.md
Expand Up @@ -88,27 +88,24 @@ Here's a `bash` script that I wrote to automate my dotfile backup workflow. You

```bash
# Usage: backup-dots [COMMIT MESSAGE]
backup-dots () {
function backup-dots() {
echo "Backing up..."
crontab -l > ~/.config/crontab
(
shallow-backup -no_splash -dotfiles -separate_dotfiles_repo
cd "$HOME/shallow-backup/dotfiles/" || exit
hub stash
hub pull
hub stash pop
hub add .
commit_msg="$1"
if [ -z "$commit_msg" ]
then
hub commit --verbose
else
hub commit -m "$commit_msg"
fi
hub push
shallow-backup -no_splash -dotfiles -separate_dotfiles_repo;
cd "$HOME/shallow-backup/dotfiles/" || exit
git add .
# If no commit message is provided, open vim.
# Otherwise, commit with the provided message
commit_msg="$1"
if [ -z "$commit_msg" ] ; then
git commit --verbose
else
git commit -m "$commit_msg"
fi
git push
)
}
```

### What can I back up?
Expand Down
8 changes: 3 additions & 5 deletions shallow_backup/utils.py
Expand Up @@ -130,20 +130,18 @@ def destroy_backup_dir(backup_path):
def get_abs_path_subfiles(directory):
"""
Returns list of absolute paths of files and folders contained in a directory,
excluding the .git directory, .gitignore, img/ and README.md in the root dir.
excluding the root .git directory and root .gitignore..
"""
file_paths = []
for path, _, files in os.walk(directory):
for name in files:
joined = os.path.join(path, name)
root_git_dir = os.path.join(directory, ".git")
root_gitignore = os.path.join(directory, ".gitignore")
img = os.path.join(directory, "img")
readme = os.path.join(directory, "readme.md")
if not any(root_git_dir, root_gitignore, img, readme) in joined:
if root_git_dir not in joined and root_gitignore not in joined:
file_paths.append(joined)
else:
print_path_red("Excluded:", joined)
print(f"Excluded: {joined}")
return file_paths


Expand Down

0 comments on commit d14a9f4

Please sign in to comment.