Skip to content

Heisenbug with stack build resetting git history #2748

Closed

Description

@parsonsmatt

General summary/comments (optional)

Occasionally, a stack build command will reset my git history to some point in the past.

Steps to reproduce

All of the examples I have are proprietary. I have a repro that I can share privately.

Stack version

λ ~/ stack --version
Version 1.2.1, Git revision 2caa0524b7a37c57c465b4c6414c1089eb81f137 x86_64 hpack-0.14.1

Method of installation

I did a stack upgrade --git sometime ago

Activity

  1. added this to the P1: Must milestone on Nov 3, 2016
  2. mgsloan commented on Nov 3, 2016

    @mgsloan
    Contributor

    Thanks for the report! I bet what is happening is that there is an empty directory and it tries to do a git reset on that dir, and it finds your repo instead! Argh!

    I think the solution is to use --git-dir or the GIT_DIR environment variable to fix this in all of our usages of git. Relying on the working directory of the git command is too fragile.

  3. mgsloan commented on Nov 8, 2016

    @mgsloan
    Contributor

    I've made a change which causes stack to invoke git in such a way that this shouldn't be possible. If you do another stack upgrade --git, it'll pull in the change.

    This doesn't address the root problem - that somehow the directory doesn't have a repository - but should prevent it from affecting your repo.

  4. parsonsmatt commented on Nov 8, 2016

    @parsonsmatt
    ContributorAuthor

    Thanks! I'll run it through my reproduction tomorrow and report back.

  5. parsonsmatt commented on Nov 8, 2016

    @parsonsmatt
    ContributorAuthor

    I haven't been able to get it to happen again, so I'm happy saying this is solved. Thanks for the quick fix! 😄

  6. mgsloan commented on Nov 8, 2016

    @mgsloan
    Contributor

    Welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions