{"thread":{"id":"23019","subject":"[PATCH] git-filter-branch.txt: mention absolute path for scripts in --tree-filter","startedAt":"2010-03-15T08:26:17Z","lastAt":"2010-03-15T17:14:19Z","messageCount":5,"participants":["Jari Aalto","Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"136811","messageId":"87vdcy7zyu.fsf@jondo.cante.net","threadId":"23019","inReplyTo":null,"subject":"[PATCH] git-filter-branch.txt: mention absolute path for scripts in --tree-filter","fromName":"Jari Aalto","fromEmail":"jari.aalto@cante.net","sentAt":"2010-03-15T08:26:17Z","receivedAt":"2010-03-15T08:26:17Z","isPatch":true,"sender":{"key":"jari.aalto@cante.net","avatar":"https://avatars.githubusercontent.com/u/34601?v=4"},"body":"\nSigned-off-by: Jari Aalto <jari.aalto@cante.net>\n---\n Documentation/git-filter-branch.txt |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt\nindex 020028c..01bd0ad 100644\n--- a/Documentation/git-filter-branch.txt\n+++ b/Documentation/git-filter-branch.txt\n@@ -91,6 +91,9 @@ OPTIONS\n \tis then used as-is (new files are auto-added, disappeared files\n \tare auto-removed - neither .gitignore files nor any other ignore\n \trules *HAVE ANY EFFECT*!).\n++\n+In case the <command> is a shell script, provide an absolute path.\n+An example: --tree-filter 'sh /path/to/filter.sh'\n \n --index-filter <command>::\n \tThis is the filter for rewriting the index.  It is similar to the\n-- \n1.7.0\n"},{"id":"136820","messageId":"4B9DFE36.3010707@viscovery.net","threadId":"23019","inReplyTo":"87vdcy7zyu.fsf@jondo.cante.net","subject":"Re: [PATCH] git-filter-branch.txt: mention absolute path for scripts in --tree-filter","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-03-15T09:30:30Z","receivedAt":"2010-03-15T09:30:30Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Jari Aalto schrieb:\n> Signed-off-by: Jari Aalto <jari.aalto@cante.net>\n> ---\n>  Documentation/git-filter-branch.txt |    3 +++\n>  1 files changed, 3 insertions(+), 0 deletions(-)\n> \n> diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt\n> index 020028c..01bd0ad 100644\n> --- a/Documentation/git-filter-branch.txt\n> +++ b/Documentation/git-filter-branch.txt\n> @@ -91,6 +91,9 @@ OPTIONS\n>  \tis then used as-is (new files are auto-added, disappeared files\n>  \tare auto-removed - neither .gitignore files nor any other ignore\n>  \trules *HAVE ANY EFFECT*!).\n> ++\n> +In case the <command> is a shell script, provide an absolute path.\n> +An example: --tree-filter 'sh /path/to/filter.sh'\n\nYour choice of words is ambiguous: The --tree-filter is not the name of a\nshell script, but rather the shell script itself; the example you gave is\njust a shell script that happens to run only a shell on a file whose name\nmust be specified as an absolute path.\n\nBut doesn't the recommendation to use absolute paths apply not only to\n--tree-filters, but\n\n- to all filters;\n\n- to all references to external files that the filters make.\n\nI'm saying \"recommendation\" because git-filter-branch does not switch\ndirectory ad lib., so theoretically, it would be possible to use relative\npaths, even though the base of the relative paths would be non-obvious\nbecause it is from inside a temporary directory named \".git-rewrite/t\"\nthat is allocated next to .git.\n\n-- Hannes\n"},{"id":"136826","messageId":"87k4td95xm.fsf@jondo.cante.net","threadId":"23019","inReplyTo":"4B9DFE36.3010707@viscovery.net","subject":"Re: [PATCH] git-filter-branch.txt: mention absolute path for scripts in --tree-filter","fromName":"Jari Aalto","fromEmail":"jari.aalto@cante.net","sentAt":"2010-03-15T11:32:05Z","receivedAt":"2010-03-15T11:32:05Z","isPatch":true,"sender":{"key":"jari.aalto@cante.net","avatar":"https://avatars.githubusercontent.com/u/34601?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> Jari Aalto schrieb:\n>\n>> Signed-off-by: Jari Aalto <jari.aalto@cante.net>\n>> ---\n>>  Documentation/git-filter-branch.txt |    3 +++\n>>  1 files changed, 3 insertions(+), 0 deletions(-)\n>> \n>> diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt\n>> index 020028c..01bd0ad 100644\n>> --- a/Documentation/git-filter-branch.txt\n>> +++ b/Documentation/git-filter-branch.txt\n>> @@ -91,6 +91,9 @@ OPTIONS\n>>  \tis then used as-is (new files are auto-added, disappeared files\n>>  \tare auto-removed - neither .gitignore files nor any other ignore\n>>  \trules *HAVE ANY EFFECT*!).\n>> ++\n>> +In case the <command> is a shell script, provide an absolute path.\n>> +An example: --tree-filter 'sh /path/to/filter.sh'\n>\n> Your choice of words is ambiguous: The --tree-filter is not the name of a\n> shell script, but rather the shell script itself; the example you gave is\n> just a shell script that happens to run only a shell on a file whose name\n> must be specified as an absolute path.\n\nFull context was:\n\n    --tree-filter <command>::\n            This is the filter for rewriting the tree and its contents.\n            The argument is evaluated in shell with the working\n            directory set to the root of the checked out tree.  The new tree\n            is then used as-is (new files are auto-added, disappeared files\n            are auto-removed - neither .gitignore files nor any other ignore\n            rules *HAVE ANY EFFECT*!).\n    +\n    In case the <command> is a shell script, provide an absolute path.\n    An example: --tree-filter 'sh /path/to/filter.sh'\n\n\n>\n> But doesn't the recommendation to use absolute paths apply not only to\n> --tree-filters, but\n>\n> - to all filters;\n>\n> - to all references to external files that the filters make.\n\nI don't know.\n\n> I'm saying \"recommendation\" because git-filter-branch does not switch\n> directory ad lib., so theoretically, it would be possible to use relative\n> paths, even though the base of the relative paths would be non-obvious\n> because it is from inside a temporary directory named \".git-rewrite/t\"\n> that is allocated next to .git.\n\nThe problem was that I was trying to use a sell script for athe\nmanipulation:\n\n    cd <gir repo>\n    git filter-branch  --tree-filter \"sh ../filter.sh\" HEAD\n\nWhich didn't. It needed absolute path:\n\n    cd <gir repo>\n    git filter-branch  --tree-filter \"sh $(pwd)/filter.sh\" HEAD\n\nAnd that didn't work quit either. Script was run, but paths weren't no\nlonger relative to the \"working dir\" I was cd'd to:\n\n    rm  file \\\n        dir/file \\\n        dir/file \\\n        ..\n\nSo, someone please explain how the paths should be expressed in shell\nscript and we'll improve the docs.\n\nJari\n"},{"id":"136828","messageId":"4B9E20BD.3090705@viscovery.net","threadId":"23019","inReplyTo":"87k4td95xm.fsf@jondo.cante.net","subject":"Re: [PATCH] git-filter-branch.txt: mention absolute path for scripts in --tree-filter","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-03-15T11:57:49Z","receivedAt":"2010-03-15T11:57:49Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Jari Aalto schrieb:\n> J6t:\n>> Your choice of words is ambiguous: The --tree-filter is not the name of a\n>> shell script, but rather the shell script itself; the example you gave is\n>> just a shell script that happens to run only a shell on a file whose name\n>> must be specified as an absolute path.\n> \n> Full context was:\n> \n>     --tree-filter <command>::\n>             This is the filter for rewriting the tree and its contents.\n>             The argument is evaluated in shell with the working\n>             directory set to the root of the checked out tree.  The new tree\n>             is then used as-is (new files are auto-added, disappeared files\n>             are auto-removed - neither .gitignore files nor any other ignore\n>             rules *HAVE ANY EFFECT*!).\n>     +\n>     In case the <command> is a shell script, provide an absolute path.\n>     An example: --tree-filter 'sh /path/to/filter.sh'\n\nI am complaining that you say \"In case the <command> is a shell\nscript...\".  There are no other cases; <command> is always a shell script.\n\nWhat you meant to say is: \"If you have your filter written down in a\nseparate shell script, you must invoke it using an absolute path, for\nexample, --tree-filter '/path/to/filter.sh'\".\n\n>> But doesn't the recommendation to use absolute paths apply not only to\n>> --tree-filters, but\n>>\n>> - to all filters;\n>>\n>> - to all references to external files that the filters make.\n> \n> I don't know.\n\nIt was a rethoric question. The hint about paths to files outside the\nworking directory should go to the general description of filters.\n\n>     cd <gir repo>\n>     git filter-branch  --tree-filter \"sh $(pwd)/filter.sh\" HEAD\n> \n> And that didn't work quit either. Script was run, but paths weren't no\n> longer relative to the \"working dir\" I was cd'd to:\n> \n>     rm  file \\\n>         dir/file \\\n>         dir/file \\\n>         ..\n\nI don't understand what you are trying to say, and I don't understand why\nit helped to run\n\n  git filter-branch  --tree-filter \"sh /the/git/repo/filter.sh\" HEAD\n\nwhen the above did not work - from filter-branch's POV there is simply no\ndifference between the two invocations.\n\n-- Hannes\n\nPS: Please keep Cc list.\n"},{"id":"136848","messageId":"7viq8xse1g.fsf@alter.siamese.dyndns.org","threadId":"23019","inReplyTo":"4B9E20BD.3090705@viscovery.net","subject":"Re: [PATCH] git-filter-branch.txt: mention absolute path for scripts in --tree-filter","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-15T17:14:19Z","receivedAt":"2010-03-15T17:14:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> Jari Aalto schrieb:\n>> J6t:\n>>> But doesn't the recommendation to use absolute paths apply not only to\n>>> --tree-filters, but\n>>> ...\n>> I don't know.\n>\n> It was a rethoric question. The hint about paths to files outside the\n> working directory should go to the general description of filters.\n\nIt is a good point.\n\nDo people involved in filter-branch feel the implementation/interface is\nstable enough these days to allow us to add this to the first paragraph of\nthe \"Filters\" description in the documentation?  It currently talks about\nthe environment variables exported for the use of filter programs, and \"In\nwhich directory will my filter run? --- I need to know it when I want to\nreference filesystem entities using relative paths in my filter.\" would\nfit well.\n"}]}