{"thread":{"id":"12114","subject":"[BUG] git filter-branch failed to suppress a file with an accentuated letter in the filename","startedAt":"2008-02-15T16:56:55Z","lastAt":"2008-02-16T12:48:12Z","messageCount":9,"participants":["Remi Vanicat","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"68815","messageId":"87bq6iw42w.dlv@maison.homelinux.org","threadId":"12114","inReplyTo":null,"subject":"[BUG] git filter-branch failed to suppress a file with an accentuated letter in the filename","fromName":"Remi Vanicat","fromEmail":"vanicat@debian.org","sentAt":"2008-02-15T16:56:55Z","receivedAt":"2008-02-15T16:56:55Z","isPatch":false,"sender":{"key":"vanicat@debian.org","avatar":"https://gravatar.com/avatar/cd491a7f4c221349809a60f88fc21326b97cce2a705e318898aa74851db92409?d=mp&s=160"},"body":"git filter-branch --tree-filter has a problem with filename with\naccentuated letter:\n\n$ git add foo/baré\n$ git commit -m \"adding a file with an accent\"\nCreated initial commit b27ae97: adding a file with an accent\n 0 files changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 \"foo/bar\\303\\251\"\n$ git filter-branch --tree-filter \"rm -rf foo\"\nRewrite b27ae977459379e4e7eee1a3d523f908903ea6ae (1/1)\nWARNING: Ref 'refs/heads/master' is unchanged\n\nthere the foo/baré file still exists, but:\n$ git filter-branch --tree-filter \"rm -rf foo; git add -u\"\nwill suppress the said file from history.\n\nThe culprit seem to be those line of filter-branch: (around line 279) \n\t\tgit diff-index -r $commit | cut -f 2- | tr '\\012' '\\000' | \\\n\t\t\txargs -0 git update-index --add --replace --remove\ngit diff-index giving the filename as \"foo/bar\\303\\251\"\n\n\n-- \nRémi Vanicat\n"},{"id":"68824","messageId":"7vd4qygld8.fsf@gitster.siamese.dyndns.org","threadId":"12114","inReplyTo":"87bq6iw42w.dlv@maison.homelinux.org","subject":"Re: [BUG] git filter-branch failed to suppress a file with an accentuated letter in the filename","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-15T17:50:11Z","receivedAt":"2008-02-15T17:50:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Remi Vanicat <vanicat@debian.org> writes:\n\n> The culprit seem to be those line of filter-branch: (around line 279) \n> \t\tgit diff-index -r $commit | cut -f 2- | tr '\\012' '\\000' | \\\n> \t\t\txargs -0 git update-index --add --replace --remove\n> git diff-index giving the filename as \"foo/bar\\303\\251\"\n\nI have to wonder in what century filter-branch was written ;-)\n\nShouldn't those two lines be:\n\n\tgit diff-index -r --name-only $commit |\n        git update-index --add --replace --remove --stdin\n\nthese days, without any of the cut and cruft?\n"},{"id":"68825","messageId":"alpine.LSU.1.00.0802151811240.30505@racer.site","threadId":"12114","inReplyTo":"7vd4qygld8.fsf@gitster.siamese.dyndns.org","subject":"Re: [BUG] git filter-branch failed to suppress a file with an accentuated letter in the filename","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-15T18:12:57Z","receivedAt":"2008-02-15T18:12:57Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 15 Feb 2008, Junio C Hamano wrote:\n\n> Remi Vanicat <vanicat@debian.org> writes:\n> \n> > The culprit seem to be those line of filter-branch: (around line 279) \n> > \t\tgit diff-index -r $commit | cut -f 2- | tr '\\012' '\\000' | \\\n> > \t\t\txargs -0 git update-index --add --replace --remove\n> > git diff-index giving the filename as \"foo/bar\\303\\251\"\n> \n> I have to wonder in what century filter-branch was written ;-)\n> \n> Shouldn't those two lines be:\n> \n> \tgit diff-index -r --name-only $commit |\n>         git update-index --add --replace --remove --stdin\n> \n> these days, without any of the cut and cruft?\n\nMaybe even using \"-z\" in both cases?\n\nHaving said that, I do not understand why the old code did not work.  Will \nhave a look later today.\n\nCiao,\nDscho\n"},{"id":"68847","messageId":"7vwsp5g8to.fsf@gitster.siamese.dyndns.org","threadId":"12114","inReplyTo":"alpine.LSU.1.00.0802151811240.30505@racer.site","subject":"Re: [BUG] git filter-branch failed to suppress a file with an accentuated letter in the filename","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-15T22:21:07Z","receivedAt":"2008-02-15T22:21:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> I have to wonder in what century filter-branch was written ;-)\n>> \n>> Shouldn't those two lines be:\n>> \n>> \tgit diff-index -r --name-only $commit |\n>>         git update-index --add --replace --remove --stdin\n>> \n>> these days, without any of the cut and cruft?\n>\n> Maybe even using \"-z\" in both cases?\n>\n> Having said that, I do not understand why the old code did not work.  Will \n> have a look later today.\n\nThe reason mine does not have to use -z is because both end\nknows how to C-quote paths under non-z mode.\n\nNow you mention it, it certainly is a bit puzzling why the old\none did not work.\n"},{"id":"68858","messageId":"alpine.LSU.1.00.0802160308550.30505@racer.site","threadId":"12114","inReplyTo":"7vwsp5g8to.fsf@gitster.siamese.dyndns.org","subject":"Re: [BUG] git filter-branch failed to suppress a file with an accentuated letter in the filename","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-16T03:09:28Z","receivedAt":"2008-02-16T03:09:28Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 15 Feb 2008, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > Having said that, I do not understand why the old code did not work.  \n> > Will have a look later today.\n> \n> Now you mention it, it certainly is a bit puzzling why the old one did \n> not work.\n\nOkay, so I will not manage today.  Tomorrow is another day.\n\nCiao,\nDscho\n"},{"id":"68875","messageId":"87tzk9tnnu.dlv@maison.homelinux.org","threadId":"12114","inReplyTo":"7vd4qygld8.fsf@gitster.siamese.dyndns.org","subject":"Re: [BUG] git filter-branch failed to suppress a file with an accentuated letter in the filename","fromName":"Remi Vanicat","fromEmail":"vanicat@debian.org","sentAt":"2008-02-16T06:34:29Z","receivedAt":"2008-02-16T06:34:29Z","isPatch":false,"sender":{"key":"vanicat@debian.org","avatar":"https://gravatar.com/avatar/cd491a7f4c221349809a60f88fc21326b97cce2a705e318898aa74851db92409?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Remi Vanicat <vanicat@debian.org> writes:\n>\n>> The culprit seem to be those line of filter-branch: (around line 279) \n>> \t\tgit diff-index -r $commit | cut -f 2- | tr '\\012' '\\000' | \\\n>> \t\t\txargs -0 git update-index --add --replace --remove\n>> git diff-index giving the filename as \"foo/bar\\303\\251\"\n>\n> I have to wonder in what century filter-branch was written ;-)\n>\n> Shouldn't those two lines be:\n>\n> \tgit diff-index -r --name-only $commit |\n>         git update-index --add --replace --remove --stdin\n\nThat solve the bug for me.\n-- \nRémi Vanicat\n"},{"id":"68883","messageId":"7v63wpcp4o.fsf@gitster.siamese.dyndns.org","threadId":"12114","inReplyTo":"87tzk9tnnu.dlv@maison.homelinux.org","subject":"Re: [BUG] git filter-branch failed to suppress a file with an accentuated letter in the filename","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-16T07:54:47Z","receivedAt":"2008-02-16T07:54:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Not just those two lines but the next two lines were also very\nold fashioned.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * Could you try this one?\n\n git-filter-branch.sh     |    9 +++++----\n t/t7003-filter-branch.sh |   14 ++++++++++++++\n 2 files changed, 19 insertions(+), 4 deletions(-)\n\ndiff --git a/git-filter-branch.sh b/git-filter-branch.sh\nindex ff716ca..49e13f0 100755\n--- a/git-filter-branch.sh\n+++ b/git-filter-branch.sh\n@@ -276,10 +276,11 @@ while read commit parents; do\n \t\teval \"$filter_tree\" < /dev/null ||\n \t\t\tdie \"tree filter failed: $filter_tree\"\n \n-\t\tgit diff-index -r $commit | cut -f 2- | tr '\\012' '\\000' | \\\n-\t\t\txargs -0 git update-index --add --replace --remove\n-\t\tgit ls-files -z --others | \\\n-\t\t\txargs -0 git update-index --add --replace --remove\n+\t\t(\n+\t\t\tgit diff-index -r --name-only $commit\n+\t\t\tgit ls-files --others\n+\t\t) |\n+\t\tgit update-index --add --replace --remove --stdin\n \tfi\n \n \teval \"$filter_index\" < /dev/null ||\ndiff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh\nindex 5f60b22..868babc 100755\n--- a/t/t7003-filter-branch.sh\n+++ b/t/t7003-filter-branch.sh\n@@ -165,4 +165,18 @@ test_expect_success '\"map\" works in commit filter' '\n \tgit rev-parse --verify master\n '\n \n+test_expect_success 'Name needing quotes' '\n+\n+\tgit checkout -b rerere A &&\n+\tmkdir foo &&\n+\tname=\"れれれ\" &&\n+\t>foo/$name &&\n+\tgit add foo &&\n+\tgit commit -m \"Adding a file\" &&\n+\tgit filter-branch --tree-filter \"rm -fr foo\" &&\n+\t! git ls-files --error-unmatch \"foo/$name\" &&\n+\ttest $(git rev-parse --verify rerere) != $(git rev-parse --verify A)\n+\n+'\n+\n test_done\n"},{"id":"68887","messageId":"87pruxtige.dlv@maison.homelinux.org","threadId":"12114","inReplyTo":"7v63wpcp4o.fsf@gitster.siamese.dyndns.org","subject":"Re: [BUG] git filter-branch failed to suppress a file with an accentuated letter in the filename","fromName":"Remi Vanicat","fromEmail":"vanicat@debian.org","sentAt":"2008-02-16T08:26:57Z","receivedAt":"2008-02-16T08:26:57Z","isPatch":false,"sender":{"key":"vanicat@debian.org","avatar":"https://gravatar.com/avatar/cd491a7f4c221349809a60f88fc21326b97cce2a705e318898aa74851db92409?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Not just those two lines but the next two lines were also very\n> old fashioned.\n>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>\n>  * Could you try this one?\n\nIt work both on my real word case and on my tests git repositories. \n\n\n-- \nRémi Vanicat\n"},{"id":"68899","messageId":"alpine.LSU.1.00.0802161246350.30505@racer.site","threadId":"12114","inReplyTo":"alpine.LSU.1.00.0802160308550.30505@racer.site","subject":"Re: [BUG] git filter-branch failed to suppress a file with an accentuated letter in the filename","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-16T12:48:12Z","receivedAt":"2008-02-16T12:48:12Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 16 Feb 2008, Johannes Schindelin wrote:\n\n> On Fri, 15 Feb 2008, Junio C Hamano wrote:\n> \n> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> > \n> > > Having said that, I do not understand why the old code did not work.  \n> > > Will have a look later today.\n> > \n> > Now you mention it, it certainly is a bit puzzling why the old one did \n> > not work.\n> \n> Okay, so I will not manage today.  Tomorrow is another day.\n\nAh, now I understand.  The accents are shown quoted, but xargs does not \nknow how to unquote them.  Cute.\n\nCiao,\nDscho\n"}]}