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

Uploaded Python 3

File details

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

File metadata

  • Download URL: jinja2_git_dir-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 ab891c61b1692975b2665f6ae0fcc42ad4d14e79a66527eb2ed6b207c9a98091
MD5 fa78ad4a004410c18d25f9807e07bf70
BLAKE2b-256 1c663d35dff741fe35e6299560263d05f2dd3b666fd90bdd21154469ac73495a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jinja2_git_dir-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f1428c992deb1dcd14cfaa7ef82d97cb9ae8cc2d3af9616fa49cb3dd1961b90
MD5 b86c131008e7b7636c7a93ff631f8f30
BLAKE2b-256 67ee22969aa09c5d14c6a4816fd6b1d4226bb50e2147b4b29acb205e03e62943

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