This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Break dependencies among git, job, event packages #1027
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
samb1729
reviewed
Mar 28, 2018
daemon/daemon.go
Outdated
@@ -152,30 +152,30 @@ func (d *Daemon) ListImages(ctx context.Context, spec update.ResourceSpec) ([]v6 | |||
// Let's use the CommitEventMetadata as a convenient transport for the | |||
// results of a job; if no commit was made (e.g., if it was a dry | |||
// run), leave the revision field empty. | |||
type DaemonJobFunc func(ctx context.Context, jobID job.ID, working *git.Checkout, logger log.Logger) (*event.CommitEventMetadata, error) | |||
type DaemonJobFunc func(ctx context.Context, jobID job.ID, working *git.Checkout, logger log.Logger) (job.Result, error) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -1,4 +1,4 @@ | |||
package git | |||
package daemon |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
git/operations.go
Outdated
b, err := json.Marshal(note) | ||
if err != nil { | ||
return err | ||
} | ||
return execGitCmd(ctx, workingDir, nil, "notes", "--ref", notesRef, "add", "-m", string(b), rev) | ||
} | ||
|
||
// NB return values (*Note, nil), (nil, error), (nil, nil) | ||
func getNote(ctx context.Context, workingDir, notesRef, rev string) (*Note, error) { | ||
// NB first return value indicates whether there was a note; second was an error |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Thanks Sam. I've adjusted as requested. |
samb1729
approved these changes
Mar 30, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Squash the second commit though please.
These all use each others types, and that makes it difficult to refactor other packages without introducing cycles. To break the dependencies, I needed to: - make git accept any (JSON serialisable) value as a note - stop referring to an event type in the job package, and thereby the API and client
3bc19d0
to
25bbcd4
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These all use each others types, and that makes it difficult to
refactor other packages without introducing cycles. To break the
dependencies, I needed to:
API and client