Page MenuHomePhabricator

Dirty cache of HEAD commit after an amend/range reload
ClosedPublic

Authored by epriestley on Jun 12 2014, 10:37 PM.
Tags
None
Referenced Files
F13193908: D9506.id.diff
Sun, May 12, 7:11 PM
F13193867: D9506.diff
Sun, May 12, 6:40 PM
F13190037: D9506.id.diff
Sat, May 11, 7:15 AM
F13186648: D9506.diff
Sat, May 11, 3:47 AM
Unknown Object (File)
Tue, May 7, 5:40 AM
Unknown Object (File)
Mon, May 6, 2:24 AM
Unknown Object (File)
Sun, May 5, 5:26 AM
Unknown Object (File)
Fri, May 3, 4:00 AM

Details

Summary

Introducing --head caused us to run git diff base..head explicitly.

However, we can now hit this workflow:

  • We resolve HEAD as commit aaaa1.
  • This is cached.
  • We notice dirty working copy changes and prompt the user to amend them to HEAD.
  • The user accepts the amend.
  • We amend, creating commit bbbb2.
  • We dirty the commit range and reload the working copy. This does not dirty the cache of HEAD.
  • We run git diff, but it uses the old cached HEAD: git diff base..aaaa1.
  • This works fine (aaaa1 still exists, it's just not on any branch) but produces the wrong diff (without amended changes).

To resolve this, implement the "dirty the cache when the range reloads" hook.

Also never try to amend if the user provides --head.

Test Plan

Ran arc diff --only --trace in a working copy with a new commit and some uncommitted changes.

  • Prior to this change, saw a git diff base..aaaa1 command and the wrong diff.
  • After this change, saw a git diff base..bbbb2 command and the correct diff.

Diff Detail

Repository
rARC Arcanist
Branch
headcache
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1041
Build 1041: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

epriestley retitled this revision from to Dirty cache of HEAD commit after an amend/range reload.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added reviewers: talshiri, chad, csilvers.
talshiri edited edge metadata.

Oh damn!

This revision is now accepted and ready to land.Jun 12 2014, 10:43 PM
epriestley updated this revision to Diff 22779.

Closed by commit rARCdfe2bde88d4f (authored by @epriestley).