{"thread":{"id":"3097","subject":"\"git cat\" and \"git ls\"","startedAt":"2006-01-18T15:10:16Z","lastAt":"2006-01-18T17:14:42Z","messageCount":2,"participants":["Santi Béjar","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"14819","messageId":"87irsh6087.fsf@gmail.com","threadId":"3097","inReplyTo":null,"subject":"\"git cat\" and \"git ls\"","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2006-01-18T15:10:16Z","receivedAt":"2006-01-18T15:10:16Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"Hello,\n\n        following the \"git diff\" wrapper I've done two new wrappers:\n\ngit cat: USAGE='<tag|commit|blob> | [<ent>|-1|-2|-3] -- <file>'\n\n    It shows the content of the giventag/commit/blob.\n\n    You can also ask for a file in a tree or in the index (stage\n    optional).\n\ngit ls: USAGE='[<ent>] [--] <path>'\n\n    It lists the files in <path> in the <ent> or in the index.\n\n  Santi\n\n\n\n#!/bin/sh\n#\n\nUSAGE='<tag|commit|blob> | [<ent>|-1|-2|-3] -- <file>'\nSUBDIRECTORY_OK='Yes'\n. git-sh-setup\n\nrev=$(git-rev-parse --revs-only --no-flags --sq \"$@\") || exit\nflags=$(git-rev-parse --no-revs --flags \"$@\")\nfiles=$(git-rev-parse --no-revs --no-flags --sq \"$@\")\n\ncase \"$rev,$files\" in\n?*' '?*,*|*,?*' '?*)\n\tusage\n\t;;\n?*,?*)\n\tsha1=$(eval \"git-ls-tree $rev $files\" | cut -f 1 | cut -d \" \" -f 3)\n\t;;\n?*,)\n\tsha1=$rev\n\t;;\n,?*)\n\t# Only one file\n\t[ $(eval \"git-ls-files $files | wc -l\") != 1 ] && usage\n\tstg=0\n\tflag=${flags#-}\n\tcase $flag in\n\t    1|2|3) stg=$flag;;\n\tesac\n\tsha1=$(eval \"git-ls-files -s $files\" | while read -r mode sha stage name ; do\n\t\t[ $stage -eq $stg ] && echo $sha && break ; done)\n\t;;\n*)\n\tusage\n\t;;\nesac\n\n[ -z $sha1 ] && echo \"$(basename $0): $files: Not found\" && exit 1\ntype=$(eval \"git-cat-file -t $sha1\")\n\ncase $type in\n    tree)\n\tusage\n\t;;\n    tag|blob)\n\tcmd=\"git-cat-file $type $sha1\"\n\t;;\n    commit)\n\tcmd=\"git-rev-list --max-count=1 $sha1 --pretty=fuller\"\n\t;;\nesac\n\neval \"$cmd\"\nexit\n\n\n#!/bin/sh\n#\n\nUSAGE='[<ent>] [--] <path>'\nSUBDIRECTORY_OK='Yes'\n. git-sh-setup\n\ntree=$(git-rev-parse --verify $1^{tree} 2>/dev/null)\n[ -n \"$tree\" ] && shift\nfiles=$(git-rev-parse --no-revs --no-flags --sq \"$@\")\n\ncase \"$tree\" in\n\"\")\n        cmd=\"git-ls-files -s $files\"\n\t;;\n?*)\n\tcmd=\"git-ls-tree $tree $files\"\n\t;;\nesac\n\neval \"$cmd\"\nexit\n"},{"id":"14828","messageId":"7vlkxdxxtp.fsf@assigned-by-dhcp.cox.net","threadId":"3097","inReplyTo":"87irsh6087.fsf@gmail.com","subject":"Re: \"git cat\" and \"git ls\"","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-18T17:14:42Z","receivedAt":"2006-01-18T17:14:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Béjar <sbejar@gmail.com> writes:\n\n>         following the \"git diff\" wrapper I've done two new wrappers:\n>\n> git cat: USAGE='<tag|commit|blob> | [<ent>|-1|-2|-3] -- <file>'\n> git ls: USAGE='[<ent>] [--] <path>'\n\nNot interested; sorry.\n\nThe only thing I find lacking from the current set of tools is a\nway to prettyprint an annotated tag to make its date human\nreadable.\n"}]}