@sassywares/skills 0.5.12 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# snapshot-version:
|
|
2
|
+
# snapshot-version: 2
|
|
3
3
|
#
|
|
4
4
|
# Snapshot workspace glue into a side git mirror, without making this folder a
|
|
5
5
|
# git repository.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
# Usage: .sassywares/workspace/snapshot [-m MSG] [--dry-run] [--no-push] [--version]
|
|
11
11
|
set -euo pipefail
|
|
12
12
|
|
|
13
|
-
SNAPSHOT_VERSION="
|
|
13
|
+
SNAPSHOT_VERSION="2"
|
|
14
14
|
|
|
15
15
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
16
16
|
ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
@@ -106,6 +106,23 @@ resolve_remote() {
|
|
|
106
106
|
die "no mirror remote: set git.remote in $CONFIG, or pass SASSY_WORKSPACE_REMOTE"
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
# `owner/name` is a GitHub shorthand the config accepts; git clone wants a URL.
|
|
110
|
+
norm_remote() {
|
|
111
|
+
local remote="$1"
|
|
112
|
+
case "$remote" in
|
|
113
|
+
*://*|*@*) printf '%s\n' "$remote"; return 0 ;; # URL or scp-style
|
|
114
|
+
/*|./*|../*|~*) printf '%s\n' "$remote"; return 0 ;; # local path
|
|
115
|
+
esac
|
|
116
|
+
local rest slashes
|
|
117
|
+
rest="${remote#*/}"
|
|
118
|
+
slashes="$(printf '%s' "$rest" | tr -cd '/' | wc -c | tr -d ' ')"
|
|
119
|
+
if [[ "$remote" == */* && "$slashes" == "0" ]]; then
|
|
120
|
+
printf 'https://github.com/%s.git\n' "${remote%.git}"
|
|
121
|
+
return 0
|
|
122
|
+
fi
|
|
123
|
+
printf '%s\n' "$remote"
|
|
124
|
+
}
|
|
125
|
+
|
|
109
126
|
resolve_branch() {
|
|
110
127
|
if [[ -n "${SASSY_WORKSPACE_BRANCH:-}" ]]; then
|
|
111
128
|
BRANCH="$SASSY_WORKSPACE_BRANCH"
|
|
@@ -256,6 +273,7 @@ commit_and_push() {
|
|
|
256
273
|
}
|
|
257
274
|
|
|
258
275
|
resolve_remote
|
|
276
|
+
REMOTE="$(norm_remote "$REMOTE")"
|
|
259
277
|
resolve_branch
|
|
260
278
|
ensure_mirror
|
|
261
279
|
sync_into_mirror
|
|
@@ -247,7 +247,10 @@ An ancestry check that fails means the branch was cut from the wrong base —
|
|
|
247
247
|
recreate it. Never leave a PR aimed at the wrong base.
|
|
248
248
|
|
|
249
249
|
**Mirror remote**, in order: `SASSY_WORKSPACE_REMOTE` → the mirror's own
|
|
250
|
-
`origin` → `git.remote` → stop and say setup is incomplete.
|
|
250
|
+
`origin` → `git.remote` → stop and say setup is incomplete. The value may be an
|
|
251
|
+
`owner/name` shorthand, a URL, an scp-style remote, or a local path; the
|
|
252
|
+
shorthand expands to `https://github.com/owner/name.git`, everything else is
|
|
253
|
+
used verbatim.
|
|
251
254
|
|
|
252
255
|
**Mirror branch**: `SASSY_WORKSPACE_BRANCH` → the mirror's own
|
|
253
256
|
`refs/remotes/origin/HEAD` → `git.mirror_branch` → `main`.
|