Message ID | 20250204-creation-factor-v1-0-9988d594a018@bootlin.com (mailing list archive) |
---|---|
Headers | show |
Series | prep, diff: support overriding range-diff creation factor | expand |
On Tue, Feb 04, 2025 at 05:44:15PM +0100, Antonin Godard wrote: > git range-diff allows to override the creation factor, which is > sometimes useful to adjust for seeing different diff outputs. This is > not possible with the current code, and is also not configurable from > git config. > > Add an option to diff and prep to override the default creation factor > value. Does it make more sense to have a more generic way to provide arguments to pass to git-range-diff instead of duplicating options? E.g. something like: b4 diff [...] --range-diff-opts="--creation-factor=80 --left-only" We'd have to re-parse them with shlex to make sure they are safe, but it seems like a better approach, no? -K
Hi Konstantin, On Thu Feb 6, 2025 at 7:09 PM CET, Konstantin Ryabitsev wrote: > On Tue, Feb 04, 2025 at 05:44:15PM +0100, Antonin Godard wrote: >> git range-diff allows to override the creation factor, which is >> sometimes useful to adjust for seeing different diff outputs. This is >> not possible with the current code, and is also not configurable from >> git config. >> >> Add an option to diff and prep to override the default creation factor >> value. > > Does it make more sense to have a more generic way to provide arguments to > pass to git-range-diff instead of duplicating options? > > E.g. something like: > > b4 diff [...] --range-diff-opts="--creation-factor=80 --left-only" > > We'd have to re-parse them with shlex to make sure they are safe, but it seems > like a better approach, no? Right, did not think about it, but I like that approach too. It will avoid having to make b4's options expand too much over time. For shlex, were you thinking of shlex.quote()? Do you have any example in b4 that uses shlex for the same purpose? I will try to work on that when I have some time, thanks for the suggestion! Antonin
git range-diff allows to override the creation factor, which is sometimes useful to adjust for seeing different diff outputs. This is not possible with the current code, and is also not configurable from git config. Add an option to diff and prep to override the default creation factor value. I can update the doc in a v2 if needed. Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> --- Antonin Godard (2): diff: add a creation factor argument prep: add creation-factor argument src/b4/command.py | 4 ++++ src/b4/diff.py | 7 ++++++- src/b4/ez.py | 6 ++++-- 3 files changed, 14 insertions(+), 3 deletions(-) --- base-commit: d23a9a2d5684369710bd2e416e41159193df3756 change-id: 20250127-creation-factor-ce8069a0bb3c Best regards,