Re: [PATCH v2 4/4] add-patch: add diff.context command line overrides

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13/05/2025 14:52, Phillip Wood wrote:
diff --git a/builtin/stash.c b/builtin/stash.c
[...]
@@ -1826,8 +1831,15 @@ static int push_stash(int argc, const char **argv, const char *prefix,           die(_("the option '%s' requires '%s'"), "--pathspec-file- nul", "--pathspec-from-file");
      }
+    if (!patch_mode) {
+        if (add_p_opt.context != -1)
+            die(_("the option '%s' requires '%s'"), "--unified", "-- patch");
+        if (add_p_opt.interhunkcontext != -1)
+            die(_("the option '%s' requires '%s'"), "--inter-hunk- context", "--patch");
+    }
+

This needs to die on invalid context values as "git stash" seems to
ignore the exit code of the subprocess that checks for negative values.

Looking more closely the problem is that it quits if there are no changes to stash before validating -U or --inter-hunk-context. I think it should validate the options before checking if there is anything to stash.

Best Wishes

Phillip





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux