You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Absorb progress functionality into git/githistory/log #2743
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:
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?
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:
Move generally-applicable logging things into the git/githistory/log package.
Move the git/githistory/log package to package log (no longer nested in git/githistory).
Remove the progress package, and move its implementations to live where they are used.
Maintain a package private and global instance of *log.Logger inside of package commands, for synchronous logging.
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.
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. gitlogcould 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.
Activity
ttaylorr commentedon Nov 21, 2017
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.I think that this is what is currently happening (
*progress.Meterand*progress.Spinnerare implementations of thelog.Taskinterface), but we could perhaps go a bit further. For instance, I'm not sure that theprogresspackage needs to exist any more, since packagetqcould own a single implementation of that instead. I think that the spinner could live in thegit/githistory/logpackage, 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:
git/githistory/logpackage.git/githistory/logpackage to packagelog(no longer nested ingit/githistory).progresspackage, and move its implementations to live where they are used.*log.Loggerinside of packagecommands, for synchronous logging.commands.Print(),commands.Error(),commands.ExitWithError()(etc) in terms of*log.Loggerprimitives, to provide stronger guarantees that Git LFS will not clobber its own logging.technoweenie commentedon Nov 21, 2017
All for the above, with some minor suggestions:
I think this should have a different, more unique name.
logis already well known in the stdlib.gitlogcould be confused as having to do withgit log.While you're there, rename them with the
fsuffix so thatgo vetstops complaining that they take formatting args :) Kind of like how you addedSpinf()in #2732.In fact, what do you think of adding
go vettoscript/test? I doubt it passes now, but I'd like to start nudging lfs towards a standard go codebase.ttaylorr commentedon Dec 18, 2017
Resolved this in: #2788. 😄