Skip to content

Commit

Permalink
export diff from the old env, not the current env
Browse files Browse the repository at this point in the history
  • Loading branch information
zimbatm committed Feb 5, 2014
1 parent f44abc1 commit c231ce5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cmd_export.go
Expand Up @@ -88,18 +88,17 @@ var CmdExport = &Cmd{
}
}

diff := env.Diff(newEnv)

if diff.Any() {
oldDiff := oldEnv.Diff(newEnv)
if oldDiff.Any() {
var out []string
for key, _ := range diff.Prev {
_, ok := diff.Next[key]
for key, _ := range oldDiff.Prev {
_, ok := oldDiff.Next[key]
if !ok && !direnvKey(key) {
out = append(out, "-"+key)
}
}
for key := range diff.Next {
_, ok := diff.Prev[key]
for key := range oldDiff.Next {
_, ok := oldDiff.Prev[key]
if direnvKey(key) {
continue
}
Expand All @@ -115,6 +114,7 @@ var CmdExport = &Cmd{
}
}

diff := env.Diff(newEnv)
str := diff.ToShell(shell)
fmt.Print(str)

Expand Down

0 comments on commit c231ce5

Please sign in to comment.