Skip to content

Support running pgxntool from a subdirectory of a git repo #17

@jnasbyupgrade

Description

@jnasbyupgrade

Problem

pgxntool doesn't work when the extension lives in a subdirectory of a git repo (monorepo pattern). Three things break:

  1. setup.sh: [ -d .git ] || git init — attempts git init when run from a subdirectory since .git is in the parent. The README already says "This assumes that you've already initialized your extension in git", so the git init is unnecessary.

  2. update-setup-files.sh: [[ -d ".git" ]] check fails in subdirectories. Should use git rev-parse --is-inside-work-tree which works anywhere in a worktree.

  3. base.mk sync target: Hardcodes -P pgxntool in git subtree pull. This prefix is relative to git root, so in a subdirectory like subdir/, the prefix needs to be subdir/pgxntool. Should compute dynamically using git rev-parse --show-prefix.

Files to modify

  • setup.sh — Remove git init
  • update-setup-files.sh — Fix .git directory check
  • base.mk — Dynamic subtree prefix in sync targets

Dependencies

Depends on #16 (end-to-end test for make pgxntool-sync) being completed first, since the subdirectory work modifies the sync target's -P prefix logic and we want test coverage before changing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions