{"thread":{"id":"5637","subject":"[PATCH] git for each ref improve the documentation on scripting modes","startedAt":"2006-09-21T09:19:17Z","lastAt":"2006-09-21T09:19:17Z","messageCount":1,"participants":["Andy Whitcroft"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"27355","messageId":"20060921091917.GA6373@shadowen.org","threadId":"5637","inReplyTo":null,"subject":"[PATCH] git for each ref improve the documentation on scripting modes","fromName":"Andy Whitcroft","fromEmail":"apw@shadowen.org","sentAt":"2006-09-21T09:19:17Z","receivedAt":"2006-09-21T09:19:17Z","isPatch":true,"sender":{"key":"apw@shadowen.org","avatar":"https://gravatar.com/avatar/d3088262854661a913ef35cc40fedcc270142d4461791142bc1ea0b2a4e2e147?d=mp&s=160"},"body":"git-for-each-ref: improve the documentation on scripting modes\n\nWhen reading the synopsis for git-for-each-ref it is easy to miss\nthe obvious power of --shell and family.  Call this feature out in\nthe primary paragragh.  Also add more description to the examples\nto indicate which features we are demonstrating.  Finally add a\nvery simple eval based example in addition to the very complex one\nto give a gentler introduction.\n\nSigned-off-by: Andy Whitcroft <apw@shadowen.org>\n---\ndiff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt\nindex 6649f79..d5fdcef 100644\n--- a/Documentation/git-for-each-ref.txt\n+++ b/Documentation/git-for-each-ref.txt\n@@ -17,7 +17,7 @@ according to the given `<format>`, after\n to the given set of `<key>`s.  If `<max>` is given, stop after\n showing that many refs.  The interporated values in `<format>`\n can optionally be quoted as string literals in the specified\n-host language.\n+host language allowing their direct evaluation in that language.\n \n OPTIONS\n -------\n@@ -97,7 +97,8 @@ returns an empty string instead.\n EXAMPLES\n --------\n \n-Show the most recent 3 tagged commits::\n+An example directly producing formatted text.  Show the most recent\n+3 tagged commits::\n \n ------------\n #!/bin/sh\n@@ -112,7 +113,23 @@ Ref: %(*refname)\n ' 'refs/tags'\n ------------\n \n-A bit more elaborate report on tags::\n+\n+A simple example showing the use of shell eval on the output,\n+demonstrating the use of --shell.  List the prefixes of all heads::\n+------------\n+#!/bin/sh\n+\n+git-for-each-ref --shell --format=\"ref=%(refname)\" refs/heads | \\\n+while read entry\n+do\n+\teval \"$entry\"\n+\techo `dirname $ref`\n+done\n+------------\n+\n+\n+A bit more elaborate report on tags, demonstrating that the format\n+may be an entire script::\n ------------\n #!/bin/sh\n \n@@ -156,7 +173,7 @@ Its message reads as:\n \tfi\n '\n \n-eval=`git-for-each-ref -s --format=\"$fmt\" \\\n+eval=`git-for-each-ref --shell --format=\"$fmt\" \\\n \t--sort='*objecttype' \\\n \t--sort=-taggerdate \\\n \trefs/tags`\n"}]}