cg-clone --reference: Fix up relative paths properly
[cogito/jonas.git] / cg-admin-ls
blobbdb7306b23d3669d5463cbff36673a2a7bc6d349
1 #!/usr/bin/env bash
3 # List contents of a particular tree in the repository
4 # Copyright (c) Petr Baudis, 2005
6 # Optionally takes a commit or tree ID as a parameter, defaulting to
7 # 'HEAD'.
9 # OPTIONS
10 # -------
11 # -t TREE_ID:: List content of the given TREE_ID
12 # List the content of the given TREE_ID.
14 # OUTPUT FORMAT
15 # -------------
16 # Each line in the output has the following format:
18 # <mode> <type> <sha1> <name>
20 # where
22 # <mode>::
23 # The file permission information in octal format.
25 # <type>::
26 # The type can be the following: `blob` refers to files
27 # and `tree` refers to directories.
29 # <sha1>::
30 # The object ID.
32 # <name>::
33 # The file or directory name.
35 # Example line:
37 # 100644 blob c7dacd0ea28994e3c754ca4eadb2e08c011ee3d3 README
39 # Testsuite: TODO
41 USAGE="cg-admin-ls [-t TREE_ID] [PATH]"
42 _git_wc_unneeded=1
44 . "${COGITO_LIB}"cg-Xlib || exit 1
46 tree_id=
47 while optparse; do
48 if optparse -t=; then
49 tree_id="$OPTARG"
50 else
51 optfail
53 done
55 id="$(cg-object-id -t "$tree_id")" || exit 1
57 git-ls-tree "$id" "${ARGS[@]}"