Skip to content

Absorb progress functionality into git/githistory/log #2743

Closed

Description

@technoweenie

I like LFS' current output, but think it could be improved. For example:

$ git lfs fetch --all
Scanning for all objects ever referenced...
Fetching objects...
✔ 8 objects found, done
# why does a Git LFS command remind us what it is?
# an "LFS" prefix makes sense for smudge/clean filters though.
Git LFS: (8 of 8 files) 900 KB / 900 KB, done

Compare that to the migrate output:

$ git lfs migrate info --everything
migrate: Sorting commits: ..., done
migrate: Examining commits: 100% (14/14), done
*.gitattributes	420 B	4/4 files(s)	100%
*.gif          	391 B	3/3 files(s)	100%
*.bin          	378 B	3/4 files(s)	 75%
*.png          	260 B	2/2 files(s)	100%
*.JPG          	130 B	1/1 files(s)	100%

Each task is a single line, with a running counter until that task is done. It just looks more consistent with typical Git output:

$ git pull
remote: Counting objects: 63, done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 63 (delta 50), reused 40 (delta 34), pack-reused 0
Unpacking objects: 100% (63/63), done.

I like how #2732 merges the two packages a bit, but I think more can be done here too. Why do we need a progress package at this point? Can we update the callers to use a log.Task implementation instead?

Activity

  1. ttaylorr commented on Nov 21, 2017

    @ttaylorr
    Contributor

    Each task is a single line, with a running counter until that task is done. It just looks more consistent with typical Git output:

    Totally agree -- I think that making LFS output self-consistent is our most important goal, but if we can do so while also making that output consistent with Git, all the better. This was an explicit goal of mine when designing the output of git lfs migrate.

    Why do we need a progress package at this point? Can we update the callers to use a log.Task implementation instead?

    I think that this is what is currently happening (*progress.Meter and *progress.Spinner are implementations of the log.Task interface), but we could perhaps go a bit further. For instance, I'm not sure that the progress package needs to exist any more, since package tq could own a single implementation of that instead. I think that the spinner could live in the git/githistory/log package, since it is more generally applicable than the implementation of *progress.Meter.

    In fewer words, here are some things that I'd like to do:

    1. Move generally-applicable logging things into the git/githistory/log package.
    2. Move the git/githistory/log package to package log (no longer nested in git/githistory).
    3. Remove the progress package, and move its implementations to live where they are used.
    4. Maintain a package private and global instance of *log.Logger inside of package commands, for synchronous logging.
    5. Perhaps (?) rewrite the functions commands.Print(), commands.Error(), commands.ExitWithError() (etc) in terms of *log.Logger primitives, to provide stronger guarantees that Git LFS will not clobber its own logging.
  2. technoweenie commented on Nov 21, 2017

    @technoweenie
    ContributorAuthor

    All for the above, with some minor suggestions:

    Move the git/githistory/log package to package log (no longer nested in git/githistory).

    I think this should have a different, more unique name. log is already well known in the stdlib. gitlog could be confused as having to do with git log.

    Perhaps (?) rewrite the functions commands.Print(), commands.Error(), commands.ExitWithError() (etc) in terms of *log.Logger primitives, to provide stronger guarantees that Git LFS will not clobber its own logging.

    While you're there, rename them with the f suffix so that go vet stops complaining that they take formatting args :) Kind of like how you added Spinf() in #2732.

    In fact, what do you think of adding go vet to script/test? I doubt it passes now, but I'd like to start nudging lfs towards a standard go codebase.

  3. ttaylorr commented on Dec 18, 2017

    @ttaylorr
    Contributor

    In fact, what do you think of adding go vet to script/test? I doubt it passes now, but I'd like to start nudging lfs towards a standard go codebase.

    Resolved this in: #2788. 😄

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions