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
F13190929: D14850.id.diff
Sat, May 11, 3:36 PM
F13185030: D14850.diff
Sat, May 11, 2:31 AM
F13176229: D14850.diff
Wed, May 8, 11:52 AM
Unknown Object (File)
Tue, May 7, 4:51 AM
Unknown Object (File)
Sat, May 4, 4:33 AM
Unknown Object (File)
Fri, May 3, 2:12 AM
Unknown Object (File)
Fri, May 3, 1:36 AM
Unknown Object (File)
Mon, Apr 29, 1:35 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.