Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add commit file to .gitignore when migrating to the new project format. #2821

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/projectfile/projectfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,16 @@ func (p *Project) Init() error {
if p.parsedURL.LegacyCommitID != "" {
// Migrate from commitID in activestate.yaml to .activestate/commit file.
// Writing to disk during Parse() feels wrong though.
if err := localcommit.Set(filepath.Dir(p.Path()), p.parsedURL.LegacyCommitID); err != nil {
projectDir := filepath.Dir(p.Path())
if err := localcommit.Set(projectDir, p.parsedURL.LegacyCommitID); err != nil {
return errs.Wrap(err, "Could not create local commit file")
}
if fileutils.DirExists(filepath.Join(projectDir, ".git")) {
err := localcommit.AddToGitIgnore(projectDir)
if err != nil {
multilog.Error("Unable to add local commit file to .gitignore: %v", err)
Copy link
Contributor Author

@mitchell-as mitchell-as Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, project parsing has no outputer for notices, so we cannot notify the user to manually add this file like we do with checkout and init. I've updated the ACs of DX-2263 to support this since that'll be a larger refactor involving prompts at the very least. Outputers should be easier to add there.

}
}
pf := NewProjectField()
if err := pf.LoadProject(p.Project); err != nil {
return errs.Wrap(err, "Could not load activestate.yaml")
Expand Down