{"thread":{"id":"22896","subject":"[PATCH 1/3] hash-object: support --stdin-paths with --no-filters","startedAt":"2010-03-03T20:10:21Z","lastAt":"2010-03-05T11:05:39Z","messageCount":9,"participants":["Erik Faye-Lund","Eric Wong","Dmitry Potapov","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"136092","messageId":"1267647023-2604-1-git-send-email-kusmabite@gmail.com","threadId":"22896","inReplyTo":null,"subject":"[PATCH 1/3] hash-object: support --stdin-paths with --no-filters","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2010-03-03T20:10:21Z","receivedAt":"2010-03-03T20:10:21Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n Documentation/git-hash-object.txt |    2 +-\n builtin-hash-object.c             |    8 ++++----\n t/t1007-hash-object.sh            |   18 ++++++++++++++----\n 3 files changed, 19 insertions(+), 9 deletions(-)\n\ndiff --git a/Documentation/git-hash-object.txt b/Documentation/git-hash-object.txt\nindex 479fce4..6904739 100644\n--- a/Documentation/git-hash-object.txt\n+++ b/Documentation/git-hash-object.txt\n@@ -10,7 +10,7 @@ SYNOPSIS\n --------\n [verse]\n 'git hash-object' [-t <type>] [-w] [--path=<file>|--no-filters] [--stdin] [--] <file>...\n-'git hash-object' [-t <type>] [-w] --stdin-paths < <list-of-paths>\n+'git hash-object' [-t <type>] [-w] --stdin-paths [--no-filters] < <list-of-paths>\n \n DESCRIPTION\n -----------\ndiff --git a/builtin-hash-object.c b/builtin-hash-object.c\nindex 6a5f5b5..080af1a 100644\n--- a/builtin-hash-object.c\n+++ b/builtin-hash-object.c\n@@ -33,6 +33,8 @@ static void hash_object(const char *path, const char *type, int write_object,\n \thash_fd(fd, type, write_object, vpath);\n }\n \n+static int no_filters;\n+\n static void hash_stdin_paths(const char *type, int write_objects)\n {\n \tstruct strbuf buf = STRBUF_INIT, nbuf = STRBUF_INIT;\n@@ -44,7 +46,8 @@ static void hash_stdin_paths(const char *type, int write_objects)\n \t\t\t\tdie(\"line is badly quoted\");\n \t\t\tstrbuf_swap(&buf, &nbuf);\n \t\t}\n-\t\thash_object(buf.buf, type, write_objects, buf.buf);\n+\t\thash_object(buf.buf, type, write_objects,\n+\t\t    no_filters ? NULL : buf.buf);\n \t}\n \tstrbuf_release(&buf);\n \tstrbuf_release(&nbuf);\n@@ -60,7 +63,6 @@ static const char *type;\n static int write_object;\n static int hashstdin;\n static int stdin_paths;\n-static int no_filters;\n static const char *vpath;\n \n static const struct option hash_object_options[] = {\n@@ -100,8 +102,6 @@ int cmd_hash_object(int argc, const char **argv, const char *prefix)\n \t\t\terrstr = \"Can't specify files with --stdin-paths\";\n \t\telse if (vpath)\n \t\t\terrstr = \"Can't use --stdin-paths with --path\";\n-\t\telse if (no_filters)\n-\t\t\terrstr = \"Can't use --stdin-paths with --no-filters\";\n \t}\n \telse {\n \t\tif (hashstdin > 1)\ndiff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh\nindex fd98e44..dd32432 100755\n--- a/t/t1007-hash-object.sh\n+++ b/t/t1007-hash-object.sh\n@@ -65,10 +65,6 @@ test_expect_success \"Can't use --path with --stdin-paths\" '\n \techo example | test_must_fail git hash-object --stdin-paths --path=foo\n '\n \n-test_expect_success \"Can't use --stdin-paths with --no-filters\" '\n-\techo example | test_must_fail git hash-object --stdin-paths --no-filters\n-'\n-\n test_expect_success \"Can't use --path with --no-filters\" '\n \ttest_must_fail git hash-object --no-filters --path=foo\n '\n@@ -141,6 +137,20 @@ test_expect_success 'check that --no-filters option works' '\n \tgit config --unset core.autocrlf\n '\n \n+test_expect_success 'check that --no-filters option works with --stdin-paths' '\n+\techo fooQ | tr Q \"\\\\015\" >file0 &&\n+\tcp file0 file1 &&\n+\techo \"file0 -crlf\" >.gitattributes &&\n+\techo \"file1 crlf\" >>.gitattributes &&\n+\tgit config core.autocrlf true &&\n+\tfile0_sha=$(git hash-object file0) &&\n+\tfile1_sha=$(git hash-object file1) &&\n+\ttest \"$file0_sha\" != \"$file1_sha\" &&\n+\tnofilters_file1=$(echo \"file1\" | git hash-object --stdin-paths --no-filters) &&\n+\ttest \"$file0_sha\" = \"$nofilters_file1\" &&\n+\tgit config --unset core.autocrlf\n+'\n+\n pop_repo\n \n for args in \"-w --stdin\" \"--stdin -w\"; do\n-- \n1.7.0.1.141.gc5984a\n"},{"id":"136093","messageId":"1267647023-2604-2-git-send-email-kusmabite@gmail.com","threadId":"22896","inReplyTo":"1267647023-2604-1-git-send-email-kusmabite@gmail.com","subject":"[PATCH 2/3] git-svn: support fetch with autocrlf on","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2010-03-03T20:10:22Z","receivedAt":"2010-03-03T20:10:22Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"Before commit d3c9634e, performing a \"git svn rebase\" that fetched a\nchange containing CRLFs corrupted the git-svn meta-data. This was\nworked around in d3c9634e by setting core.autocrlf to \"false\" in the\nper-repo config when initing the clone. However, if the config\nvariable was later changed, the corruption would still occur.\n\nThis patch tries to fix it while allowing core.autocrlf to be\nenabled, by disabling filters when when hashing.\n\ngit-svn is currently the only call-site for hash_and_insert_object\n(apart from the test-suite), so changing it should be safe.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n perl/Git.pm |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 970fe43..1926dc9 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -842,7 +842,7 @@ sub _open_hash_and_insert_object_if_needed {\n \n \t($self->{hash_object_pid}, $self->{hash_object_in},\n \t $self->{hash_object_out}, $self->{hash_object_ctx}) =\n-\t\tcommand_bidi_pipe(qw(hash-object -w --stdin-paths));\n+\t\tcommand_bidi_pipe(qw(hash-object -w --stdin-paths --no-filters));\n }\n \n sub _close_hash_and_insert_object {\n-- \n1.7.0.1.141.gc5984a\n"},{"id":"136094","messageId":"1267647023-2604-3-git-send-email-kusmabite@gmail.com","threadId":"22896","inReplyTo":"1267647023-2604-1-git-send-email-kusmabite@gmail.com","subject":"[PATCH 3/3] Revert \"git-svn: always initialize with core.autocrlf=false\"","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2010-03-03T20:10:23Z","receivedAt":"2010-03-03T20:10:23Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"git-svn rebase used to have issues with CRLF conversion. Since these issues\nhave been fixed, we can safely revert the work-around that disables CRLF\nconversion.\n\nThis reverts commit d3c9634eacdcaa71cbd69a160e6f4e80ddb7ab63.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n\ngit-svn dcommit uses diff-tree (which does not apply CRLF conversion) to\ngenerate SVN commits, so there never were any CRLF conversion issues when\ncommiting in the first place.\n\n git-svn.perl |    1 -\n 1 files changed, 0 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex b7c03b6..b8a3fc2 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -369,7 +369,6 @@ sub do_git_init_db {\n \t\tcommand_noisy(@init_db);\n \t\t$_repository = Git->repository(Repository => \".git\");\n \t}\n-\tcommand_noisy('config', 'core.autocrlf', 'false');\n \tmy $set;\n \tmy $pfx = \"svn-remote.$Git::SVN::default_repo_id\";\n \tforeach my $i (keys %icv) {\n-- \n1.7.0.1.141.gc5984a\n"},{"id":"136096","messageId":"40aa078e1003031216l5d164654ta8ff7ea6c8cf2162@mail.gmail.com","threadId":"22896","inReplyTo":"1267647023-2604-3-git-send-email-kusmabite@gmail.com","subject":"Re: [PATCH 3/3] Revert \"git-svn: always initialize with core.autocrlf=false\"","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2010-03-03T20:16:25Z","receivedAt":"2010-03-03T20:16:25Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Wed, Mar 3, 2010 at 9:10 PM, Erik Faye-Lund <kusmabite@googlemail.com> wrote:\n> git-svn dcommit uses diff-tree (which does not apply CRLF conversion) to\n> generate SVN commits, so there never were any CRLF conversion issues when\n> commiting in the first place.\n>\n\nUhm, this comment is slightly wrong. diff-tree is used to find out if\nthere's a change in a file at all. cat_blob(), which in turn uses \"git\ncat-file\", is used to get the file contents.\n\nSorry for the noise.\n\n-- \nErik \"kusma\" Faye-Lund\n"},{"id":"136143","messageId":"20100304095350.GB12885@dcvr.yhbt.net","threadId":"22896","inReplyTo":"40aa078e1003031216l5d164654ta8ff7ea6c8cf2162@mail.gmail.com","subject":"Re: [PATCH 3/3] Revert \"git-svn: always initialize with core.autocrlf=false\"","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-03-04T09:53:50Z","receivedAt":"2010-03-04T09:53:50Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Erik Faye-Lund <kusmabite@googlemail.com> wrote:\n> On Wed, Mar 3, 2010 at 9:10 PM, Erik Faye-Lund <kusmabite@googlemail.com> wrote:\n> > git-svn dcommit uses diff-tree (which does not apply CRLF conversion) to\n> > generate SVN commits, so there never were any CRLF conversion issues when\n> > commiting in the first place.\n> \n> Uhm, this comment is slightly wrong. diff-tree is used to find out if\n> there's a change in a file at all. cat_blob(), which in turn uses \"git\n> cat-file\", is used to get the file contents.\n> \n> Sorry for the noise.\n\nHi Erik,\n\nYes, diff-tree is only used to find changed paths, not the actual\ncontent changes.  git svn always uses entire blobs from cat-file.\n\nSo cat-file won't do CRLF conversions at all, meaning this change is\nsafe for previously created repos, correct?  If so, consider patches\n2/3 and 3/3 acked by me.\n\n1/3 looks alright, too, but I'll wait for Dmitry as I've never hacked\non (builtin-)hash-object.c\n\n-- \nEric Wong\n"},{"id":"136144","messageId":"40aa078e1003040224v57bbea92w83a01f95390f5f1b@mail.gmail.com","threadId":"22896","inReplyTo":"20100304095350.GB12885@dcvr.yhbt.net","subject":"Re: [PATCH 3/3] Revert \"git-svn: always initialize with core.autocrlf=false\"","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2010-03-04T10:24:02Z","receivedAt":"2010-03-04T10:24:02Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Thu, Mar 4, 2010 at 10:53 AM, Eric Wong <normalperson@yhbt.net> wrote:\n> Erik Faye-Lund <kusmabite@googlemail.com> wrote:\n>> On Wed, Mar 3, 2010 at 9:10 PM, Erik Faye-Lund <kusmabite@googlemail.com> wrote:\n>> > git-svn dcommit uses diff-tree (which does not apply CRLF conversion) to\n>> > generate SVN commits, so there never were any CRLF conversion issues when\n>> > commiting in the first place.\n>>\n>> Uhm, this comment is slightly wrong. diff-tree is used to find out if\n>> there's a change in a file at all. cat_blob(), which in turn uses \"git\n>> cat-file\", is used to get the file contents.\n>>\n>> Sorry for the noise.\n>\n> Hi Erik,\n>\n> Yes, diff-tree is only used to find changed paths, not the actual\n> content changes.  git svn always uses entire blobs from cat-file.\n>\n> So cat-file won't do CRLF conversions at all, meaning this change is\n> safe for previously created repos, correct?\n\nCorrect.\n\nBut existing git-svn clones (that was cloned after d3c9634 was\nintroduced) will still have autocrlf-conversions disabled anyway\n(because d3c9634 disabled it), so people shouldn't see any difference\nbefore either re-cloning or manually enabling core.autocrlf in the\nrepo. I don't think there's any way to automatically remove the config\noption that d3c9634 set up without potentially stepping on the user's\ntoes. And I have a gut-feeling that it would be wrong thing to do\nanyway.\n\n-- \nErik \"kusma\" Faye-Lund\n"},{"id":"136151","messageId":"20100304143542.GA2313@dpotapov.dyndns.org","threadId":"22896","inReplyTo":"1267647023-2604-1-git-send-email-kusmabite@gmail.com","subject":"Re: [PATCH 1/3] hash-object: support --stdin-paths with --no-filters","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2010-03-04T14:35:42Z","receivedAt":"2010-03-04T14:35:42Z","isPatch":true,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Wed, Mar 03, 2010 at 09:10:21PM +0100, Erik Faye-Lund wrote:\n> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n> ---\n>  Documentation/git-hash-object.txt |    2 +-\n>  builtin-hash-object.c             |    8 ++++----\n>  t/t1007-hash-object.sh            |   18 ++++++++++++++----\n>  3 files changed, 19 insertions(+), 9 deletions(-)\n\nThe patch looks good to me.\n\nThank you,\nDmitry\n"},{"id":"136161","messageId":"7vmxyo6jpd.fsf@alter.siamese.dyndns.org","threadId":"22896","inReplyTo":"1267647023-2604-1-git-send-email-kusmabite@gmail.com","subject":"Re: [PATCH 1/3] hash-object: support --stdin-paths with --no-filters","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-04T18:11:10Z","receivedAt":"2010-03-04T18:11:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erik Faye-Lund <kusmabite@googlemail.com> writes:\n\n> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n\nThis looks good to me.  I could queue this myself and ask Eric to Ack the\nother two and queue them on top of it, but it probably is easier for Eric\nif I said\n\n    Acked-by: Junio C Hamano <gitster@pobox.com>\n\nnow, and ask him to queue the three-patch series including this one in his\ntree, and then tell me to pull the finished result from his tree when he\nis satisfied.  That way it would be easier for Eric to test and/or polish\nif needed.\n\nEric, are you Ok with that plan?\n"},{"id":"136199","messageId":"20100305110539.GA14650@dcvr.yhbt.net","threadId":"22896","inReplyTo":"7vmxyo6jpd.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/3] hash-object: support --stdin-paths with --no-filters","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-03-05T11:05:39Z","receivedAt":"2010-03-05T11:05:39Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Erik Faye-Lund <kusmabite@googlemail.com> writes:\n> \n> > Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n> \n> This looks good to me.  I could queue this myself and ask Eric to Ack the\n> other two and queue them on top of it, but it probably is easier for Eric\n> if I said\n> \n>     Acked-by: Junio C Hamano <gitster@pobox.com>\n> \n> now, and ask him to queue the three-patch series including this one in his\n> tree, and then tell me to pull the finished result from his tree when he\n> is satisfied.  That way it would be easier for Eric to test and/or polish\n> if needed.\n> \n> Eric, are you Ok with that plan?\n\nYes, thanks Junio. I've acked and pushed out this series\nto git://git.bogomips.org/git-svn along with a trivial fix\nby Michael.\n\nThanks all.\n\nErik Faye-Lund (3):\n      hash-object: support --stdin-paths with --no-filters\n      git-svn: support fetch with autocrlf on\n      Revert \"git-svn: always initialize with core.autocrlf=false\"\n\nMichael J Gruber (1):\n      git-svn: make git svn --version work again\n\n-- \nEric Wong\n"}]}