aboutsummaryrefslogtreecommitdiff
path: root/repo/git/cpt-add
blob: b707555e609a7ac83fcb3752bd047d5f8f623ded (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh -e
# Commit the current directory as a new package

case "$1" in
    '') set -- . ;;
    --help|-h) printf '%s\n' "usage: ${0##*/}"; exit 0; esac

for pkg; do (

    cd "$pkg"
    read -r ver _ < version || {
        printf '%s\n' "could not find version file, are you on a package directory?"
        exit 1
    }

    # Unstage all changes and stage the current directory
    git reset; git add .
    git commit -m "${PWD##*/}: add new package at $ver"

) done