diff options
author | Junio C Hamano <junkio@cox.net> | 2006-09-27 22:00:54 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-09-27 22:00:54 -0700 |
commit | 194db7e3bbab9669c511133549e6ae74481c9a4f (patch) | |
tree | 93cec2ad9ca798086647a30296e123f2f6b889d5 /Documentation | |
parent | 94d8213f2c98c4a5fd50484fcb11b4b24b403294 (diff) | |
parent | 1729fa9878ed8c99ae0bb2aecced557618d0c894 (diff) | |
download | git-194db7e3bbab9669c511133549e6ae74481c9a4f.tar.gz git-194db7e3bbab9669c511133549e6ae74481c9a4f.tar.xz |
Merge branch 'jc/for-each-ref' into jc/ref-locking
* jc/for-each-ref:
git-for-each-ref: improve the documentation on scripting modes
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/git-for-each-ref.txt | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt index 6649f795e..d5fdcef8d 100644 --- a/Documentation/git-for-each-ref.txt +++ b/Documentation/git-for-each-ref.txt @@ -17,7 +17,7 @@ according to the given `<format>`, after sorting them according to the given set of `<key>`s. If `<max>` is given, stop after showing that many refs. The interporated values in `<format>` can optionally be quoted as string literals in the specified -host language. +host language allowing their direct evaluation in that language. OPTIONS ------- @@ -97,7 +97,8 @@ returns an empty string instead. EXAMPLES -------- -Show the most recent 3 tagged commits:: +An example directly producing formatted text. Show the most recent +3 tagged commits:: ------------ #!/bin/sh @@ -112,7 +113,23 @@ Ref: %(*refname) ' 'refs/tags' ------------ -A bit more elaborate report on tags:: + +A simple example showing the use of shell eval on the output, +demonstrating the use of --shell. List the prefixes of all heads:: +------------ +#!/bin/sh + +git-for-each-ref --shell --format="ref=%(refname)" refs/heads | \ +while read entry +do + eval "$entry" + echo `dirname $ref` +done +------------ + + +A bit more elaborate report on tags, demonstrating that the format +may be an entire script:: ------------ #!/bin/sh @@ -156,7 +173,7 @@ Its message reads as: fi ' -eval=`git-for-each-ref -s --format="$fmt" \ +eval=`git-for-each-ref --shell --format="$fmt" \ --sort='*objecttype' \ --sort=-taggerdate \ refs/tags` |