feat(cli): warn at publish when tracked files match .gitignore
This commit is contained in:
parent
c825942c8d
commit
57a217f54d
@ -235,6 +235,15 @@ func newPluginPublishCmd() *cobra.Command {
|
||||
}
|
||||
}
|
||||
|
||||
out, _ := exec.Command("git", "ls-files", "--cached", "--ignored", "--exclude-standard").Output()
|
||||
if names := strings.TrimSpace(string(out)); names != "" {
|
||||
fmt.Fprintln(os.Stderr, "warning: these tracked files match .gitignore and will still be shipped:")
|
||||
for _, n := range strings.Split(names, "\n") {
|
||||
fmt.Fprintln(os.Stderr, " "+n)
|
||||
}
|
||||
fmt.Fprintln(os.Stderr, " (run `git rm --cached <file>` to drop)")
|
||||
}
|
||||
|
||||
archiveBytes, err := archive.BuildSourceArchive(".")
|
||||
if err != nil {
|
||||
return fmt.Errorf("build archive: %w", err)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user