Does git apply --reject/--include use --verbose by default?

1.6k views Asked by At

I see

git apply --reject
git apply --include

always printing full info about which are files considered and rejected from patch file passed. So it seems --verbose mode used by git when --reject option passed.

Is --verbose option printing any other info that's not being printing by --reject option? I didn't find any relevant details in git-apply documentation too.

git apply --index change-89ded3243ea944156abb9d1c44173d998a4aed59..b3645cd3600b7d1c728c84333b48a20ce5c4eb29.patch
Done applying sandbox package.

git apply --reject change-89ded3243ea944156abb9d1c44173d998a4aed59..b3645cd3600b7d1c728c84333b48a20ce5c4eb29.patch
Checking patch support/gobuild/helpers/python.py...
Checking patch support/gobuild/helpers/target.py...
Checking patch support/gobuild/py/__init__.py...
Checking patch support/gobuild/py/autotools.py...
Checking patch support/gobuild/specs/cayman_pycrypto.py...
Checking patch support/gobuild/targets/cayman_pycrypto.py...
warning: support/gobuild/targets/cayman_pycrypto.py has type 100644, expected 100755
Applied patch support/gobuild/helpers/python.py cleanly.
Applied patch support/gobuild/helpers/target.py cleanly.
Applied patch support/gobuild/py/__init__.py cleanly.
Applied patch support/gobuild/py/autotools.py cleanly.
Applied patch support/gobuild/specs/cayman_pycrypto.py cleanly.
Applied patch support/gobuild/targets/cayman_pycrypto.py cleanly.
Done applying sandbox package.
1

There are 1 answers

1
torek On BEST ANSWER

The --include option has no effect on verbosity levels: it simply says that the patching process should apply changes to the named files, which of course implies that it should not apply changes to other files. That is, a patch might mention files this.txt, that.py, and README. If you say "include changes to this.txt and README" you are implying "please don't make any changes to that.py".

The --verbose option is actually a counter: used once, it raises the verbosity level from zero or "normal" to 1 or "verbose", and used twice it raises it beyond that. However, there's no special action for higher numbers here (some Git commands do have multiple levels of verbosity, e.g., git branch has two). There is a special negative-1 level but you cannot set that yourself (it's used automatically when git am applies multiple patches, with commits after each apply).

The --reject option automatically raises the verbosity level to at least 1. Hence, internally, the sequence of options:

git apply --verbose --reject

means "set the verbosity level to 1, and also set the reject mode", while:

git apply --reject --verbose

means "set the verbosity level to 2, and also set the reject mode".

Long form options longopt usually allow the use of no-longopt to clear them. (There are some exceptions, but this is not an exception.) Therefore:

git apply --reject --no-verbose

will enable reject mode while setting the verbosity level back to zero ("normal" verbosity: some things are still printed).