Skip to content

Commit

Permalink
fix: rename prune config
Browse files Browse the repository at this point in the history
  • Loading branch information
redstreet committed Aug 26, 2023
1 parent 3bd7b46 commit 7c0a1c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ named `mydropbox`, the URL `rclone://mydropbox/myrepository` identifies a remote
in a directory `myrepository/` under this DropBox account.

## Configuration

`git-remote-rclone` can be configured to get git to prune the repo aggressively before
uploading via rclone. This comes in handy to minimize the uploaded file size. To
configure it, run this in your git repo:
uploading via rclone. This comes in handy to minimize the uploaded file size, at the
cost of the time taken to prune. This is a good tradeoff for low-bandwidth situations.
To configure it, run this in your git repo:

```
git config --add gitremoterclone.prunefirst "true"
git config --add git-remote-rclone.pruneaggressively "true"
```

## Example
Expand Down
4 changes: 2 additions & 2 deletions git-remote-rclone
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ class RCloneRemote(object):

def gitgc(self):
"""Prune aggressively if configured via:
git config --add gitremoterclone.prunefirst "true"
git config --add git-remote-rclone.pruneaggressively "true"
"""
env_orig = os.environ.copy()
env_orig['GIT_DIR'] = str(self.gitdir)
env = os.environ.copy()
env['GIT_DIR'] = str(self.repodir)

prune = self.run_cmd(['git', 'config', 'gitremoterclone.prunefirst'],
prune = self.run_cmd(['git', 'config', 'git-remote-rclone.pruneaggressively'],
env=env_orig, check=False).strip().lower()
self.log(f"Prune is: {prune}")
gc_cmd = ['git', 'gc']
Expand Down

0 comments on commit 7c0a1c5

Please sign in to comment.