{"thread":{"id":"9716","subject":"gitk from subdirectory","startedAt":"2007-08-31T04:29:31Z","lastAt":"2007-08-31T07:40:03Z","messageCount":9,"participants":["Junio C Hamano","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"51981","messageId":"7vabs85ntg.fsf@gitster.siamese.dyndns.org","threadId":"9716","inReplyTo":null,"subject":"gitk from subdirectory","fromName":"Junio C Hamano","fromEmail":"junkio@pobox.com","sentAt":"2007-08-31T04:29:31Z","receivedAt":"2007-08-31T04:29:31Z","isPatch":false,"sender":{"key":"junkio@pobox.com","avatar":null},"body":"Since commit cdaee5db165ba8bae8d3b524950e61666fc36a84 (gitk:\nImprove handling of -- and ambiguous arguments), running gitk\nfrom a subdirectory limits the displayed history with the\ncurrent directory as the path limiter, because it always passes\nthe \"--\" to the underlying git-rev-list.\n\nOne obvious side effect of this is if you create a new directory\nand cd to it, gitk will not show anything because no commit in\nthe history has touched the path you are currently in.\n\nI am wondering if this was intended behaviour change.  I think\nit makes sense to want an easy way to say \"what changed stuff in\nthe directory I am in?\" because presumably you are there because\nyou are interested in stuff in there.  But if you hard code \"--\"\nit is not easy to disable that and get the global log.\n\nYou always can say \"gitk -- .\" to limit commits to the current\ndirectory, so it might have been just an oversight.  In which\ncase, the attached patch may be needed to restore the old\nbehaviour.\n\nSigned-off-by: Junio C Hamano <junkio@pobox.com>\n---\n gitk |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 300fdce..b95b313 100755\n--- a/gitk\n+++ b/gitk\n@@ -92,8 +92,13 @@ proc start_rev_list {view} {\n \tset order \"--date-order\"\n     }\n     if {[catch {\n+\tif {[llength $viewfiles($view)] == 0} {\n+\t    set rlpaths {}\n+\t} else {\n+\t    set rlpaths [list \"--\" $viewfiles($view)]\n+\t}\n \tset fd [open [concat | git log -z --pretty=raw $order --parents \\\n-\t\t\t --boundary $viewargs($view) \"--\" $viewfiles($view)] r]\n+\t\t\t --boundary $viewargs($view) $rlpaths] r]\n     } err]} {\n \terror_popup \"Error executing git rev-list: $err\"\n \texit 1\n"},{"id":"51982","messageId":"7v642w5nmd.fsf@gitster.siamese.dyndns.org","threadId":"9716","inReplyTo":"7vabs85ntg.fsf@gitster.siamese.dyndns.org","subject":"Re: gitk from subdirectory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-31T04:33:46Z","receivedAt":"2007-08-31T04:33:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@pobox.com> writes:\n\n> Since commit cdaee5db165ba8bae8d3b524950e61666fc36a84 (gitk:\n> Improve handling of -- and ambiguous arguments), running gitk\n> from a subdirectory limits the displayed history with the ...\n\nFYI, I picked up your wish in the kernel list and have been\nexperimenting with this 5-liner whenever I refer to a commit in\nthe past:\n\n        #!/bin/sh\n        for commit\n        do\n                git show -s --pretty=oneline \"$commit\"\n        done |\n        sed -e 's/^[^ ]* /&(/' -e 's/$/)/'\n"},{"id":"51984","messageId":"alpine.LFD.0.999.0708302200160.25853@woody.linux-foundation.org","threadId":"9716","inReplyTo":"7vabs85ntg.fsf@gitster.siamese.dyndns.org","subject":"Re: gitk from subdirectory","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-08-31T05:08:26Z","receivedAt":"2007-08-31T05:08:26Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 30 Aug 2007, Junio C Hamano wrote:\n> \n> I am wondering if this was intended behaviour change.  I think\n> it makes sense to want an easy way to say \"what changed stuff in\n> the directory I am in?\" because presumably you are there because\n> you are interested in stuff in there.  But if you hard code \"--\"\n> it is not easy to disable that and get the global log.\n\nHmm. My reaction to this would be that it was a mistake to have a \ndifference between \n\n\tgit log --\n\nand\n\n\tgit log\n\nand that we should instead fix this at the argument parsing level. \n\nAnd then anybody who depended on the old \"--\" behaviour can just add a \".\" \nat the end.\n\nThat way there are no special cases.\n\nI realize that the \"--\" behaviour of git log was intentional, but seeing \nwhat it results in I think the intention was good, but stupid.\n\n\t\tLinus\n"},{"id":"51985","messageId":"7vsl6046gn.fsf@gitster.siamese.dyndns.org","threadId":"9716","inReplyTo":"alpine.LFD.0.999.0708302200160.25853@woody.linux-foundation.org","subject":"Re: gitk from subdirectory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-31T05:29:44Z","receivedAt":"2007-08-31T05:29:44Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> On Thu, 30 Aug 2007, Junio C Hamano wrote:\n>> \n>> I am wondering if this was intended behaviour change.  I think\n>> it makes sense to want an easy way to say \"what changed stuff in\n>> the directory I am in?\" because presumably you are there because\n>> you are interested in stuff in there.  But if you hard code \"--\"\n>> it is not easy to disable that and get the global log.\n>\n> Hmm. My reaction to this would be that it was a mistake to have a \n> difference between \n>\n> \tgit log --\n>\n> and\n>\n> \tgit log\n>\n> and that we should instead fix this at the argument parsing level. \n>\n> And then anybody who depended on the old \"--\" behaviour can just add a \".\" \n> at the end.\n>\n> That way there are no special cases.\n>\n> I realize that the \"--\" behaviour of git log was intentional, but seeing \n> what it results in I think the intention was good, but stupid.\n\nI haven't finished analysis yet, but I was reaching the same\nconclusion.\n\nv1.2.0 used to limit \"git rev-list\" to the current working\ndirectory, v1.3.0 and newer does not.  But they do when \"--\" is\ngiven.  This makes it impossible to do:\n\n\tcd Documentation\n\techo >master\n\tgit rev-list master\n        ... get \"ambiguous -- which do you mean?  rev, or\n\t... limited to path?\" error message\n        git rev-list master --\n        ... I do mean unlimited and dig from 'master'\n"},{"id":"51986","messageId":"7vir6w46bk.fsf@gitster.siamese.dyndns.org","threadId":"9716","inReplyTo":"7vsl6046gn.fsf@gitster.siamese.dyndns.org","subject":"Re: gitk from subdirectory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-31T05:32:47Z","receivedAt":"2007-08-31T05:32:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Linus Torvalds <torvalds@linux-foundation.org> writes:\n>\n>> I realize that the \"--\" behaviour of git log was intentional, but seeing \n>> what it results in I think the intention was good, but stupid.\n>\n> I haven't finished analysis yet, but I was reaching the same\n> conclusion.\n>\n> v1.2.0 used to limit \"git rev-list\" to the current working\n> directory, v1.3.0 and newer does not.  But they do when \"--\" is\n> given.  This makes it impossible to do:\n>\n> \tcd Documentation\n> \techo >master\n> \tgit rev-list master\n>         ... get \"ambiguous -- which do you mean?  rev, or\n> \t... limited to path?\" error message\n>         git rev-list master --\n>         ... I do mean unlimited and dig from 'master'\n\nFWIW bisect points at your commit ae563542bf10fa8c33abd2a354e4b28aca4264d7\n(First cut at libifying revlist generation) ;-).\n"},{"id":"51987","messageId":"7vejhk45q5.fsf@gitster.siamese.dyndns.org","threadId":"9716","inReplyTo":"alpine.LFD.0.999.0708302200160.25853@woody.linux-foundation.org","subject":"Re: gitk from subdirectory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-31T05:45:38Z","receivedAt":"2007-08-31T05:45:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"git log\" family of commands, even when run from a subdirectory,\ndo not limit the revision range with the current directory as\nthe path limiter, but with double-dash without any paths after\nit, i.e. \"git log --\" do so.  It was a mistake to have a\ndifference between \"git log --\" and \"git log\" introduced in\ncommit ae563542bf10fa8c33abd2a354e4b28aca4264d7 (First cut at\nlibifying revlist generation).\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n revision.c |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/revision.c b/revision.c\nindex 51fff0e..c193c3e 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -896,7 +896,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch\n \t\t\tcontinue;\n \t\targv[i] = NULL;\n \t\targc = i;\n-\t\trevs->prune_data = get_pathspec(revs->prefix, argv + i + 1);\n+\t\tif (argv[i + 1])\n+\t\t\trevs->prune_data = get_pathspec(revs->prefix, argv + i + 1);\n \t\tseen_dashdash = 1;\n \t\tbreak;\n \t}\n"},{"id":"51988","messageId":"7vabs845h3.fsf@gitster.siamese.dyndns.org","threadId":"9716","inReplyTo":"7vejhk45q5.fsf@gitster.siamese.dyndns.org","subject":"Re: gitk from subdirectory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-31T05:51:04Z","receivedAt":"2007-08-31T05:51:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> \"git log\" family of commands, even when run from a subdirectory,\n> do not limit the revision range with the current directory as\n> the path limiter, but with double-dash without any paths after\n> it, i.e. \"git log --\" do so.  It was a mistake to have a\n> difference between \"git log --\" and \"git log\" introduced in\n> commit ae563542bf10fa8c33abd2a354e4b28aca4264d7 (First cut at\n> libifying revlist generation).\n>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nIn case it was not obvious, this patch is meant to make the\nprevious patch from me to change gitk unneeded.\n"},{"id":"51996","messageId":"alpine.LFD.0.999.0708310038080.25853@woody.linux-foundation.org","threadId":"9716","inReplyTo":"7vejhk45q5.fsf@gitster.siamese.dyndns.org","subject":"Re: gitk from subdirectory","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-08-31T07:38:50Z","receivedAt":"2007-08-31T07:38:50Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 30 Aug 2007, Junio C Hamano wrote:\n\n> \"git log\" family of commands, even when run from a subdirectory,\n> do not limit the revision range with the current directory as\n> the path limiter, but with double-dash without any paths after\n> it, i.e. \"git log --\" do so.  It was a mistake to have a\n> difference between \"git log --\" and \"git log\" introduced in\n> commit ae563542bf10fa8c33abd2a354e4b28aca4264d7 (First cut at\n> libifying revlist generation).\n> \n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nLooks obviously correct.\n\nAcked-by: Linus Torvalds <torvalds@linux-foundation.org>\n\n\t\tLinus\n"},{"id":"51997","messageId":"7vk5rc2lv0.fsf@gitster.siamese.dyndns.org","threadId":"9716","inReplyTo":"alpine.LFD.0.999.0708310038080.25853@woody.linux-foundation.org","subject":"Re: gitk from subdirectory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-31T07:40:03Z","receivedAt":"2007-08-31T07:40:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> On Thu, 30 Aug 2007, Junio C Hamano wrote:\n>\n>> \"git log\" family of commands, even when run from a subdirectory,\n>> do not limit the revision range with the current directory as\n>> the path limiter, but with double-dash without any paths after\n>> it, i.e. \"git log --\" do so.  It was a mistake to have a\n>> difference between \"git log --\" and \"git log\" introduced in\n>> commit ae563542bf10fa8c33abd2a354e4b28aca4264d7 (First cut at\n>> libifying revlist generation).\n>> \n>> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n>\n> Looks obviously correct.\n>\n> Acked-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nThanks.\n"}]}