Commit 4c6f781
format-patch: refactor output selection
The --stdout and --output-directory options are mutually exclusive, but
it's hard to tell from reading the code. We have three separate
conditionals that check for use_stdout, and it's only after we've set up
the output_directory fully that we check whether the user also specified
--stdout.
Instead, let's check the exclusion explicitly first, then have a single
conditional that handles stdout versus an output directory. This is
slightly easier to follow now, and also will keep things sane when we
add another output mode in a future patch.
We'll add a few tests as well, covering the mutual exclusion and the
fact that we are not confused by a configured output directory.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 898f807 commit 4c6f781
2 files changed
+22
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1942 | 1942 | | |
1943 | 1943 | | |
1944 | 1944 | | |
1945 | | - | |
1946 | | - | |
| 1945 | + | |
| 1946 | + | |
1947 | 1947 | | |
1948 | | - | |
1949 | | - | |
1950 | | - | |
| 1948 | + | |
1951 | 1949 | | |
1952 | | - | |
1953 | | - | |
| 1950 | + | |
1954 | 1951 | | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
1955 | 1957 | | |
1956 | 1958 | | |
1957 | | - | |
1958 | | - | |
1959 | 1959 | | |
1960 | 1960 | | |
1961 | 1961 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1919 | 1919 | | |
1920 | 1920 | | |
1921 | 1921 | | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
1922 | 1935 | | |
1923 | 1936 | | |
1924 | 1937 | | |
| |||
0 commit comments