git "manifest" command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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"

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux