Page MenuHomePhabricator

In Drydock, don't reset current branch to point at unrelated commit
ClosedPublic

Authored by epriestley on Dec 22 2015, 2:19 PM.
Tags
None
Referenced Files
F14057139: D14850.diff
Sun, Nov 17, 12:51 AM
F13989664: D14850.diff
Mon, Oct 21, 10:13 PM
F13983560: D14850.id35899.diff
Oct 20 2024, 7:17 AM
F13963876: D14850.id35898.diff
Oct 15 2024, 6:26 PM
Unknown Object (File)
Oct 13 2024, 7:41 AM
Unknown Object (File)
Sep 28 2024, 9:49 PM
Unknown Object (File)
Sep 20 2024, 3:18 PM
Unknown Object (File)
Sep 12 2024, 9:27 PM
Subscribers

Details

Summary

Fixes T10037. When we're building commit aabbccdd, we currently do this to check it out:

git reset --hard aabbccdd

However, this has an undesirable side effect of moving the current branch pointer to point at aabbccdd. The current branch pointer may be some totally different branch which aabbccdd is not part of, so this is confusing and misleading.

Instead, use git reset --hard HEAD to get the primary effect we want (destroying staged changes) and then git checkout aabbccdd to checkout the commit in a detached HEAD state.

Test Plan
  • Ran a build (a commit-focused operation) successfully.
  • Verified working copy was pointed at a detached HEAD afterward:
builder@sbuild001:/var/drydock/workingcopy-167/repo/git-test-ii$ git status
HEAD detached at ffc7635
nothing to commit, working directory clean
  • Ran a land (a branch-foused operation) successfully.
  • Verified working copy was pointed at a branch afterward:
builder@sbuild001:/core/data/drydock/workingcopy-168/repo/git-test$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working directory clean

Diff Detail

Repository
rP Phabricator
Branch
reset1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 9717
Build 11659: Run Core Tests
Build 11658: arc lint + arc unit

Event Timeline

epriestley retitled this revision from to In Drydock, don't reset current branch to point at unrelated commit.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.
This revision is now accepted and ready to land.Dec 22 2015, 2:36 PM
This revision was automatically updated to reflect the committed changes.