Sorry for late reply, I was on vacation. Now I'm back and ready to
continue :)
Thanks for your review!
On 21.01.2020 20:36, Junio C Hamano wrote:
Decisions taken for simplicity:
1) It is not allowed to pass pathspec in both args and file.
`if (!argc)` block was adapted to work with --pathspec-from-file. For
that, I also had to parse pathspec earlier. Now it happens before
`read_cache()` / `hold_locked_index()` / `setup_work_tree()`, which
sounds fine to me.
That is not an explanation nor justification.
I'm not exactly sure what are you suggesting. My best guess is that you
want to remove "`if (!argc)` block was adapted" paragraph from commit
message? I thought about it and it feels wrong to leave this change
unexplained. Or are you suggesting to reword it? If so, please give a hint.
In case of empty pathspec, there is now a clear error message instead
of showing usage.
Hmph, "git rm --pathspec-from-file=/dev/null" would say "nothing
specified, nothing removed" and it makes perfect sense, but I am not
sure "git rm" that gives the same message is better than the output
by usage_with_options(builtin_rm_usage, builtin_rm_options).
What feels wrong to me is when I make a mistake and git just slams me
with usage, and then it's up to me to figure what could be wrong. I
myself struggled to find a mistake a couple times (in similar cases, not
in this specific one) and didn't like the experience.
This could be a lot worse when there's no mistake, just the file was
empty - but you already agreed that showing a new error message is
reasonable with '--pathspec-from-file'.
Still, without '--pathspec-from-file', it should still be better to
point to a specific error rather then "here's usage and try to find a
difference". I have reworded the error message in V2 in hopes that it
will be less controversial.
If you still don't like it, I will change it to only show the new error
with '--pathspec-from-file'.
+static int ignore_unmatch = 0, pathspec_file_nul = 0;
+static char *pathspec_from_file = NULL;
We may want to clean these "explicitly initialize to 0/NULL" up at
some point. The clean-up itself would not be in the scope of this
patch, of course, but not making it worse is something this patch
can do to help.
Changed in V2.