{"thread":{"id":"58948","subject":"Whitepace parameter for git restore","startedAt":"2022-12-14T13:36:30Z","lastAt":"2022-12-14T23:39:46Z","messageCount":2,"participants":["Niklas Volcz","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"469012","messageId":"CAGWBhH7ZiU_tJGj_UAB29v9Eq6C2Q-1_0YxLLN16LaEOcuV1Xw@mail.gmail.com","threadId":"58948","inReplyTo":null,"subject":"Whitepace parameter for git restore","fromName":"Niklas Volcz","fromEmail":"niklas.volcz@gmail.com","sentAt":"2022-12-14T13:36:11Z","receivedAt":"2022-12-14T13:36:30Z","isPatch":false,"sender":{"key":"niklas.volcz@gmail.com","avatar":null},"body":"Is there a way to pass apply.whitespace when using \"git restore\" like\nhow it is done for git apply? I believe this might be a bug/missing\nfeature.\nI have apply.whitespace=fix in my user git config. This usually works\nfine but I was working on a patch for a project today which is using\ntabs and spaces which messed up the commit. In order to avoid\ncluttering the diff with whitespace changes I tried to remove the\nwhitespace changes with \"git restore -p\nsrc/the-file-with-tabs-and-spaces.sh\" but it seems that this causes\ngit to fix the whitespaces again due to the configuration. I worked\naround this by setting a repo local config with\n\"apply.whitespace=warn\" but I wonder if there shouldn't be an\n--whitespace flag for git restore like it is for git apply. Is this a\nbug?\n\nBest regards,\nNiklas\n"},{"id":"469056","messageId":"xmqqmt7pv9ky.fsf@gitster.g","threadId":"58948","inReplyTo":"CAGWBhH7ZiU_tJGj_UAB29v9Eq6C2Q-1_0YxLLN16LaEOcuV1Xw@mail.gmail.com","subject":"Re: Whitepace parameter for git restore","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-12-14T23:39:41Z","receivedAt":"2022-12-14T23:39:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Niklas Volcz <niklas.volcz@gmail.com> writes:\n\n> Is there a way to pass apply.whitespace when using \"git restore\" like\n> how it is done for git apply? I believe this might be a bug/missing\n> feature.\n> I have apply.whitespace=fix in my user git config. This usually works\n> fine but I was working on a patch for a project today which is using\n> tabs and spaces which messed up the commit. In order to avoid\n> cluttering the diff with whitespace changes I tried to remove the\n> whitespace changes with \"git restore -p\n> src/the-file-with-tabs-and-spaces.sh\" but it seems that this causes\n> git to fix the whitespaces again due to the configuration. I worked\n> around this by setting a repo local config with\n> \"apply.whitespace=warn\" but I wonder if there shouldn't be an\n> --whitespace flag for git restore like it is for git apply. Is this a\n> bug?\n\nIt is arguable what should qualify as a \"bug\", but \"restore\" or\n\"checkout\" are primarily \"grab the recorded blob out of the object\nstore and materialize its contents as a whole in a file in the\nworking tree\", and there is no place for features that are about\npatch application like \"apply to fix whitespace\" to come in.  So a\ncommand line option --whitespace=warn would not be a very good fit.\n\nHaving said that, I wonder if you can cheat by\n\n    $ git -c apply.whitespace=ignore restore -p ...\n\n"}]}