Skip to content

Commit

Permalink
Use git worktrees for foreman-packaging
Browse files Browse the repository at this point in the history
Previously it was assumed to have something like ~/dev/foreman-packaging
but with git worktrees you can create multiple working directories. I
have switched over to:

    $ tree -L 1 ~/dev/foreman-packaging
    /home/ekohl/dev/foreman-packaging
    ├── deb-3.1
    ├── deb-3.2
    ├── deb-3.3
    ├── deb-3.4
    ├── deb-3.5
    ├── deb-3.6
    ├── deb-develop
    ├── master
    ├── rpm-3.1
    ├── rpm-3.2
    ├── rpm-3.3
    ├── rpm-3.5
    ├── rpm-3.6
    └── rpm-develop

This is all backed by a single .git directory, which makes it much
cheaper.
  • Loading branch information
ekohl committed Oct 18, 2023
1 parent d27cef5 commit d4f3069
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion bump_packaging
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ fi
REMOTE_BRANCH="${FLAVOR}/${FOREMAN_VERSION}"
FULL_REMOTE_BRANCH="$PACKAGING_GIT_REMOTE/$REMOTE_BRANCH"

cd "$PACKAGING_DIR"
RELEASE_PACKAGING_DIR="${PACKAGING_DIR}/${FLAVOR}-$VERSION"

if [[ ! -d "$RELEASE_PACKAGING_DIR" ]] ; then
(
cd "${PACKAGING_DIR}/master"
git worktree add "$RELEASE_PACKAGING_DIR" "$PACKAGING_GIT_REMOTE/$REMOTE_BRANCH"
)
fi

cd "$RELEASE_PACKAGING_DIR"

git fetch $PACKAGING_GIT_REMOTE
git checkout -b "${FLAVOR}/release-$PROJECT-$FULLVERSION" "${FULL_REMOTE_BRANCH}"
Expand Down

0 comments on commit d4f3069

Please sign in to comment.