Better cat-file tree format
This commit is contained in:
parent
3d08e348db
commit
cc32d87d4d
@ -286,7 +286,11 @@ def cmd_cat_file(args):
|
|||||||
|
|
||||||
def cat_file(repo, obj, fmt=None):
|
def cat_file(repo, obj, fmt=None):
|
||||||
obj = object_read(repo, object_find(repo, obj, fmt=fmt))
|
obj = object_read(repo, object_find(repo, obj, fmt=fmt))
|
||||||
sys.stdout.buffer.write(obj.serialize())
|
if fmt == b'tree':
|
||||||
|
for item in obj.items:
|
||||||
|
print(f"{item.mode.decode('ascii')} {item.path} {item.sha}")
|
||||||
|
else:
|
||||||
|
sys.stdout.buffer.write(obj.serialize())
|
||||||
|
|
||||||
def object_find(repo, name, fmt=None, follow=True):
|
def object_find(repo, name, fmt=None, follow=True):
|
||||||
sha = object_resolve(repo, name)
|
sha = object_resolve(repo, name)
|
||||||
|
1
test
1
test
@ -1 +0,0 @@
|
|||||||
Subproject commit d53851a324df2b0b1090b51b5f8a7c19dacb3fcc
|
|
Loading…
Reference in New Issue
Block a user