git "manifest" command

4 messages, 3 authors, 2016-06-15 · open the first message on its own page

git "manifest" command

From: Csaba Henk <hidden>
Date: 2016-06-15 22:43:14

Hi,

I was lacking a "manifest" like command, one which operates like
git-ls-files just you can use it with arbitrary tree-ish (or, put it
otherwise, one which opererates like git-ls-tree just acts recursively).
Maybe it's there already and I just didn't find my way through git
glossary?

Anyway, I rolled my own. Chanches are you find it an useful addition.

Csaba

------[git-manifest.sh]---8<---------------------------------------
#!/bin/sh
#
# Copyright (c) 2007 Csaba Henk 

display() {
	if [ $verbose ]
	then
		echo -n $1 $2 $3" "
        fi
        echo "$4"
}

walk() {
	git-ls-tree "$1" | while read -r mode type sha name
	do
		if [ "$type" = tree ]
		then
			display $mode $type $sha "$2$name/"
			walk $sha "$2$name/"
		else
			display $mode $type $sha "$2$name"
		fi
	done
}

help() {
    echo \
"List content of tree-ish recursively. Usage:

`basename "$0"` [-v] <tree-ish>
" >&2
    exit
}

case $# in
    1|2) ;;
    *)
       help 
esac

verbose=
if [ $# -eq 2 ]
then
	if [ "$1" = -v ]
	then
		verbose=1
	else
		help
	fi
	shift
else
	case "$1" in
		-h|--help) help
	esac
fi

walk "$1"

Re: git "manifest" command

From: Martin Waitz <hidden>
Date: 2016-06-15 22:43:14

hoi :)

On Tue, Jun 05, 2007 at 10:03:18AM +0000, Csaba Henk wrote:
I was lacking a "manifest" like command, one which operates like
git-ls-files just you can use it with arbitrary tree-ish (or, put it
otherwise, one which opererates like git-ls-tree just acts recursively).
like git ls-tree -r?

-- 
Martin Waitz

Re: git "manifest" command

From: Csaba Henk <hidden>
Date: 2016-06-15 22:43:14

On 2007-06-05, Martin Waitz [off-list ref] wrote:
like git ls-tree -r?
Yes. I knew this functionality must be there somewehere...

Thanks.

Csaba

Re: git "manifest" command

From: Matthias Lederhofer <hidden>
Date: 2016-06-15 22:43:14

Csaba Henk [off-list ref] wrote:
On 2007-06-05, Martin Waitz [off-list ref] wrote:
quoted
like git ls-tree -r?
Yes. I knew this functionality must be there somewehere...
If you use this from a script note that ls-tree shows the subdirectory
of a tree that corresponds to the current directory in the repository.
This one should always show the full tree:
    $ git ls-tree --full-name -r HEAD $(git rev-parse --show-cdup)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help