Skip to content

Tagging targets (tag/rmtag/forcetag/dist) hardcode the origin remote #53

Description

@jnasbyupgrade

The tagging targets in base.mk hardcode the origin remote instead of using a configurable variable. This is a problem for any maintainer whose clone has origin pointing at a personal fork with the canonical repo configured under a different remote name (e.g. upstream). In that setup, make tag / make rmtag / make forcetag create and delete the release tag on the fork rather than the canonical repo, so a release re-tag silently lands on the wrong remote and has to be redone by hand against the correct remote.

This surfaced concretely while re-pointing the cat_tools 0.2.3 release tag: the maintainer's origin was their fork, with the canonical Postgres-Extensions/cat_tools repo configured as a separate remote, and make forcetag moved the tag on the fork instead of upstream.

All three hardcoded occurrences are in base.mk, all in the tagging section:

  • base.mk:442 (rmtag target) — git fetch origin # Update our remotes
  • base.mk:444 (rmtag target) — @test -z "$$(git ls-remote --tags origin $(PGXNVERSION) | grep -v '{}')" || git push --delete origin $(PGXNVERSION)
  • base.mk:459 (tag target) — git push origin $(PGXNVERSION)

forcetag (base.mk:462) is just rmtag tag, so it inherits both issues transitively. dist (base.mk:465) depends on tag and therefore also inherits it. dist-only (base.mk:467) and the pgxntool-sync* targets do not hardcode a remote — pgxntool-sync.sh already takes the repo/ref as explicit arguments (see pgxntool-sync-master, pgxntool-sync-local, etc. in base.mk), so those are unaffected.

Proposed fix

Introduce a variable, e.g.:

PGXN_REMOTE ?= origin

and use $(PGXN_REMOTE) in place of the literal origin at all three call sites above. Default stays origin for backward compatibility, but a maintainer in the fork+upstream situation can run e.g. make forcetag PGXN_REMOTE=upstream to target the correct remote.

Worth double-checking whether any other targets added after this issue is filed also assume origin — the tagging block above is the only place currently found via a full grep of base.mk and the embedded .sh scripts for origin, git push, git fetch, git ls-remote, and git pull.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions