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

Uploaded Python 3

File details

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

File metadata

  • Download URL: jinja2_git_dir-0.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 ac121ca5fcb9ac775ab9c9083369fba2f5e8d98e685eafc7a3354e1af491b470
MD5 39a01669d02d5fb301ac6bbd76cd4186
BLAKE2b-256 97117d7e5f377a5d01dbba87f98ca041ecec4e9bc39ff9c29d3111aaa9113599

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jinja2_git_dir-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5c309f1979c14f4cb942baec14b41c1da0361513c8101fb66845664b18eb37d
MD5 62b4b44077f20b0d7aaa8bb809050b06
BLAKE2b-256 40557721ce2800d906e1afd5af9062dafaa5e4c1db36628e396e88928a969a50

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