{"thread":{"id":"38444","subject":"[GUILT 0/2] Teach \"guilt graph\" to ignore some files.","startedAt":"2015-01-23T14:21:05Z","lastAt":"2015-01-23T14:49:13Z","messageCount":5,"participants":["Per Cederqvist","Jeff Sipek"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"255191","messageId":"1422022867-7908-1-git-send-email-cederp@opera.com","threadId":"38444","inReplyTo":null,"subject":"[GUILT 0/2] Teach \"guilt graph\" to ignore some files.","fromName":"Per Cederqvist","fromEmail":"cederp@opera.com","sentAt":"2015-01-23T14:21:05Z","receivedAt":"2015-01-23T14:21:05Z","isPatch":false,"sender":{"key":"cederp@opera.com","avatar":"https://gravatar.com/avatar/008fe28caedea0ba34042cd5157705267934f4ba7a9b29fb248ae18ec5b3055e?d=mp&s=160"},"body":"If you use a ChangeLog, all output from \"guilt graph\" will be a boring\nline of commits.  By using \"guilt graph -x ChangeLog\" things will look\nmore interesting.\n\nAlso: simplify getfiles.\n\n(This work is also available on the guilt-graph-ignore-2015-v1 branch\nof the git://repo.or.cz/guilt/ceder.git repository.  (That branch is\nbased on the doc-dash-2015-v1 branch that contains my documentation\nfixes, so if you just want these two commits you will have to\ncherry-pick.))\n\n    /ceder\n\nPer Cederqvist (2):\n  guilt graph: Simplify getfiles.\n  Teach \"guilt graph\" the \"-x exclude-pattern\" option.\n\n Documentation/guilt-graph.txt |  5 +++++\n guilt-graph                   | 26 +++++++++++++++++++-------\n regression/t-033.out          | 12 ++++++++++++\n regression/t-033.sh           |  3 +++\n 4 files changed, 39 insertions(+), 7 deletions(-)\n\n-- \n2.1.0\n"},{"id":"255192","messageId":"1422022867-7908-2-git-send-email-cederp@opera.com","threadId":"38444","inReplyTo":"1422022867-7908-1-git-send-email-cederp@opera.com","subject":"[GUILT 1/2] guilt graph: Simplify getfiles.","fromName":"Per Cederqvist","fromEmail":"cederp@opera.com","sentAt":"2015-01-23T14:21:06Z","receivedAt":"2015-01-23T14:21:06Z","isPatch":false,"sender":{"key":"cederp@opera.com","avatar":"https://gravatar.com/avatar/008fe28caedea0ba34042cd5157705267934f4ba7a9b29fb248ae18ec5b3055e?d=mp&s=160"},"body":"git diff-tree by default emits TAB-separated fields.  cut by defaults\nprocesses TAB-separated fields.  Simplify getfiles() by using TAB as\nthe separator.\n\nSigned-off-by: Per Cederqvist <cederp@opera.com>\n---\n guilt-graph | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/guilt-graph b/guilt-graph\nindex 0857e0d..d90c2f1 100755\n--- a/guilt-graph\n+++ b/guilt-graph\n@@ -36,7 +36,7 @@ fi\n \n getfiles()\n {\n-\tgit diff-tree -r \"$1^\" \"$1\" | tr '\\t' ' ' | cut -d' ' -f6\n+\tgit diff-tree -r \"$1^\" \"$1\" | cut -f2\n }\n \n cache=\"$GUILT_DIR/$branch/.graphcache.$$\"\n-- \n2.1.0\n"},{"id":"255193","messageId":"1422022867-7908-3-git-send-email-cederp@opera.com","threadId":"38444","inReplyTo":"1422022867-7908-1-git-send-email-cederp@opera.com","subject":"[GUILT 2/2] Teach \"guilt graph\" the \"-x exclude-pattern\" option.","fromName":"Per Cederqvist","fromEmail":"cederp@opera.com","sentAt":"2015-01-23T14:21:07Z","receivedAt":"2015-01-23T14:21:07Z","isPatch":false,"sender":{"key":"cederp@opera.com","avatar":"https://gravatar.com/avatar/008fe28caedea0ba34042cd5157705267934f4ba7a9b29fb248ae18ec5b3055e?d=mp&s=160"},"body":"Some projects keep a ChangeLog which every commit modifies.  This\nmakes the graph a very uninteresting single line of commits.  It is\nsometimes useful to see how the graph would look if we ignore the\nChangeLog file.\n\nThe new -x option is useful in situations like this.  It can be\nrepeated several times to ignore many files.  Each argument is saved\nto a temporary file and \"grep -v -f $TEMPORARY\" is used to filter out\nthe file names you want to ignore.\n\nAlso added a minimal test case and documentation.\n\nSigned-off-by: Per Cederqvist <cederp@opera.com>\n---\n Documentation/guilt-graph.txt |  5 +++++\n guilt-graph                   | 24 ++++++++++++++++++------\n regression/t-033.out          | 12 ++++++++++++\n regression/t-033.sh           |  3 +++\n 4 files changed, 38 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/guilt-graph.txt b/Documentation/guilt-graph.txt\nindex f43206e..eeed321 100644\n--- a/Documentation/guilt-graph.txt\n+++ b/Documentation/guilt-graph.txt\n@@ -16,6 +16,11 @@ patches.\n \n OPTIONS\n -------\n+-x <pattern>::\n+\tIgnore files that matches the given grep pattern. Can be\n+\trepeated to ignore several files. This can be useful to ignore\n+\tfor instance ChangeLog files that every commit modifies.\n+\n <patchname>::\n \tInstead of starting with the topmost applied patch, start with\n \t<patchname>.\ndiff --git a/guilt-graph b/guilt-graph\nindex d90c2f1..4d5fe46 100755\n--- a/guilt-graph\n+++ b/guilt-graph\n@@ -3,7 +3,7 @@\n # Copyright (c) Josef \"Jeff\" Sipek, 2007-2013\n #\n \n-USAGE=\"[<patchname>]\"\n+USAGE=\"[-x exclude-pattern]... [<patchname>]\"\n if [ -z \"$GUILT_VERSION\" ]; then\n \techo \"Invoking `basename \"$0\"` directly is no longer supported.\" >&2\n \texit 1\n@@ -11,6 +11,22 @@ fi\n \n _main() {\n \n+cache=\"$GUILT_DIR/$branch/.graphcache.$$\"\n+xclude=\"$GUILT_DIR/$branch/.graphexclude.$$\"\n+trap \"rm -rf \\\"$cache\\\" \\\"$xclude\\\"\" 0\n+mkdir \"$cache\"\n+>\"$xclude\"\n+\n+while [ $# -gt 0 ]; do\n+    if [ \"$1\" = \"-x\" ] && [ $# -ge 2 ]; then\n+\techo \"$2\" >> \"$xclude\"\n+\tshift\n+\tshift\n+    else\n+\tbreak\n+    fi\n+done\n+\n if [ $# -gt 1 ]; then\n \tusage\n fi\n@@ -39,10 +55,6 @@ getfiles()\n \tgit diff-tree -r \"$1^\" \"$1\" | cut -f2\n }\n \n-cache=\"$GUILT_DIR/$branch/.graphcache.$$\"\n-mkdir \"$cache\"\n-trap \"rm -rf \\\"$cache\\\"\" 0\n-\n disp \"digraph G {\"\n \n current=\"$top\"\n@@ -66,7 +78,7 @@ while [ \"$current\" != \"$base\" ]; do\n \trm -f \"$cache/dep\"\n \ttouch \"$cache/dep\"\n \n-\tgetfiles $current | while read f; do\n+\tgetfiles $current | grep -v -f \"$xclude\" | while read f; do\n \t\t# hash the filename\n \t\tfh=`echo \"$f\" | sha1 | cut -d' ' -f1`\n \t\tif [ -e \"$cache/$fh\" ]; then\ndiff --git a/regression/t-033.out b/regression/t-033.out\nindex c120d4f..1ed371f 100644\n--- a/regression/t-033.out\n+++ b/regression/t-033.out\n@@ -88,3 +88,15 @@ digraph G {\n \t\"ff2775f8d1dc753f635830adcc3a067e0b681e2d\" [label=\"a.patch\"]\n \t\"891bc14b5603474c9743fd04f3da888644413dc5\" -> \"ff2775f8d1dc753f635830adcc3a067e0b681e2d\"; // ?\n }\n+%% The same graph, but excluding deps introduced by file.txt.\n+% guilt graph -x file.txt\n+digraph G {\n+# checking rev bc7df666a646739eaf559af23cab72f2bfd01f0e\n+\t\"bc7df666a646739eaf559af23cab72f2bfd01f0e\" [label=\"a-\\\"better&quicker'-patch.patch\"]\n+# checking rev 891bc14b5603474c9743fd04f3da888644413dc5\n+\t\"891bc14b5603474c9743fd04f3da888644413dc5\" [label=\"c.patch\"]\n+# checking rev c7014443c33d2b0237293687ceb9cbd38313df65\n+\t\"c7014443c33d2b0237293687ceb9cbd38313df65\" [label=\"b.patch\"]\n+# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d\n+\t\"ff2775f8d1dc753f635830adcc3a067e0b681e2d\" [label=\"a.patch\"]\n+}\ndiff --git a/regression/t-033.sh b/regression/t-033.sh\nindex 9fe1827..ae22914 100755\n--- a/regression/t-033.sh\n+++ b/regression/t-033.sh\n@@ -59,3 +59,6 @@ cmd git add file.txt\n cmd guilt refresh\n fixup_time_info \"a-\\\"better&quicker'-patch.patch\"\n cmd guilt graph\n+\n+echo \"%% The same graph, but excluding deps introduced by file.txt.\"\n+cmd guilt graph -x file.txt\n-- \n2.1.0\n"},{"id":"255200","messageId":"20150123143637.GH101465@meili.jeffnet.31bits.net","threadId":"38444","inReplyTo":"1422022867-7908-2-git-send-email-cederp@opera.com","subject":"Re: [GUILT 1/2] guilt graph: Simplify getfiles.","fromName":"Jeff Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2015-01-23T14:36:37Z","receivedAt":"2015-01-23T14:36:37Z","isPatch":false,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"Neat.\n\nSigned-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>\n\nOn Fri, Jan 23, 2015 at 03:21:06PM +0100, Per Cederqvist wrote:\n> git diff-tree by default emits TAB-separated fields.  cut by defaults\n> processes TAB-separated fields.  Simplify getfiles() by using TAB as\n> the separator.\n> \n> Signed-off-by: Per Cederqvist <cederp@opera.com>\n> ---\n>  guilt-graph | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/guilt-graph b/guilt-graph\n> index 0857e0d..d90c2f1 100755\n> --- a/guilt-graph\n> +++ b/guilt-graph\n> @@ -36,7 +36,7 @@ fi\n>  \n>  getfiles()\n>  {\n> -\tgit diff-tree -r \"$1^\" \"$1\" | tr '\\t' ' ' | cut -d' ' -f6\n> +\tgit diff-tree -r \"$1^\" \"$1\" | cut -f2\n>  }\n>  \n>  cache=\"$GUILT_DIR/$branch/.graphcache.$$\"\n> -- \n> 2.1.0\n> \n\n-- \nC is quirky, flawed, and an enormous success.\n\t\t- Dennis M. Ritchie.\n"},{"id":"255201","messageId":"20150123144913.GI101465@meili.jeffnet.31bits.net","threadId":"38444","inReplyTo":"1422022867-7908-3-git-send-email-cederp@opera.com","subject":"Re: [GUILT 2/2] Teach \"guilt graph\" the \"-x exclude-pattern\" option.","fromName":"Jeff Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2015-01-23T14:49:13Z","receivedAt":"2015-01-23T14:49:13Z","isPatch":false,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Fri, Jan 23, 2015 at 03:21:07PM +0100, Per Cederqvist wrote:\n> Some projects keep a ChangeLog which every commit modifies.  This\n> makes the graph a very uninteresting single line of commits.  It is\n> sometimes useful to see how the graph would look if we ignore the\n> ChangeLog file.\n> \n> The new -x option is useful in situations like this.  It can be\n> repeated several times to ignore many files.  Each argument is saved\n> to a temporary file and \"grep -v -f $TEMPORARY\" is used to filter out\n> the file names you want to ignore.\n\nCool idea.\n\n> Also added a minimal test case and documentation.\n> \n> Signed-off-by: Per Cederqvist <cederp@opera.com>\n> ---\n>  Documentation/guilt-graph.txt |  5 +++++\n>  guilt-graph                   | 24 ++++++++++++++++++------\n>  regression/t-033.out          | 12 ++++++++++++\n>  regression/t-033.sh           |  3 +++\n>  4 files changed, 38 insertions(+), 6 deletions(-)\n> \n> diff --git a/Documentation/guilt-graph.txt b/Documentation/guilt-graph.txt\n> index f43206e..eeed321 100644\n> --- a/Documentation/guilt-graph.txt\n> +++ b/Documentation/guilt-graph.txt\n> @@ -16,6 +16,11 @@ patches.\n>  \n>  OPTIONS\n>  -------\n> +-x <pattern>::\n> +\tIgnore files that matches the given grep pattern. Can be\n> +\trepeated to ignore several files. This can be useful to ignore\n> +\tfor instance ChangeLog files that every commit modifies.\n> +\n>  <patchname>::\n>  \tInstead of starting with the topmost applied patch, start with\n>  \t<patchname>.\n> diff --git a/guilt-graph b/guilt-graph\n> index d90c2f1..4d5fe46 100755\n> --- a/guilt-graph\n> +++ b/guilt-graph\n> @@ -3,7 +3,7 @@\n>  # Copyright (c) Josef \"Jeff\" Sipek, 2007-2013\n>  #\n>  \n> -USAGE=\"[<patchname>]\"\n> +USAGE=\"[-x exclude-pattern]... [<patchname>]\"\n>  if [ -z \"$GUILT_VERSION\" ]; then\n>  \techo \"Invoking `basename \"$0\"` directly is no longer supported.\" >&2\n>  \texit 1\n> @@ -11,6 +11,22 @@ fi\n>  \n>  _main() {\n>  \n> +cache=\"$GUILT_DIR/$branch/.graphcache.$$\"\n> +xclude=\"$GUILT_DIR/$branch/.graphexclude.$$\"\n> +trap \"rm -rf \\\"$cache\\\" \\\"$xclude\\\"\" 0\n> +mkdir \"$cache\"\n> +>\"$xclude\"\n> +\n> +while [ $# -gt 0 ]; do\n> +    if [ \"$1\" = \"-x\" ] && [ $# -ge 2 ]; then\n> +\techo \"$2\" >> \"$xclude\"\n> +\tshift\n> +\tshift\n> +    else\n> +\tbreak\n> +    fi\n\nSpaces used for indentation.  Otherwise looks good.\n\nSigned-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>\n\n> +done\n> +\n>  if [ $# -gt 1 ]; then\n>  \tusage\n>  fi\n> @@ -39,10 +55,6 @@ getfiles()\n>  \tgit diff-tree -r \"$1^\" \"$1\" | cut -f2\n>  }\n>  \n> -cache=\"$GUILT_DIR/$branch/.graphcache.$$\"\n> -mkdir \"$cache\"\n> -trap \"rm -rf \\\"$cache\\\"\" 0\n> -\n>  disp \"digraph G {\"\n>  \n>  current=\"$top\"\n> @@ -66,7 +78,7 @@ while [ \"$current\" != \"$base\" ]; do\n>  \trm -f \"$cache/dep\"\n>  \ttouch \"$cache/dep\"\n>  \n> -\tgetfiles $current | while read f; do\n> +\tgetfiles $current | grep -v -f \"$xclude\" | while read f; do\n>  \t\t# hash the filename\n>  \t\tfh=`echo \"$f\" | sha1 | cut -d' ' -f1`\n>  \t\tif [ -e \"$cache/$fh\" ]; then\n> diff --git a/regression/t-033.out b/regression/t-033.out\n> index c120d4f..1ed371f 100644\n> --- a/regression/t-033.out\n> +++ b/regression/t-033.out\n> @@ -88,3 +88,15 @@ digraph G {\n>  \t\"ff2775f8d1dc753f635830adcc3a067e0b681e2d\" [label=\"a.patch\"]\n>  \t\"891bc14b5603474c9743fd04f3da888644413dc5\" -> \"ff2775f8d1dc753f635830adcc3a067e0b681e2d\"; // ?\n>  }\n> +%% The same graph, but excluding deps introduced by file.txt.\n> +% guilt graph -x file.txt\n> +digraph G {\n> +# checking rev bc7df666a646739eaf559af23cab72f2bfd01f0e\n> +\t\"bc7df666a646739eaf559af23cab72f2bfd01f0e\" [label=\"a-\\\"better&quicker'-patch.patch\"]\n> +# checking rev 891bc14b5603474c9743fd04f3da888644413dc5\n> +\t\"891bc14b5603474c9743fd04f3da888644413dc5\" [label=\"c.patch\"]\n> +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65\n> +\t\"c7014443c33d2b0237293687ceb9cbd38313df65\" [label=\"b.patch\"]\n> +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d\n> +\t\"ff2775f8d1dc753f635830adcc3a067e0b681e2d\" [label=\"a.patch\"]\n> +}\n> diff --git a/regression/t-033.sh b/regression/t-033.sh\n> index 9fe1827..ae22914 100755\n> --- a/regression/t-033.sh\n> +++ b/regression/t-033.sh\n> @@ -59,3 +59,6 @@ cmd git add file.txt\n>  cmd guilt refresh\n>  fixup_time_info \"a-\\\"better&quicker'-patch.patch\"\n>  cmd guilt graph\n> +\n> +echo \"%% The same graph, but excluding deps introduced by file.txt.\"\n> +cmd guilt graph -x file.txt\n> -- \n> 2.1.0\n> \n\n-- \nComputer Science is no more about computers than astronomy is about\ntelescopes.\n\t\t- Edsger Dijkstra\n"}]}