Skip to content

Commit

Permalink
Fix sync diff calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Schulz authored and dominikschulz committed Nov 1, 2017
1 parent 145ad8e commit 390b9f8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions action/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ func (s *Action) Sync(ctx context.Context, c *cli.Context) error {
fmt.Print(color.GreenString("OK"))

if l, err := sub.List(""); err == nil {
diff := numMP - len(l)
diff := len(l) - numMP
if diff > 0 {
fmt.Print(color.GreenString(" (Added %d entries)", diff))
} else if diff < 0 {
fmt.Print(color.GreenString(" (Removed %d entries)", diff))
fmt.Print(color.GreenString(" (Removed %d entries)", -1*diff))
} else {
fmt.Print(color.GreenString(" (no changes)"))
}
Expand Down Expand Up @@ -107,13 +107,13 @@ func (s *Action) Sync(ctx context.Context, c *cli.Context) error {
out.Green(ctx, "All done")

if l, err := s.Store.Tree(); err == nil {
numEntries = numEntries - len(l.List(0))
numEntries = len(l.List(0)) - numEntries
}
diff := ""
if numEntries > 0 {
diff = fmt.Sprintf(" Added %d entries", numEntries)
} else if numEntries < 0 {
diff = fmt.Sprintf(" Removed %d entries", numEntries)
diff = fmt.Sprintf(" Removed %d entries", -1*numEntries)
}
_ = s.desktopNotify(ctx, "gopass - sync", fmt.Sprintf("Finished. Synced %d remotes.%s", numMPs, diff))

Expand Down

0 comments on commit 390b9f8

Please sign in to comment.