Skip to contentSkip to conversation

git diagnose with invalid CLI argument does not report error

DISCUSSION Sheik 4 participants 5 messages Oct 25, 2023 – Oct 26, 2023

lore
Share & tools
lore

Sheik

author
#0 lore raw

Hi Maintainers,

Running git diagnose with an invalid CLI argument in a valid Git directory does not report error. Expected behaviour would be that it reports an error.

#Example shell commands which should have reported an error but continues to succeed

cd $ToAGitDirectory

git diagnose mod

git diagnose mode

git diagnose mode=all

Thanks

Sheik

[System Info]
git version:
git version 2.42.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 6.5.0-2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.6-1 (2023-10-07) x86_64 compiler info: gnuc: 13.2
libc info: glibc: 2.37
$SHELL (typically, interactive shell): /bin/bash

[Enabled Hooks]

#1 lore raw
Quoted 9 lines · Sheik

Hi Maintainers,

Running git diagnose with an invalid CLI argument in a valid Git directory does not report error. Expected behaviour would be that it reports an error.

#Example shell commands which should have reported an error but continues to succeed

Quoted 8 lines

cd $ToAGitDirectory

git diagnose mod

git diagnose mode

git diagnose mode=all

I can reproduce this only when the invalid parameter is a normal word:

```
$ git diagnose huh
```

But the command errors out on invalid flag:

```
$ git diagnose -m
```
Cc 'ing people who recently worked on builtin/diagnose.c for help.

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#2 lore raw
Quoted 15 lines · Bagas Sanjaya
Quoted 5 lines · Sheik

Hi Maintainers,

Running git diagnose with an invalid CLI argument in a valid Git directory does not report error. Expected behaviour would be that it reports an error.

Quoted 7 lines

#Example shell commands which should have reported an error but continues to succeed

cd $ToAGitDirectory
git diagnose mod
git diagnose mode
git diagnose mode=all

I can reproduce this only when the invalid parameter is a normal word:

Quoted 8 lines
```
$ git diagnose huh
```
But the command errors out on invalid flag:
```
$ git diagnose -m
```
Cc 'ing people who recently worked on builtin/diagnose.c for help.

A patch by Emily to fix this has been submitted[v4].

[v4]: https://lore.kernel.org/git/[email protected]/

#3 lore raw

To be clear, that patch was for git-bugreport and doesn't cover git-diagnose. I assume the fix ends up being pretty similar though.

Quoted 30 lines · Eric Sunshine
Quoted 15 lines · Bagas Sanjaya
Quoted 5 lines · Sheik

Hi Maintainers,

Running git diagnose with an invalid CLI argument in a valid Git directory does not report error. Expected behaviour would be that it reports an error.

Quoted 7 lines

#Example shell commands which should have reported an error but continues to succeed

cd $ToAGitDirectory
git diagnose mod
git diagnose mode
git diagnose mode=all

I can reproduce this only when the invalid parameter is a normal word:

Quoted 8 lines
```
$ git diagnose huh
```
But the command errors out on invalid flag:
```
$ git diagnose -m
```
Cc 'ing people who recently worked on builtin/diagnose.c for help.

A patch by Emily to fix this has been submitted[v4].

[v4]: https://lore.kernel.org/git/[email protected]/

#4 lore raw
Quoted 6 lines · Emily Shaffer
Quoted 5 lines · Eric Sunshine
Quoted 4 lines · Bagas Sanjaya
Quoted 2 lines · Sheik

Running git diagnose with an invalid CLI argument in a valid Git directory does not report error. Expected behaviour would be that it reports an error.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I can reproduce this only when the invalid parameter is a normal word:
Cc:'ing people who recently worked on builtin/diagnose.c for help.

A patch by Emily to fix this has been submitted[v4].

To be clear, that patch was for git-bugreport and doesn't cover git-diagnose. I assume the fix ends up being pretty similar though.

My bad.