{"thread":{"id":"13798","subject":"[tig] Feeding specific revisions to tig","startedAt":"2008-06-04T18:52:14Z","lastAt":"2011-09-15T15:10:09Z","messageCount":11,"participants":["Jean-Baptiste Quenot","Jeff King","Jonas Fonseca"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"78648","messageId":"ae63f8b50806041152v11a2997y9411c5ea3ebc9598@mail.gmail.com","threadId":"13798","inReplyTo":null,"subject":"[tig] Feeding specific revisions to tig","fromName":"Jean-Baptiste Quenot","fromEmail":"jbq@caraldi.com","sentAt":"2008-06-04T18:52:14Z","receivedAt":"2008-06-04T18:52:14Z","isPatch":false,"sender":{"key":"jbq@caraldi.com","avatar":null},"body":"Hi there,\n\nIn order to track changes between my development branch and the stable\nbranch that goes to production, I'm using git-cherry-pick and\ngit-cherry to list the changesets available for merging.\n\nIdeally I'd like to feed this list of commits to tig, so that I can\nwatch the commit diff and summary easily and switch from one commit to\nanother.  But tig only behaves as a pager, and does not help for this.\n\nTo make it short I'd like to do something like this:\n\ngit-cherry origin/stable origin/trunk | sed -ne 's/^+ //p' | tig\n\nAnd browse every available commit with tig.\n\nDoes it make sense?\n\nCheers,\n-- \nJean-Baptiste Quenot\nhttp://jbq.caraldi.com/\n"},{"id":"78654","messageId":"20080604192916.GB17327@sigill.intra.peff.net","threadId":"13798","inReplyTo":"ae63f8b50806041152v11a2997y9411c5ea3ebc9598@mail.gmail.com","subject":"Re: [tig] Feeding specific revisions to tig","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-04T19:29:16Z","receivedAt":"2008-06-04T19:29:16Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jun 04, 2008 at 08:52:14PM +0200, Jean-Baptiste Quenot wrote:\n\n> Ideally I'd like to feed this list of commits to tig, so that I can\n> watch the commit diff and summary easily and switch from one commit to\n> another.  But tig only behaves as a pager, and does not help for this.\n\nI think there are two issues here, but both are solvable:\n\n  1. You want to see _just_ these commits, but not the whole ancestry\n     chain. In that case, you want to use --no-walk. E.g.:\n\n       tig --no-walk commit1 commit2 ...\n\n     Though it seems there are a few display artifacts. If I do\n\n       tig --no-walk tig-0.1 tig-0.2\n\n     I get the 2 commits I expect, but also two \"extra\" blank\n     commits at the bottom.\n\n  2. tig works like a pager when stdin is not a tty. You can work\n     around this by using xargs to give the commits to it on the\n     command line, and then redirect stdin from the tty.\n\n       ... | xargs sh -c 'tig --no-walk \"$@\" </dev/tty'\n\n     which is kind of a lot to type. It might be nice for \"tig -T\"\n     to open /dev/tty unconditionally instead of looking at stdin,\n     so you could just do:\n\n       ... | xargs tig -T --no-walk\n\n-Peff\n"},{"id":"78660","messageId":"ae63f8b50806041304i20de789ej492681f4b9306934@mail.gmail.com","threadId":"13798","inReplyTo":"20080604192916.GB17327@sigill.intra.peff.net","subject":"Re: [tig] Feeding specific revisions to tig","fromName":"Jean-Baptiste Quenot","fromEmail":"jbq@caraldi.com","sentAt":"2008-06-04T20:04:45Z","receivedAt":"2008-06-04T20:04:45Z","isPatch":false,"sender":{"key":"jbq@caraldi.com","avatar":null},"body":"2008/6/4 Jeff King <peff@peff.net>:\n> On Wed, Jun 04, 2008 at 08:52:14PM +0200, Jean-Baptiste Quenot wrote:\n>\n>> Ideally I'd like to feed this list of commits to tig, so that I can\n>> watch the commit diff and summary easily and switch from one commit to\n>> another.  But tig only behaves as a pager, and does not help for this.\n>\n> I think there are two issues here, but both are solvable:\n>\n>  1. You want to see _just_ these commits, but not the whole ancestry\n>     chain. In that case, you want to use --no-walk. E.g.:\n>\n>       tig --no-walk commit1 commit2 ...\n>\n>     Though it seems there are a few display artifacts. If I do\n>\n>       tig --no-walk tig-0.1 tig-0.2\n>\n>     I get the 2 commits I expect, but also two \"extra\" blank\n>     commits at the bottom.\n\nI confirm there are extra blank lines at the bottom.  As many as real\ncommit lines.\n\n>  2. tig works like a pager when stdin is not a tty. You can work\n>     around this by using xargs to give the commits to it on the\n>     command line, and then redirect stdin from the tty.\n>\n>       ... | xargs sh -c 'tig --no-walk \"$@\" </dev/tty'\n\nThanks for the suggestion.  However, my list of commits is too long,\nthe shell errors out with \"tig: command too long\".  I'd like to feed\ntig with a list of commits from stdin, or from a file.\n\nSomething like: ... | tig --no-walk -F -\n\nWhich means: take the list of revisions from specified file, or here -\nfor stdin, a la grep.\n\nCheers,\n-- \nJean-Baptiste Quenot\nhttp://jbq.caraldi.com/\n"},{"id":"78677","messageId":"20080604230858.GA27136@sigill.intra.peff.net","threadId":"13798","inReplyTo":"ae63f8b50806041304i20de789ej492681f4b9306934@mail.gmail.com","subject":"Re: [tig] Feeding specific revisions to tig","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-04T23:08:58Z","receivedAt":"2008-06-04T23:08:58Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jun 04, 2008 at 10:04:45PM +0200, Jean-Baptiste Quenot wrote:\n\n> Thanks for the suggestion.  However, my list of commits is too long,\n> the shell errors out with \"tig: command too long\".  I'd like to feed\n> tig with a list of commits from stdin, or from a file.\n> \n> Something like: ... | tig --no-walk -F -\n> \n> Which means: take the list of revisions from specified file, or here -\n> for stdin, a la grep.\n\nAh. Adding \"-F\" probably wouldn't be that much work, but tig spawns \"git\nlog\" internally, so you would probably end up with the same problem\nthere. Converting tig to use \"git rev-list --stdin\" would fix that, but\nis probably a bit of major surgery.\n\n-Peff\n"},{"id":"86335","messageId":"2c6b72b30808060406u10d7b332g22ea28fe5470ddb1@mail.gmail.com","threadId":"13798","inReplyTo":"20080604230858.GA27136@sigill.intra.peff.net","subject":"Re: [tig] Feeding specific revisions to tig","fromName":"Jonas Fonseca","fromEmail":"jonas.fonseca@gmail.com","sentAt":"2008-08-06T11:06:51Z","receivedAt":"2008-08-06T11:06:51Z","isPatch":false,"sender":{"key":"jonas.fonseca@gmail.com","avatar":"https://gravatar.com/avatar/9b7fa23cce50269e5d164312b6ac5ae818a180f837b38f28f3bdf689dd7f96cd?d=mp&s=160"},"body":"Sorry for restarting this old thread ...\n\nOn Thu, Jun 5, 2008 at 01:08, Jeff King <peff@peff.net> wrote:\n> On Wed, Jun 04, 2008 at 10:04:45PM +0200, Jean-Baptiste Quenot wrote:\n>\n>> Thanks for the suggestion.  However, my list of commits is too long,\n>> the shell errors out with \"tig: command too long\".  I'd like to feed\n>> tig with a list of commits from stdin, or from a file.\n>>\n>> Something like: ... | tig --no-walk -F -\n>>\n>> Which means: take the list of revisions from specified file, or here -\n>> for stdin, a la grep.\n>\n> Ah. Adding \"-F\" probably wouldn't be that much work, but tig spawns \"git\n> log\" internally, so you would probably end up with the same problem\n> there. Converting tig to use \"git rev-list --stdin\" would fix that, but\n> is probably a bit of major surgery.\n\ngit-rev-list expects a commit as an argument while git-log does not. I\nhave been gradually changing the option parsing code to move towards\nusing git-rev-parse for splitting up arguments so it will be possible\nto support refreshing better and pass user arguments to the diff\nengine etc. When the code will get there it probably won't be that\nhard to switch to use git-rev-list.\n\nI actually added something that let's you alter the command executed\nfor each view. So here is another possibility that can be used:\n\nfunction tignowalk ()\n{\n   tmp=$(mktemp) # or .git/tigfiles or similar\n   # Safe stuff from \"stdin\" and run tig with custom rev-list command\n   cat > \"$tmp\n   TIG_MAIN_CMD=\"git rev-list --pretty=raw --no-walk --stdin < $tmp\"\ntig < /dev/tty\n   rm \"$tmp\"\n}\n\nAnd then:\n\n   printf \"tig-0.2\\ntig-0.1\" | tignowalk\n\nOn Wed, Jun 4, 2008 at 22:04, Jean-Baptiste Quenot <jbq@caraldi.com> wrote:\n> 2008/6/4 Jeff King <peff@peff.net>:\n>>     Though it seems there are a few display artifacts. If I do\n>>\n>>       tig --no-walk tig-0.1 tig-0.2\n>>\n>>     I get the 2 commits I expect, but also two \"extra\" blank\n>>     commits at the bottom.\n>\n> I confirm there are extra blank lines at the bottom.  As many as real\n> commit lines.\n\nThe problem is that --no-walk doesn't seem to play nice with the\n--boundary flag that tig add by default. When the user requests\n--no-walk boundary commits are probably not interesting. My fix below\nhas more information. I don't know if having only the \"commit\" line\nshow up is a bug in git. At least there are no tests to confirm this\nor not.\n\ncommit ad9f9954419b5d3f595580d5184db59a00711f92\nAuthor: Jonas Fonseca <fonseca@diku.dk>\nDate:   Tue Aug 5 23:40:21 2008 +0200\n\n    Clean up incomplete commits from main view listed for --no-walk\n\n    When --no-walk is given on the command line by the user it causes\n    boundary commits to be output with just the commit line, i.e:\n\n      > git rev-list --pretty=raw --boundary --no-walk HEAD\n      commit 60e8ea56880fc2e42008075d516c356ef605bc60\n      tree 5b76086e4deaf62d3f7baffc6f49840f61d4e79c\n      parent 145194bdfc8bf0b58185bbe28bc0097ce429de4d\n      author Jonas Fonseca <fonseca@diku.dk> 1217797175 +0200\n      committer Jonas Fonseca <fonseca@diku.dk> 1217797402 +0200\n\n          Remove the global opt_request variable\n\n      commit -145194bdfc8bf0b58185bbe28bc0097ce429de4d\n\ndiff --git a/NEWS b/NEWS\nindex b7a8df1..d93fb04 100644\n--- a/NEWS\n+++ b/NEWS\n@@ -22,6 +22,7 @@ Bug fixes:\n    keybinding to launch the merge tool in the status view.\n  - Fix problem with $(cmd) usage in shell code. Some shells (jsh)\n    installed as /bin/sh does not support it.\n+ - Do not show incomplete boundary commits when --no-walk is used.\n  - Documentation: Rename gitlink macro to support AsciiDoc 8.2.3.\n\n tig-0.11\ndiff --git a/tig.c b/tig.c\nindex 6846519..6b111e4 100644\n--- a/tig.c\n+++ b/tig.c\n@@ -4983,6 +4983,14 @@ main_read(struct view *view, char *line)\n \tif (!line) {\n \t\tif (!view->lines && !view->parent)\n \t\t\tdie(\"No revisions match the given arguments.\");\n+\t\tif (view->lines > 0) {\n+\t\t\tcommit = view->line[view->lines - 1].data;\n+\t\t\tif (!*commit->author) {\n+\t\t\t\tview->lines--;\n+\t\t\t\tfree(commit);\n+\t\t\t\tgraph->commit = NULL;\n+\t\t\t}\n+\t\t}\n \t\tupdate_rev_graph(graph);\n \t\treturn TRUE;\n \t}\n\n-- \nJonas Fonseca\n"},{"id":"86549","messageId":"20080808211916.GA30583@sigill.intra.peff.net","threadId":"13798","inReplyTo":"2c6b72b30808060406u10d7b332g22ea28fe5470ddb1@mail.gmail.com","subject":"Re: [tig] Feeding specific revisions to tig","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-08-08T21:19:16Z","receivedAt":"2008-08-08T21:19:16Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 06, 2008 at 01:06:51PM +0200, Jonas Fonseca wrote:\n\n> Sorry for restarting this old thread ...\n\nI am glad you got a chance to look at it. :)\n\n> I actually added something that let's you alter the command executed\n> for each view. So here is another possibility that can be used:\n> \n> function tignowalk ()\n> {\n>    tmp=$(mktemp) # or .git/tigfiles or similar\n>    # Safe stuff from \"stdin\" and run tig with custom rev-list command\n>    cat > \"$tmp\n>    TIG_MAIN_CMD=\"git rev-list --pretty=raw --no-walk --stdin < $tmp\"\n> tig < /dev/tty\n>    rm \"$tmp\"\n> }\n\nNeat, if a bit hack-ish. :) You are missing a closing quotation mark\nafter\n\n  cat > \"$tmp\n\nand the line break between TIG_MAIN_CMD and tig is obviously problematic\n(presumably an artifact of the email, but it confused my cut and paste\nefforts for a minute). One other thing to note is that even though you\ntry to handle a $tmp with whitespace in the cat and rm commands, I\nsuspect it would fail when tig hands TIG_MAIN_CMD to the shell. That\nwould require double-quoting.\n\nSo here is my cut-and-pastable version:\n\n  tignowalk() {\n    tmp=$(mktemp)\n    cat >\"$tmp\"\n    TIG_MAIN_CMD=\"git rev-list --pretty=raw --no-walk --stdin <$tmp\" \\\n      tig </dev/tty\n    rm \"$tmp\"\n  }\n\nThe output looks great, though. Doing\n\n  git show-ref --heads | cut -d' ' -f2 | tignowalk\n\nis nice. :)\n\n> The problem is that --no-walk doesn't seem to play nice with the\n> --boundary flag that tig add by default. When the user requests\n> --no-walk boundary commits are probably not interesting. My fix below\n> has more information. I don't know if having only the \"commit\" line\n> show up is a bug in git. At least there are no tests to confirm this\n> or not.\n\nSorry, I don't know if that is intentional or not.\n\n-Peff\n"},{"id":"86656","messageId":"2c6b72b30808100216j2c719bf2yb7dfba651db901e3@mail.gmail.com","threadId":"13798","inReplyTo":"20080808211916.GA30583@sigill.intra.peff.net","subject":"Re: [tig] Feeding specific revisions to tig","fromName":"Jonas Fonseca","fromEmail":"jonas.fonseca@gmail.com","sentAt":"2008-08-10T09:16:37Z","receivedAt":"2008-08-10T09:16:37Z","isPatch":false,"sender":{"key":"jonas.fonseca@gmail.com","avatar":"https://gravatar.com/avatar/9b7fa23cce50269e5d164312b6ac5ae818a180f837b38f28f3bdf689dd7f96cd?d=mp&s=160"},"body":"On Fri, Aug 8, 2008 at 23:19, Jeff King <peff@peff.net> wrote:\n> On Wed, Aug 06, 2008 at 01:06:51PM +0200, Jonas Fonseca wrote:\n>> I actually added something that let's you alter the command executed\n>> for each view. So here is another possibility that can be used:\n>>\n>> function tignowalk ()\n>> {\n>>    tmp=$(mktemp) # or .git/tigfiles or similar\n>>    # Safe stuff from \"stdin\" and run tig with custom rev-list command\n>>    cat > \"$tmp\n>>    TIG_MAIN_CMD=\"git rev-list --pretty=raw --no-walk --stdin < $tmp\"\n>> tig < /dev/tty\n>>    rm \"$tmp\"\n>> }\n>\n> Neat, if a bit hack-ish. :) You are missing a closing quotation mark\n> after\n>\n>  cat > \"$tmp\n>\n> and the line break between TIG_MAIN_CMD and tig is obviously problematic\n> (presumably an artifact of the email, but it confused my cut and paste\n> efforts for a minute). One other thing to note is that even though you\n> try to handle a $tmp with whitespace in the cat and rm commands, I\n> suspect it would fail when tig hands TIG_MAIN_CMD to the shell. That\n> would require double-quoting.\n\nYes, this way to \"hook\" into tig is a bit hackish and gives some\nproblems with handling files. But then again, it is hidden away in\nenv. variables, which seems very effective in not getting it too\nexposed. :)\n\n> So here is my cut-and-pastable version:\n>\n>  tignowalk() {\n>    tmp=$(mktemp)\n>    cat >\"$tmp\"\n>    TIG_MAIN_CMD=\"git rev-list --pretty=raw --no-walk --stdin <$tmp\" \\\n>      tig </dev/tty\n>    rm \"$tmp\"\n>  }\n\nThanks for the fixed up version.\n\n-- \nJonas Fonseca\n"},{"id":"112091","messageId":"ae63f8b50904230755p12170753qf3fc273b48afe4d4@mail.gmail.com","threadId":"13798","inReplyTo":"2c6b72b30808100216j2c719bf2yb7dfba651db901e3@mail.gmail.com","subject":"Re: [tig] Feeding specific revisions to tig","fromName":"Jean-Baptiste Quenot","fromEmail":"jbq@caraldi.com","sentAt":"2009-04-23T14:55:06Z","receivedAt":"2009-04-23T14:55:06Z","isPatch":false,"sender":{"key":"jbq@caraldi.com","avatar":null},"body":"2008/8/10 Jonas Fonseca <jonas.fonseca@gmail.com>:\n>> So here is my cut-and-pastable version:\n>>\n>>  tignowalk() {\n>>    tmp=$(mktemp)\n>>    cat >\"$tmp\"\n>>    TIG_MAIN_CMD=\"git rev-list --pretty=raw --no-walk --stdin <$tmp\" \\\n>>      tig </dev/tty\n>>    rm \"$tmp\"\n>>  }\n>\n> Thanks for the fixed up version.\n\nRestarting this old thread again.  Starting from 0.13 the\n*tignowalk()* hack does not work anymore.  What's the preferred way to\nfeed specific revisions using stdin now?\n-- \nJean-Baptiste Quenot\nhttp://jbq.caraldi.com/\n"},{"id":"112410","messageId":"2c6b72b30904270321t3d73e2c5o5e3ac8d4b627e5ab@mail.gmail.com","threadId":"13798","inReplyTo":"ae63f8b50904230755p12170753qf3fc273b48afe4d4@mail.gmail.com","subject":"Re: [tig] Feeding specific revisions to tig","fromName":"Jonas Fonseca","fromEmail":"jonas.fonseca@gmail.com","sentAt":"2009-04-27T10:21:05Z","receivedAt":"2009-04-27T10:21:05Z","isPatch":false,"sender":{"key":"jonas.fonseca@gmail.com","avatar":"https://gravatar.com/avatar/9b7fa23cce50269e5d164312b6ac5ae818a180f837b38f28f3bdf689dd7f96cd?d=mp&s=160"},"body":"Sorry for the slow reply ...\n\nOn Thu, Apr 23, 2009 at 16:55, Jean-Baptiste Quenot <jbq@caraldi.com> wrote:\n> 2008/8/10 Jonas Fonseca <jonas.fonseca@gmail.com>:\n>>> So here is my cut-and-pastable version:\n>>>\n>>>  tignowalk() {\n>>>    tmp=$(mktemp)\n>>>    cat >\"$tmp\"\n>>>    TIG_MAIN_CMD=\"git rev-list --pretty=raw --no-walk --stdin <$tmp\" \\\n>>>      tig </dev/tty\n>>>    rm \"$tmp\"\n>>>  }\n>>\n>> Thanks for the fixed up version.\n>\n> Restarting this old thread again.  Starting from 0.13 the\n> *tignowalk()* hack does not work anymore.  What's the preferred way to\n> feed specific revisions using stdin now?\n\nI don't know if it is preferred, but it works. First add a git alias:\n\n[alias]\n        tignowalk-helper = !git rev-list --pretty=raw --no-walk --stdin<\n\nThen modify tignowalk by replacing the line calling tig to say:\n\nTIG_MAIN_CMD=\"git tignowalk-helper $tmp\" tig </dev/tty\n\n... and it should work. Maybe more git alias functionality can\nsimplify the hack.\n\n-- \nJonas Fonseca\n"},{"id":"112499","messageId":"ae63f8b50904280115y14ceef49x81ae6d61fb92e429@mail.gmail.com","threadId":"13798","inReplyTo":"2c6b72b30904270321t3d73e2c5o5e3ac8d4b627e5ab@mail.gmail.com","subject":"Re: [tig] Feeding specific revisions to tig","fromName":"Jean-Baptiste Quenot","fromEmail":"jbq@caraldi.com","sentAt":"2009-04-28T08:15:32Z","receivedAt":"2009-04-28T08:15:32Z","isPatch":false,"sender":{"key":"jbq@caraldi.com","avatar":null},"body":"2009/4/27 Jonas Fonseca <jonas.fonseca@gmail.com>:\n\n> On Thu, Apr 23, 2009 at 16:55, Jean-Baptiste Quenot <jbq@caraldi.com> wrote:\n\n>> Restarting this old thread again.  Starting from 0.13 the\n>> *tignowalk()* hack does not work anymore.  What's the preferred way to\n>> feed specific revisions using stdin now?\n>\n> I don't know if it is preferred, but it works. First add a git alias:\n>\n> [alias]\n>        tignowalk-helper = !git rev-list --pretty=raw --no-walk --stdin<\n>\n> Then modify tignowalk by replacing the line calling tig to say:\n>\n> TIG_MAIN_CMD=\"git tignowalk-helper $tmp\" tig </dev/tty\n>\n> ... and it should work. Maybe more git alias functionality can\n> simplify the hack.\n\nWorks a treat, thanks!\n\nI wonder how you managed to invent this trick though :-)\n-- \nJean-Baptiste Quenot\nhttp://jbq.caraldi.com/\n"},{"id":"175582","messageId":"CAK6bCawiae55q_+E4pWDs_v6V0RLhU97zrw9P1N5j-eCrVSh9w@mail.gmail.com","threadId":"13798","inReplyTo":"2c6b72b30904270321t3d73e2c5o5e3ac8d4b627e5ab@mail.gmail.com","subject":"Re: [tig] Feeding specific revisions to tig","fromName":"Jean-Baptiste Quenot","fromEmail":"jbq@caraldi.com","sentAt":"2011-09-15T15:10:09Z","receivedAt":"2011-09-15T15:10:09Z","isPatch":false,"sender":{"key":"jbq@caraldi.com","avatar":null},"body":"2009/4/27 Jonas Fonseca <jonas.fonseca@gmail.com>:\n> Sorry for the slow reply ...\n>\n> On Thu, Apr 23, 2009 at 16:55, Jean-Baptiste Quenot <jbq@caraldi.com> wrote:\n>> Restarting this old thread again.  Starting from 0.13 the\n>> *tignowalk()* hack does not work anymore.  What's the preferred way to\n>> feed specific revisions using stdin now?\n>\n> I don't know if it is preferred, but it works. First add a git alias:\n>\n> [alias]\n>        tignowalk-helper = !git rev-list --pretty=raw --no-walk --stdin<\n>\n> Then modify tignowalk by replacing the line calling tig to say:\n>\n> TIG_MAIN_CMD=\"git tignowalk-helper $tmp\" tig </dev/tty\n>\n> ... and it should work. Maybe more git alias functionality can\n> simplify the hack.\n\nRestarting this thread again... it seems like every new version of tig\nbreaks this usecase :-)\n\nAny idea how to feed specific revisions to tig 0.18?  The trick does\nnot work anymore, as support for TIG_MAIN_CMD was dropped.\n-- \nJean-Baptiste Quenot\n"}]}