{"thread":{"id":"41221","subject":"git add -p doesn't respect diff.context","startedAt":"2016-01-20T06:35:23Z","lastAt":"2016-02-04T08:02:40Z","messageCount":2,"participants":["Mike Hommey","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"276414","messageId":"20160120063523.GA26490@glandium.org","threadId":"41221","inReplyTo":null,"subject":"git add -p doesn't respect diff.context","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2016-01-20T06:35:23Z","receivedAt":"2016-01-20T06:35:23Z","isPatch":false,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"Hi,\n\nWhen doing git add -p, the default of 3 context lines is used, ignoring\nthe diff.context.\n\ngit add -p is using git-diff-files, and diff.context is being read in\ngit_diff_ui_config, so the comment above that function applies:\n/*\n * These are to give UI layer defaults.\n * The core-level commands such as git-diff-files should\n * never be affected by the setting of diff.renames\n * the user happens to have in the configuration file.\n */\n\nI guess the question is whether it's diff-files or add -p that should\nhonor diff.context. Or should it have its own separate config?\n\nMike\n"},{"id":"277375","messageId":"20160204080239.GC21161@sigill.intra.peff.net","threadId":"41221","inReplyTo":"20160120063523.GA26490@glandium.org","subject":"Re: git add -p doesn't respect diff.context","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-02-04T08:02:40Z","receivedAt":"2016-02-04T08:02:40Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 20, 2016 at 03:35:23PM +0900, Mike Hommey wrote:\n\n> When doing git add -p, the default of 3 context lines is used, ignoring\n> the diff.context.\n> \n> git add -p is using git-diff-files, and diff.context is being read in\n> git_diff_ui_config, so the comment above that function applies:\n> /*\n>  * These are to give UI layer defaults.\n>  * The core-level commands such as git-diff-files should\n>  * never be affected by the setting of diff.renames\n>  * the user happens to have in the configuration file.\n>  */\n> \n> I guess the question is whether it's diff-files or add -p that should\n> honor diff.context. Or should it have its own separate config?\n\nI think it must be \"add -p\", as otherwise we risk breaking scripts which\ntry to build on diff-tree but can't handle extra context (though I have\nto admit that unlike something like diff.color, it would be a pretty\npoor consumer of a diff that couldn't handle varying context).\n\nWe already do something similar with diff.algorithm. I think you could\nprobably just cargo-cult the handling of $diff_algorithm in\ngit-add--interactive.perl.\n\nIt might also make a nice GSoC microproject.\n\n-Peff\n"}]}