Re: Strange behavior with Git add -p in version 2.13.3

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

 



Ben Reed <benvreed@xxxxxxxxx> writes:

> Hello, I updated Git to 2.13.3, and now selecting 's' to split a
> change on a call to `git add -p` is not working. It's showing the list
> of options as if 's' is not a valid choice...
>
> Particularly, I'm getting...
> Stage this hunk [y,n,q,a,d,/,e,?]? s
> y - stage this hunk
> n - do not stage this hunk
> q - quit; do not stage this hunk or any of the remaining ones
> a - stage this hunk and all later hunks in the file
> d - do not stage this hunk or any of the later hunks in the file
> g - select a hunk to go to
> / - search for a hunk matching the given regex
> j - leave this hunk undecided, see next undecided hunk
> J - leave this hunk undecided, see next hunk
> k - leave this hunk undecided, see previous undecided hunk
> K - leave this hunk undecided, see previous hunk
> s - split the current hunk into smaller hunks
> e - manually edit the current hunk
> ? - print help
>
> Is anyone else having this problem? Does anybody know how to resolve
> it? I'm running on macOS Version 10.12.5.

I do not think it is MacOSX specific.  I notice that the prompt does
not even offer 's' as a valid choice, which typically means that the
hunk you are looking at is not splittable.

A splittable hunk has more than one blocks of "+addition" and/or
"-deletion" lines separated by at least one " context" line.  If
your hunk looks like this, for example:

-- >8 --
diff --git a/COPYING b/COPYING
index 536e55524d..35c4dd4473 100644
--- a/COPYING
+++ b/COPYING
@@ -3,7 +3,7 @@
  is concerned is _this_ particular version of the license (ie v2, not
  v2.2 or v3.x or whatever), unless explicitly otherwise stated.

- HOWEVER, in order to allow a migration to GPLv3 if that seems like
+ However, in order to allow a migration to GPLv3 if that seems like
  a good idea, I also ask that people involved with the project make
  their preferences known. In particular, if you trust me to make that
  decision, you might note so in your copyright message, ie something
Stage this hunk [y,n,q,a,d,/,e,?]?
-- 8< --

you would not see 's' offered as a valid choice.  If you are looking
at a splittable hunk, on the other hand:

-- >8 --
diff --git a/COPYING b/COPYING
index 536e55524d..02a5c58938 100644
--- a/COPYING
+++ b/COPYING
@@ -3,9 +3,9 @@
  is concerned is _this_ particular version of the license (ie v2, not
  v2.2 or v3.x or whatever), unless explicitly otherwise stated.

- HOWEVER, in order to allow a migration to GPLv3 if that seems like
+ However, in order to allow a migration to GPLv3 if that seems like
  a good idea, I also ask that people involved with the project make
- their preferences known. In particular, if you trust me to make that
+ *their* preferences known. In particular, if you trust me to make that
  decision, you might note so in your copyright message, ie something
  like

Stage this hunk [y,n,q,a,d,/,s,e,?]?
-- 8< --

you will see 's' offered as a valid choice.





[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