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.1.1.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.1.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jinja2_git_dir-0.1.1.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.1.1.tar.gz
Algorithm Hash digest
SHA256 ae23724dd74ee5577a0d8aad55149991fa0f690fd3e8be61146eea575ffdac8b
MD5 645bc24fec794c2212a118dbf539ca4b
BLAKE2b-256 391a78ed566ab3e1c6b6fd124bcda86394850fada15afd0402774324361f2734

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jinja2_git_dir-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a091e43ead083e528885426bd97a23272603db26a0198c9bb45930689585a8b
MD5 72ca312b0ae5d88dad27a056b069d59f
BLAKE2b-256 d4735fc364a4edc11a1ac5ecfbc70f020cf4a708f28d76b3db996b9493465047

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