mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 20:34:19 +00:00
Source links can record machine-local paths in Git. Share advisory indexed and ignored checks across CLI, init, and dashboard staging and previews, with scope-correct ignore patterns and manual untracking instructions, without changing staging behavior.
40 lines
1011 B
Go
40 lines
1011 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
"skillshare/internal/config"
|
|
)
|
|
|
|
func TestCommitDryRunWarnsSourceLink(t *testing.T) {
|
|
root := t.TempDir()
|
|
t.Setenv("XDG_CONFIG_HOME", root)
|
|
t.Setenv("SKILLSHARE_CONFIG", filepath.Join(root, "skillshare", "config.yaml"))
|
|
source := filepath.Join(root, "skills")
|
|
if err := os.MkdirAll(source, 0755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
runGit(t, source, "init", "-q")
|
|
if err := os.Symlink(t.TempDir(), filepath.Join(source, "_dev-skills")); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
cfg := &config.Config{Source: source}
|
|
if err := cfg.Save(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
output := captureStdout(t, func() {
|
|
if err := cmdCommit([]string{"--dry-run"}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
})
|
|
if !strings.Contains(output, "/_dev-skills") || !strings.Contains(output, "commit will stage source link") {
|
|
t.Fatalf("missing warning: %s", output)
|
|
}
|
|
if got := runGit(t, source, "ls-files"); got != "" {
|
|
t.Fatalf("dry run staged files: %s", got)
|
|
}
|
|
}
|