diff --git a/tests/e2e/repo-home.test.e2e.ts b/tests/e2e/repo-home.test.e2e.ts
index 53f5a03c6b..6f3d6c373b 100644
--- a/tests/e2e/repo-home.test.e2e.ts
+++ b/tests/e2e/repo-home.test.e2e.ts
@@ -27,7 +27,9 @@ test('Branch selector commit icon', async ({page}) => {
   expect(response?.status()).toBe(200);
 
   await expect(page.locator('.branch-dropdown-button svg.octicon-git-branch')).toBeVisible();
+  await expect(page.locator('.branch-dropdown-button')).toHaveText('master');
 
-  await page.goto('/user2/repo1/src/commit/65f1bf27bc');
+  await page.goto('/user2/repo1/src/commit/65f1bf27bc3bf70f64657658635e66094edbcb4d');
   await expect(page.locator('.branch-dropdown-button svg.octicon-git-commit')).toBeVisible();
+  await expect(page.locator('.branch-dropdown-button')).toHaveText('65f1bf27bc');
 });
diff --git a/web_src/js/components/RepoBranchTagSelector.vue b/web_src/js/components/RepoBranchTagSelector.vue
index edbbf6bb9b..81b1244328 100644
--- a/web_src/js/components/RepoBranchTagSelector.vue
+++ b/web_src/js/components/RepoBranchTagSelector.vue
@@ -56,7 +56,7 @@ const sfc = {
       this.refNameText = this.commitIdShort;
     } else if (this.viewType === 'branch') {
       this.isViewBranch = true;
-      this.refNameText = this.viewType;
+      this.refNameText = this.branchName;
     } else {
       this.isViewTag = true;
       this.refNameText = this.tagName;