-
Notifications
You must be signed in to change notification settings - Fork 23
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
fix: Update recorded parent's HEAD after rebase #104
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ import ( | |
"testing" | ||
|
||
"github.com/aviator-co/av/internal/git" | ||
"github.com/aviator-co/av/internal/meta" | ||
"github.com/aviator-co/av/internal/meta/jsonfiledb" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
|
@@ -12,3 +14,11 @@ func RequireCurrentBranchName(t *testing.T, repo *git.Repo, name string) { | |
require.NoError(t, err, "failed to determine current branch name") | ||
require.Equal(t, name, currentBranch, "expected current branch to be %q, got %q", name, currentBranch) | ||
} | ||
|
||
func GetStoredParentBranchState(t *testing.T, repo *git.Repo, name string) meta.BranchState { | ||
// We shouldn't do this as part of an E2E test, but it's hard to ensure otherwise. | ||
db, err := jsonfiledb.OpenRepo(repo) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to close this to close the file handle? (not sure if that's actually a part of the DB interface in hindsight... 🤔) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. jsonfiledb doesn't have a file handle in it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that you say that I remember it lol. I wrote that code all of two weeks ago and remember none of it apparently. |
||
require.NoError(t, err, "failed to open repo db") | ||
br, _ := db.ReadTx().Branch(name) | ||
return br.Parent | ||
} |
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.
Not for this PR, but we should add a command to get this information that way we don't have to do this.
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.
Sure