Skip to main content

Jinja2 filter extension for detecting if a directory is a git repository

Project description

Git Directory Extension

Jinja2 filter extension for detecting if a directory is a git repository.

Usage

Examples:

  • Detect if git_path is a git directory
    {{ git_path | gitdir }}
  • Assert that git_path is a git directory
    {{ git_path | gitdir is true }}
  • Assert that git_path is NOT a git directory
    {{ git_path | gitdir is false }}
  • Using gitdir in a conditional
    {% if (git_path | gitdir) %}{{ git_path }} is a git directory{% else %}no git directory at {{ git_path }}{% endif %}

Copier

This can be utilized within a Copier copier.yaml file for determining if the destination path is already initialized as a git directory.

Example:

This will configure a Copier _task to run git init but only if the destination path isn't already a git directory.

_jinja_extensions:
    - jinja2_git_dir.GitDirectoryExtension
_tasks:
  - command: "git init"
    when: "{{ _copier_conf.dst_path | realpath | gitdir }}"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jinja2_git_dir-0.3.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jinja2_git_dir-0.3.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file jinja2_git_dir-0.3.0.tar.gz.

File metadata

  • Download URL: jinja2_git_dir-0.3.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for jinja2_git_dir-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d8a7902b79366a8d98f5db3736723e5169957bd5dbcfec7d17f1cf2bb3e0e713
MD5 a3a36b401a125e96391758cf438da6f4
BLAKE2b-256 6cb22c28b51fe32f8cbd2dad3f3b3f0c44f8a8092216f0b692071b93b76d9333

See more details on using hashes here.

File details

Details for the file jinja2_git_dir-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jinja2_git_dir-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15b794782c6d2b7548525931649aade4ef8685ef4b458284ffe4a2e600ff6511
MD5 9bf0aa0ee5c80167f5fe8be48cac75a3
BLAKE2b-256 9614a1dc9a1b272b3fdbd7ad0ed890a23591a92d19d62014c1eecb97c602d5be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page