{"action":"created","issue":{"url":"https://api.github.com/repos/direnv/direnv/issues/206","repository_url":"https://api.github.com/repos/direnv/direnv","labels_url":"https://api.github.com/repos/direnv/direnv/issues/206/labels{/name}","comments_url":"https://api.github.com/repos/direnv/direnv/issues/206/comments","events_url":"https://api.github.com/repos/direnv/direnv/issues/206/events","html_url":"https://github.com/direnv/direnv/pull/206","id":142212775,"number":206,"title":"Expanding mtime to file watches","user":{"login":"nyarly","id":127548,"avatar_url":"https://avatars.githubusercontent.com/u/127548?v=3","gravatar_id":"","url":"https://api.github.com/users/nyarly","html_url":"https://github.com/nyarly","followers_url":"https://api.github.com/users/nyarly/followers","following_url":"https://api.github.com/users/nyarly/following{/other_user}","gists_url":"https://api.github.com/users/nyarly/gists{/gist_id}","starred_url":"https://api.github.com/users/nyarly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyarly/subscriptions","organizations_url":"https://api.github.com/users/nyarly/orgs","repos_url":"https://api.github.com/users/nyarly/repos","events_url":"https://api.github.com/users/nyarly/events{/privacy}","received_events_url":"https://api.github.com/users/nyarly/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-20T22:09:47Z","updated_at":"2016-03-21T13:23:31Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/direnv/direnv/pulls/206","html_url":"https://github.com/direnv/direnv/pull/206","diff_url":"https://github.com/direnv/direnv/pull/206.diff","patch_url":"https://github.com/direnv/direnv/pull/206.patch"},"body":"This is fairly big PR, but it was hard to limit the scope - it's kind of a fundamental change but a really nice one. It would be rad if this got merged as is, but I think that's beyond expectation. If there's changes needed, it'd be nice to hear as soon as possible so that it's still fresh in the meat caches.\r\n\r\nI've swapped out the mtime in the RC struct for a FileTimes list that records the path and mtime for mutliple files. The watch structure is serialized to DIRENV_WATCHES the same way DIRENV_DIFF is.\r\n\r\nThe upshot is that direnv can now watch more than just the .envrc and its allow file for changes. This addresses #173, #98 as well as #77.\r\n\r\n## Summary of Changes\r\n\r\nObviously, there's the FileTime[s] structs and associated methods. There were a lot of changes to `direnv export` and `direnv edit` to handle the change is how things were tracked.\r\n\r\n### New Private Commands\r\n`direnv watch <path>` adds the path to the watchlist and prints the new export command for the DIRENV_WATCHES env var. The upshot is that stdlib and direnvrc functions can `eval $(direnv watch filename)` in order to add a file to the list of watches. (export captures the value at the end of loading the .envrc so that changes during its execution can be picked up)\r\n\r\n`direnv current <path>` checks to see if <path> is current or not - it exits 0 if the path is current or 1 if it's unknown, stale, missing or newly added. Almost useless outside of .envrc (or .direnvrc), but could be very useful for writing a caching stdlib function.\r\n\r\n## Mea Culpas\r\nA few changes not strictly in scope:\r\n\r\nThe behavior of the watch stuff was tricky to debug, so I wound up extending direnv's debugging - log.go now has a log_debug function that is a no-op unless `DIRENV_DEBUG=1` is set. It makes use of the log package instead of Fprintf'ing to Stderr, which is nice because it makes it possible to track file and line number.\r\n\r\ncmd_export.go got a heavy refactoring. I had a hard time reasoning about it in one giant method, which is why it got broken up like that.\r\n\r\nMaybe the worst thing: I updated the version to 2.8 - I needed an easy way to make sure I was running the right version when I was taking it for a test run, but I don't think that's exactly kosher. Still, the change of interface requires at least that, I think?"},"comment":{"url":"https://api.github.com/repos/direnv/direnv/issues/comments/199274635","html_url":"https://github.com/direnv/direnv/pull/206#issuecomment-199274635","issue_url":"https://api.github.com/repos/direnv/direnv/issues/206","id":199274635,"user":{"login":"nyarly","id":127548,"avatar_url":"https://avatars.githubusercontent.com/u/127548?v=3","gravatar_id":"","url":"https://api.github.com/users/nyarly","html_url":"https://github.com/nyarly","followers_url":"https://api.github.com/users/nyarly/followers","following_url":"https://api.github.com/users/nyarly/following{/other_user}","gists_url":"https://api.github.com/users/nyarly/gists{/gist_id}","starred_url":"https://api.github.com/users/nyarly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyarly/subscriptions","organizations_url":"https://api.github.com/users/nyarly/orgs","repos_url":"https://api.github.com/users/nyarly/repos","events_url":"https://api.github.com/users/nyarly/events{/privacy}","received_events_url":"https://api.github.com/users/nyarly/received_events","type":"User","site_admin":false},"created_at":"2016-03-21T13:23:31Z","updated_at":"2016-03-21T13:23:31Z","body":"I think that's it. I like the idea of a unified STATE but... One think at a\ntime, eh?\n\nOn Mon, Mar 21, 2016, 03:03 zimbatm <notifications@github.com> wrote:\n\n> Looking good. Anything more ?\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly or view it on GitHub\n> <https://github.com/direnv/direnv/pull/206#issuecomment-199207817>\n>\n"}}