From 2e60ebdc146a05a03738c1d6ab770e56e7b2b913 Mon Sep 17 00:00:00 2001 From: Thomas Koutcher Date: Mon, 3 Jun 2024 22:27:15 +0200 Subject: [PATCH] Fix staging with `diff.noprefix` and `--no-prefix` --- NEWS.adoc | 2 +- src/stage.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS.adoc b/NEWS.adoc index d6a78f070..15280d6fa 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -6,7 +6,7 @@ master Bug fixes: - - Fix parsing of `--no-prefix` argument. + - Fix various issues with `diff.noprefix` and `--no-prefix`. Improvements: diff --git a/src/stage.c b/src/stage.c index 348cea362..646b08af6 100644 --- a/src/stage.c +++ b/src/stage.c @@ -205,6 +205,8 @@ stage_apply_chunk(struct view *view, struct line *chunk, struct line *single, if (!diff_hdr) return false; + if (opt_diff_noprefix) + apply_argv[argc++] = "-p0"; if (!revert) apply_argv[argc++] = "--cached"; if (revert || stage_line_type == LINE_STAT_STAGED)