adds git-tar for creating tar files of projects
authorThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Tue, 14 Oct 2025 10:44:51 +0000 (10:44 +0000)
committerThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Tue, 14 Oct 2025 10:44:51 +0000 (10:44 +0000)
developer/bash/Z
developer/bash/git-tar [new file with mode: 0644]

index 2997266..5208514 100755 (executable)
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-/usr/bin/date -u +"%Y-%m-%d_%H:%M:%SZ"
+/usr/bin/date -u +"%Y-%m-%d_%H:%M:%S_Z"
diff --git a/developer/bash/git-tar b/developer/bash/git-tar
new file mode 100644 (file)
index 0000000..d655f03
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+# puts a tar file of the repo in the top level scratchdir
+
+set -euo pipefail
+
+# ensure we're in a git repo
+git rev-parse --is-inside-work-tree >/dev/null 2>&1 || {
+  echo "Error: not inside a git repository." >&2
+  exit 1
+}
+
+repo_top="$(git rev-parse --show-toplevel)"
+repo_name="$(basename "$repo_top")"
+ref_label="$(git describe --tags --always --dirty 2>/dev/null || git rev-parse --short HEAD)"
+out="${repo_top}/scratchpad/${repo_name}-${ref_label}.tar.gz"
+
+# create archive of HEAD (tracked files only; .gitignore’d stuff is omitted)
+git -C "$repo_top" archive --format=tar --prefix="${repo_name}/" HEAD | gzip > "$out"
+
+echo "Wrote ${out}"