-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcg-admin-ls
executable file
·62 lines (56 loc) · 1.28 KB
/
cg-admin-ls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
#
# List contents of a particular tree in the repository
# Copyright (c) Petr Baudis, 2005
#
# Optionally takes a commit or tree ID as a parameter, defaulting to
# 'HEAD'.
#
# OPTIONS
# -------
# -r TREE_ID:: List contents of the given tree (you can use revisions here)
# List the contents of the given TREE_ID (which can be any tree
# id, but most usually you will just use a revision id here).
#
# OUTPUT FORMAT
# -------------
# Each line in the output has the following format:
#
# <mode> <type> <sha1> <name>
#
# where
#
# <mode>::
# The file permission information in octal format.
#
# <type>::
# The type can be the following: `blob` refers to files
# and `tree` refers to directories.
#
# <sha1>::
# The object ID.
#
# <name>::
# The file or directory name.
#
# Example line:
#
# 100644 blob c7dacd0ea28994e3c754ca4eadb2e08c011ee3d3 README
# Testsuite: TODO
USAGE="cg-admin-ls [-r TREE_ID] [PATH]"
_git_wc_unneeded=1
. "${COGITO_LIB}"cg-Xlib || exit 1
tree_id=
while optparse; do
if optparse -t=; then
# Deprecated as of 2006-11-17
warn "cg-admin-ls -t is deprecated, please use -r instead"
tree_id="$OPTARG"
elif optparse -r=; then
tree_id="$OPTARG"
else
optfail
fi
done
id="$(cg-object-id -t "$tree_id")" || exit 1
git-ls-tree "$id" "${ARGS[@]}"