cu checkout#108
Conversation
| // set up remote tracking branch if it's not already there | ||
| _, err := runGitCommand(ctx, r.userRepoPath, "show-ref", "--verify", "--quiet", fmt.Sprintf("refs/heads/%s", branch)) | ||
| if err != nil { | ||
| _, err = runGitCommand(ctx, r.userRepoPath, "branch", "--track", branch, fmt.Sprintf("%s/%s", containerUseRemote, id)) | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
| } | ||
|
|
||
| _, err = runGitCommand(ctx, r.userRepoPath, "checkout", branch) |
There was a problem hiding this comment.
i think this impl might be overcomplicating things. do we get correct behavior with just plain git checkout $branch? maybe with a fetch thrown in? iirc the show-ref and branch --track wackiness was only necessary because I wanted the branch setup entirely in the background, and i only wanted to touch it if the user hadn't already done stuff with it. in this context, the user is doing things themselves, so we can be way less sneaky if we'd like to.
also, we should make sure this command always tries to get the latest possible remote state, maybe erroring if the user has conflicts/untracked work?
| return nil | ||
| } | ||
|
|
||
| func (r *Repository) Checkout(ctx context.Context, id string) (string, error) { |
There was a problem hiding this comment.
this makes me wanna have a separate UserRepository type...
in my head the ideal Repository is centered around the remote, whereas this method is way more centered around the UserRepository.
|
i'm taking this |
Signed-off-by: Andrea Luzzardi <andrea@luzzardi.com>
Signed-off-by: Connor Braa <connor@dagger.io>
Signed-off-by: Connor Braa <connor@dagger.io>
|
fixed up prompt engineering and added logic to |
|
LGTM |
cu checkoutcommand that does thatgh pr checkoutThis still requires reworking the prompt engineering behind the scenes
DEPENDS ON #107