Commit b043307bfaa7ea801d19677c0cdb5d4074c0c234

Stefan Sperling 2021-09-14T14:15:49

make got status -s and -S options conflict

diff --git a/got/got.1 b/got/got.1
index c36aa31..8b3c89a 100644
--- a/got/got.1
+++ b/got/got.1
@@ -711,6 +711,9 @@ argument.
 Any combination of codes from the above list of possible status codes
 may be specified.
 For staged files, status codes displayed in either column will be matched.
+Cannot be used together with the
+.Fl S
+option.
 .It Fl S Ar status-codes
 Suppress the output of files with a modification status matching any of the
 single-character status codes contained in the
@@ -719,6 +722,9 @@ argument.
 Any combination of codes from the above list of possible status codes
 may be specified.
 For staged files, status codes displayed in either column will be matched.
+Cannot be used together with the
+.Fl s
+option.
 .El
 .Pp
 For compatibility with
diff --git a/got/got.c b/got/got.c
index 54b0e26..66d66fa 100644
--- a/got/got.c
+++ b/got/got.c
@@ -5341,9 +5341,13 @@ cmd_status(int argc, char *argv[])
 					    optarg[i]);
 				}
 			}
+			if (st.suppress)
+				option_conflict('s', 'S');
 			st.status_codes = optarg;
 			break;
 		case 'S':
+			if (st.status_codes != NULL && st.suppress == 0)
+				option_conflict('S', 's');
 			st.status_codes = optarg;
 			st.suppress = 1;
 			break;