Skip to content

Instantly share code, notes, and snippets.

@mscottford
Created June 16, 2022 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mscottford/c1ce426653b5a7ae257e18a1a9b8072a to your computer and use it in GitHub Desktop.
Save mscottford/c1ce426653b5a7ae257e18a1a9b8072a to your computer and use it in GitHub Desktop.
Feature: `git clone` command
Used to clone the project into the cache directory.
```
freshli [global options] git clone [command options] <repository-url>
```
**What this command does?**
Uses the `git` command to clone the repository under the `$CACHE_ROOT/repositories/` directory. A unique ID will also be generated for the repository. Repository ID, url, and path will be added to the `repositories` table in the cache database. The command’s only output to STDOUT is the repository id.
Global Options
- `--cache-dir <path>`
- the location where the `freshli` command will write temporary files as part of it’s processing
- default value: `$HOME/.freshli`
Command Options
- `--git-path`
- Path to the `git` binary
- default value: `git`
- `--branch <name>`
- The branch to checkout after cloning the repository
- If the option is not specified, then no checkout command will be issued. The remote server’s default branch will be used instead.
Scenario: Simple example
Given I ran `freshli cache prepare`
And there is no directory "~/.freshli/repositories"
When I run `freshli git clone https://github.com/corgibytes/freshli-fixture-ruby-nokotest`
Then there is a cloned Git repository located at a path matching "~/.freshli/repositories/**/freshli-fixture-ruby-nokotest" with a Git SHA "017031627f36deb582d69cddd381718be0044b02" checked out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment