commands: teach 'git lfs ls-files' a '--debug' option
There was no way to conveniently display LFS pointer file properties for
debugging. Teach 'git lfs ls-files' a '--debug' option that prints all
available information following the 'git ls-files' interface [1].
[1] 8497421715
This commit is contained in:
parent
25a87db9a7
commit
1565e631e8
@ -10,6 +10,7 @@ import (
|
||||
|
||||
var (
|
||||
longOIDs = false
|
||||
debug = false
|
||||
)
|
||||
|
||||
func lsFilesCommand(cmd *cobra.Command, args []string) {
|
||||
@ -38,7 +39,24 @@ func lsFilesCommand(cmd *cobra.Command, args []string) {
|
||||
return
|
||||
}
|
||||
|
||||
Print("%s %s %s", p.Oid[0:showOidLen], lsFilesMarker(p), p.Name)
|
||||
if debug {
|
||||
Print(
|
||||
"filepath: %s\n"+
|
||||
" size: %d\n"+
|
||||
"checkout: %v\n"+
|
||||
"download: %v\n"+
|
||||
" oid: %s %s\n"+
|
||||
" version: %s\n",
|
||||
p.Name,
|
||||
p.Size,
|
||||
fileExistsOfSize(p),
|
||||
lfs.ObjectExistsOfSize(p.Oid, p.Size),
|
||||
p.OidType,
|
||||
p.Oid,
|
||||
p.Version)
|
||||
} else {
|
||||
Print("%s %s %s", p.Oid[0:showOidLen], lsFilesMarker(p), p.Name)
|
||||
}
|
||||
})
|
||||
defer gitscanner.Close()
|
||||
|
||||
@ -63,5 +81,6 @@ func lsFilesMarker(p *lfs.WrappedPointer) string {
|
||||
func init() {
|
||||
RegisterCommand("ls-files", lsFilesCommand, func(cmd *cobra.Command) {
|
||||
cmd.Flags().BoolVarP(&longOIDs, "long", "l", false, "")
|
||||
cmd.Flags().BoolVarP(&debug, "debug", "d", false, "")
|
||||
})
|
||||
}
|
||||
|
@ -15,6 +15,10 @@ reference. If no reference is given, scan the currently checked-out branch.
|
||||
* `-l` `--long`:
|
||||
Show the entire 64 character OID, instead of just first 10.
|
||||
|
||||
* -d --debug:
|
||||
Show as much information as possible about a LFS file. This is intended
|
||||
for manual inspection; the exact format may change at any time.
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
git-lfs-status(1).
|
||||
|
@ -24,6 +24,16 @@ begin_test "ls-files"
|
||||
git lfs ls-files | tee ls.log
|
||||
grep some.dat ls.log
|
||||
[ `wc -l < ls.log` = 1 ]
|
||||
|
||||
diff -u <(git lfs ls-files --debug) <(cat <<-EOF
|
||||
filepath: some.dat
|
||||
size: 10
|
||||
checkout: true
|
||||
download: true
|
||||
oid: sha256 5aa03f96c77536579166fba147929626cc3a97960e994057a9d80271a736d10f
|
||||
version: https://git-lfs.github.com/spec/v1
|
||||
|
||||
EOF)
|
||||
)
|
||||
end_test
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user