* [tig] Feeding specific revisions to tig @ 2008-06-04 18:52 Jean-Baptiste Quenot 2008-06-04 19:29 ` Jeff King 0 siblings, 1 reply; 11+ messages in thread From: Jean-Baptiste Quenot @ 2008-06-04 18:52 UTC (permalink / raw) To: git Hi there, In order to track changes between my development branch and the stable branch that goes to production, I'm using git-cherry-pick and git-cherry to list the changesets available for merging. Ideally I'd like to feed this list of commits to tig, so that I can watch the commit diff and summary easily and switch from one commit to another. But tig only behaves as a pager, and does not help for this. To make it short I'd like to do something like this: git-cherry origin/stable origin/trunk | sed -ne 's/^+ //p' | tig And browse every available commit with tig. Does it make sense? Cheers, -- Jean-Baptiste Quenot http://jbq.caraldi.com/ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [tig] Feeding specific revisions to tig 2008-06-04 18:52 [tig] Feeding specific revisions to tig Jean-Baptiste Quenot @ 2008-06-04 19:29 ` Jeff King 2008-06-04 20:04 ` Jean-Baptiste Quenot 0 siblings, 1 reply; 11+ messages in thread From: Jeff King @ 2008-06-04 19:29 UTC (permalink / raw) To: Jean-Baptiste Quenot; +Cc: git On Wed, Jun 04, 2008 at 08:52:14PM +0200, Jean-Baptiste Quenot wrote: > Ideally I'd like to feed this list of commits to tig, so that I can > watch the commit diff and summary easily and switch from one commit to > another. But tig only behaves as a pager, and does not help for this. I think there are two issues here, but both are solvable: 1. You want to see _just_ these commits, but not the whole ancestry chain. In that case, you want to use --no-walk. E.g.: tig --no-walk commit1 commit2 ... Though it seems there are a few display artifacts. If I do tig --no-walk tig-0.1 tig-0.2 I get the 2 commits I expect, but also two "extra" blank commits at the bottom. 2. tig works like a pager when stdin is not a tty. You can work around this by using xargs to give the commits to it on the command line, and then redirect stdin from the tty. ... | xargs sh -c 'tig --no-walk "$@" </dev/tty' which is kind of a lot to type. It might be nice for "tig -T" to open /dev/tty unconditionally instead of looking at stdin, so you could just do: ... | xargs tig -T --no-walk -Peff ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [tig] Feeding specific revisions to tig 2008-06-04 19:29 ` Jeff King @ 2008-06-04 20:04 ` Jean-Baptiste Quenot 2008-06-04 23:08 ` Jeff King 0 siblings, 1 reply; 11+ messages in thread From: Jean-Baptiste Quenot @ 2008-06-04 20:04 UTC (permalink / raw) To: git 2008/6/4 Jeff King <peff@peff.net>: > On Wed, Jun 04, 2008 at 08:52:14PM +0200, Jean-Baptiste Quenot wrote: > >> Ideally I'd like to feed this list of commits to tig, so that I can >> watch the commit diff and summary easily and switch from one commit to >> another. But tig only behaves as a pager, and does not help for this. > > I think there are two issues here, but both are solvable: > > 1. You want to see _just_ these commits, but not the whole ancestry > chain. In that case, you want to use --no-walk. E.g.: > > tig --no-walk commit1 commit2 ... > > Though it seems there are a few display artifacts. If I do > > tig --no-walk tig-0.1 tig-0.2 > > I get the 2 commits I expect, but also two "extra" blank > commits at the bottom. I confirm there are extra blank lines at the bottom. As many as real commit lines. > 2. tig works like a pager when stdin is not a tty. You can work > around this by using xargs to give the commits to it on the > command line, and then redirect stdin from the tty. > > ... | xargs sh -c 'tig --no-walk "$@" </dev/tty' Thanks for the suggestion. However, my list of commits is too long, the shell errors out with "tig: command too long". I'd like to feed tig with a list of commits from stdin, or from a file. Something like: ... | tig --no-walk -F - Which means: take the list of revisions from specified file, or here - for stdin, a la grep. Cheers, -- Jean-Baptiste Quenot http://jbq.caraldi.com/ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [tig] Feeding specific revisions to tig 2008-06-04 20:04 ` Jean-Baptiste Quenot @ 2008-06-04 23:08 ` Jeff King 2008-08-06 11:06 ` Jonas Fonseca 0 siblings, 1 reply; 11+ messages in thread From: Jeff King @ 2008-06-04 23:08 UTC (permalink / raw) To: Jean-Baptiste Quenot; +Cc: git On Wed, Jun 04, 2008 at 10:04:45PM +0200, Jean-Baptiste Quenot wrote: > Thanks for the suggestion. However, my list of commits is too long, > the shell errors out with "tig: command too long". I'd like to feed > tig with a list of commits from stdin, or from a file. > > Something like: ... | tig --no-walk -F - > > Which means: take the list of revisions from specified file, or here - > for stdin, a la grep. Ah. Adding "-F" probably wouldn't be that much work, but tig spawns "git log" internally, so you would probably end up with the same problem there. Converting tig to use "git rev-list --stdin" would fix that, but is probably a bit of major surgery. -Peff ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [tig] Feeding specific revisions to tig 2008-06-04 23:08 ` Jeff King @ 2008-08-06 11:06 ` Jonas Fonseca 2008-08-08 21:19 ` Jeff King 0 siblings, 1 reply; 11+ messages in thread From: Jonas Fonseca @ 2008-08-06 11:06 UTC (permalink / raw) To: Jeff King; +Cc: Jean-Baptiste Quenot, git Sorry for restarting this old thread ... On Thu, Jun 5, 2008 at 01:08, Jeff King <peff@peff.net> wrote: > On Wed, Jun 04, 2008 at 10:04:45PM +0200, Jean-Baptiste Quenot wrote: > >> Thanks for the suggestion. However, my list of commits is too long, >> the shell errors out with "tig: command too long". I'd like to feed >> tig with a list of commits from stdin, or from a file. >> >> Something like: ... | tig --no-walk -F - >> >> Which means: take the list of revisions from specified file, or here - >> for stdin, a la grep. > > Ah. Adding "-F" probably wouldn't be that much work, but tig spawns "git > log" internally, so you would probably end up with the same problem > there. Converting tig to use "git rev-list --stdin" would fix that, but > is probably a bit of major surgery. git-rev-list expects a commit as an argument while git-log does not. I have been gradually changing the option parsing code to move towards using git-rev-parse for splitting up arguments so it will be possible to support refreshing better and pass user arguments to the diff engine etc. When the code will get there it probably won't be that hard to switch to use git-rev-list. I actually added something that let's you alter the command executed for each view. So here is another possibility that can be used: function tignowalk () { tmp=$(mktemp) # or .git/tigfiles or similar # Safe stuff from "stdin" and run tig with custom rev-list command cat > "$tmp TIG_MAIN_CMD="git rev-list --pretty=raw --no-walk --stdin < $tmp" tig < /dev/tty rm "$tmp" } And then: printf "tig-0.2\ntig-0.1" | tignowalk On Wed, Jun 4, 2008 at 22:04, Jean-Baptiste Quenot <jbq@caraldi.com> wrote: > 2008/6/4 Jeff King <peff@peff.net>: >> Though it seems there are a few display artifacts. If I do >> >> tig --no-walk tig-0.1 tig-0.2 >> >> I get the 2 commits I expect, but also two "extra" blank >> commits at the bottom. > > I confirm there are extra blank lines at the bottom. As many as real > commit lines. The problem is that --no-walk doesn't seem to play nice with the --boundary flag that tig add by default. When the user requests --no-walk boundary commits are probably not interesting. My fix below has more information. I don't know if having only the "commit" line show up is a bug in git. At least there are no tests to confirm this or not. commit ad9f9954419b5d3f595580d5184db59a00711f92 Author: Jonas Fonseca <fonseca@diku.dk> Date: Tue Aug 5 23:40:21 2008 +0200 Clean up incomplete commits from main view listed for --no-walk When --no-walk is given on the command line by the user it causes boundary commits to be output with just the commit line, i.e: > git rev-list --pretty=raw --boundary --no-walk HEAD commit 60e8ea56880fc2e42008075d516c356ef605bc60 tree 5b76086e4deaf62d3f7baffc6f49840f61d4e79c parent 145194bdfc8bf0b58185bbe28bc0097ce429de4d author Jonas Fonseca <fonseca@diku.dk> 1217797175 +0200 committer Jonas Fonseca <fonseca@diku.dk> 1217797402 +0200 Remove the global opt_request variable commit -145194bdfc8bf0b58185bbe28bc0097ce429de4d diff --git a/NEWS b/NEWS index b7a8df1..d93fb04 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,7 @@ Bug fixes: keybinding to launch the merge tool in the status view. - Fix problem with $(cmd) usage in shell code. Some shells (jsh) installed as /bin/sh does not support it. + - Do not show incomplete boundary commits when --no-walk is used. - Documentation: Rename gitlink macro to support AsciiDoc 8.2.3. tig-0.11 diff --git a/tig.c b/tig.c index 6846519..6b111e4 100644 --- a/tig.c +++ b/tig.c @@ -4983,6 +4983,14 @@ main_read(struct view *view, char *line) if (!line) { if (!view->lines && !view->parent) die("No revisions match the given arguments."); + if (view->lines > 0) { + commit = view->line[view->lines - 1].data; + if (!*commit->author) { + view->lines--; + free(commit); + graph->commit = NULL; + } + } update_rev_graph(graph); return TRUE; } -- Jonas Fonseca ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [tig] Feeding specific revisions to tig 2008-08-06 11:06 ` Jonas Fonseca @ 2008-08-08 21:19 ` Jeff King 2008-08-10 9:16 ` Jonas Fonseca 0 siblings, 1 reply; 11+ messages in thread From: Jeff King @ 2008-08-08 21:19 UTC (permalink / raw) To: Jonas Fonseca; +Cc: Jean-Baptiste Quenot, git On Wed, Aug 06, 2008 at 01:06:51PM +0200, Jonas Fonseca wrote: > Sorry for restarting this old thread ... I am glad you got a chance to look at it. :) > I actually added something that let's you alter the command executed > for each view. So here is another possibility that can be used: > > function tignowalk () > { > tmp=$(mktemp) # or .git/tigfiles or similar > # Safe stuff from "stdin" and run tig with custom rev-list command > cat > "$tmp > TIG_MAIN_CMD="git rev-list --pretty=raw --no-walk --stdin < $tmp" > tig < /dev/tty > rm "$tmp" > } Neat, if a bit hack-ish. :) You are missing a closing quotation mark after cat > "$tmp and the line break between TIG_MAIN_CMD and tig is obviously problematic (presumably an artifact of the email, but it confused my cut and paste efforts for a minute). One other thing to note is that even though you try to handle a $tmp with whitespace in the cat and rm commands, I suspect it would fail when tig hands TIG_MAIN_CMD to the shell. That would require double-quoting. So here is my cut-and-pastable version: tignowalk() { tmp=$(mktemp) cat >"$tmp" TIG_MAIN_CMD="git rev-list --pretty=raw --no-walk --stdin <$tmp" \ tig </dev/tty rm "$tmp" } The output looks great, though. Doing git show-ref --heads | cut -d' ' -f2 | tignowalk is nice. :) > The problem is that --no-walk doesn't seem to play nice with the > --boundary flag that tig add by default. When the user requests > --no-walk boundary commits are probably not interesting. My fix below > has more information. I don't know if having only the "commit" line > show up is a bug in git. At least there are no tests to confirm this > or not. Sorry, I don't know if that is intentional or not. -Peff ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [tig] Feeding specific revisions to tig 2008-08-08 21:19 ` Jeff King @ 2008-08-10 9:16 ` Jonas Fonseca 2009-04-23 14:55 ` Jean-Baptiste Quenot 0 siblings, 1 reply; 11+ messages in thread From: Jonas Fonseca @ 2008-08-10 9:16 UTC (permalink / raw) To: Jeff King; +Cc: Jean-Baptiste Quenot, git On Fri, Aug 8, 2008 at 23:19, Jeff King <peff@peff.net> wrote: > On Wed, Aug 06, 2008 at 01:06:51PM +0200, Jonas Fonseca wrote: >> I actually added something that let's you alter the command executed >> for each view. So here is another possibility that can be used: >> >> function tignowalk () >> { >> tmp=$(mktemp) # or .git/tigfiles or similar >> # Safe stuff from "stdin" and run tig with custom rev-list command >> cat > "$tmp >> TIG_MAIN_CMD="git rev-list --pretty=raw --no-walk --stdin < $tmp" >> tig < /dev/tty >> rm "$tmp" >> } > > Neat, if a bit hack-ish. :) You are missing a closing quotation mark > after > > cat > "$tmp > > and the line break between TIG_MAIN_CMD and tig is obviously problematic > (presumably an artifact of the email, but it confused my cut and paste > efforts for a minute). One other thing to note is that even though you > try to handle a $tmp with whitespace in the cat and rm commands, I > suspect it would fail when tig hands TIG_MAIN_CMD to the shell. That > would require double-quoting. Yes, this way to "hook" into tig is a bit hackish and gives some problems with handling files. But then again, it is hidden away in env. variables, which seems very effective in not getting it too exposed. :) > So here is my cut-and-pastable version: > > tignowalk() { > tmp=$(mktemp) > cat >"$tmp" > TIG_MAIN_CMD="git rev-list --pretty=raw --no-walk --stdin <$tmp" \ > tig </dev/tty > rm "$tmp" > } Thanks for the fixed up version. -- Jonas Fonseca ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [tig] Feeding specific revisions to tig 2008-08-10 9:16 ` Jonas Fonseca @ 2009-04-23 14:55 ` Jean-Baptiste Quenot 2009-04-27 10:21 ` Jonas Fonseca 0 siblings, 1 reply; 11+ messages in thread From: Jean-Baptiste Quenot @ 2009-04-23 14:55 UTC (permalink / raw) To: git 2008/8/10 Jonas Fonseca <jonas.fonseca@gmail.com>: >> So here is my cut-and-pastable version: >> >> tignowalk() { >> tmp=$(mktemp) >> cat >"$tmp" >> TIG_MAIN_CMD="git rev-list --pretty=raw --no-walk --stdin <$tmp" \ >> tig </dev/tty >> rm "$tmp" >> } > > Thanks for the fixed up version. Restarting this old thread again. Starting from 0.13 the *tignowalk()* hack does not work anymore. What's the preferred way to feed specific revisions using stdin now? -- Jean-Baptiste Quenot http://jbq.caraldi.com/ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [tig] Feeding specific revisions to tig 2009-04-23 14:55 ` Jean-Baptiste Quenot @ 2009-04-27 10:21 ` Jonas Fonseca 2009-04-28 8:15 ` Jean-Baptiste Quenot 2011-09-15 15:10 ` Jean-Baptiste Quenot 0 siblings, 2 replies; 11+ messages in thread From: Jonas Fonseca @ 2009-04-27 10:21 UTC (permalink / raw) To: Jean-Baptiste Quenot; +Cc: git Sorry for the slow reply ... On Thu, Apr 23, 2009 at 16:55, Jean-Baptiste Quenot <jbq@caraldi.com> wrote: > 2008/8/10 Jonas Fonseca <jonas.fonseca@gmail.com>: >>> So here is my cut-and-pastable version: >>> >>> tignowalk() { >>> tmp=$(mktemp) >>> cat >"$tmp" >>> TIG_MAIN_CMD="git rev-list --pretty=raw --no-walk --stdin <$tmp" \ >>> tig </dev/tty >>> rm "$tmp" >>> } >> >> Thanks for the fixed up version. > > Restarting this old thread again. Starting from 0.13 the > *tignowalk()* hack does not work anymore. What's the preferred way to > feed specific revisions using stdin now? I don't know if it is preferred, but it works. First add a git alias: [alias] tignowalk-helper = !git rev-list --pretty=raw --no-walk --stdin< Then modify tignowalk by replacing the line calling tig to say: TIG_MAIN_CMD="git tignowalk-helper $tmp" tig </dev/tty ... and it should work. Maybe more git alias functionality can simplify the hack. -- Jonas Fonseca ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [tig] Feeding specific revisions to tig 2009-04-27 10:21 ` Jonas Fonseca @ 2009-04-28 8:15 ` Jean-Baptiste Quenot 2011-09-15 15:10 ` Jean-Baptiste Quenot 1 sibling, 0 replies; 11+ messages in thread From: Jean-Baptiste Quenot @ 2009-04-28 8:15 UTC (permalink / raw) To: Jonas Fonseca; +Cc: git 2009/4/27 Jonas Fonseca <jonas.fonseca@gmail.com>: > On Thu, Apr 23, 2009 at 16:55, Jean-Baptiste Quenot <jbq@caraldi.com> wrote: >> Restarting this old thread again. Starting from 0.13 the >> *tignowalk()* hack does not work anymore. What's the preferred way to >> feed specific revisions using stdin now? > > I don't know if it is preferred, but it works. First add a git alias: > > [alias] > tignowalk-helper = !git rev-list --pretty=raw --no-walk --stdin< > > Then modify tignowalk by replacing the line calling tig to say: > > TIG_MAIN_CMD="git tignowalk-helper $tmp" tig </dev/tty > > ... and it should work. Maybe more git alias functionality can > simplify the hack. Works a treat, thanks! I wonder how you managed to invent this trick though :-) -- Jean-Baptiste Quenot http://jbq.caraldi.com/ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [tig] Feeding specific revisions to tig 2009-04-27 10:21 ` Jonas Fonseca 2009-04-28 8:15 ` Jean-Baptiste Quenot @ 2011-09-15 15:10 ` Jean-Baptiste Quenot 1 sibling, 0 replies; 11+ messages in thread From: Jean-Baptiste Quenot @ 2011-09-15 15:10 UTC (permalink / raw) To: Jonas Fonseca; +Cc: git 2009/4/27 Jonas Fonseca <jonas.fonseca@gmail.com>: > Sorry for the slow reply ... > > On Thu, Apr 23, 2009 at 16:55, Jean-Baptiste Quenot <jbq@caraldi.com> wrote: >> Restarting this old thread again. Starting from 0.13 the >> *tignowalk()* hack does not work anymore. What's the preferred way to >> feed specific revisions using stdin now? > > I don't know if it is preferred, but it works. First add a git alias: > > [alias] > tignowalk-helper = !git rev-list --pretty=raw --no-walk --stdin< > > Then modify tignowalk by replacing the line calling tig to say: > > TIG_MAIN_CMD="git tignowalk-helper $tmp" tig </dev/tty > > ... and it should work. Maybe more git alias functionality can > simplify the hack. Restarting this thread again... it seems like every new version of tig breaks this usecase :-) Any idea how to feed specific revisions to tig 0.18? The trick does not work anymore, as support for TIG_MAIN_CMD was dropped. -- Jean-Baptiste Quenot ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-09-15 15:10 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-06-04 18:52 [tig] Feeding specific revisions to tig Jean-Baptiste Quenot 2008-06-04 19:29 ` Jeff King 2008-06-04 20:04 ` Jean-Baptiste Quenot 2008-06-04 23:08 ` Jeff King 2008-08-06 11:06 ` Jonas Fonseca 2008-08-08 21:19 ` Jeff King 2008-08-10 9:16 ` Jonas Fonseca 2009-04-23 14:55 ` Jean-Baptiste Quenot 2009-04-27 10:21 ` Jonas Fonseca 2009-04-28 8:15 ` Jean-Baptiste Quenot 2011-09-15 15:10 ` Jean-Baptiste Quenot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).