diff options
author | Matthieu Moy <Matthieu.Moy@imag.fr> | 2013-01-28 10:16:33 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-01-28 10:31:35 -0800 |
commit | 0fa2eb530fb748774c5b2f309a471cf048b8d9d9 (patch) | |
tree | b40c4546d4513d0f56fd3c0ea1b04c7692b0fa67 /builtin/fetch.c | |
parent | b344bb19358bcf8cf62c28ce205fdfd8acfa6b6b (diff) | |
download | git-0fa2eb530fb748774c5b2f309a471cf048b8d9d9.tar.gz git-0fa2eb530fb748774c5b2f309a471cf048b8d9d9.tar.xz |
add: warn when -u or -A is used without pathspec
Most Git commands that can be used with or without pathspec operate
tree-wide by default, the pathspec being used to restrict their
scope. A few exceptions are: 'git grep', 'git clean', 'git add -u'
and 'git add -A'. When run in a subdirectory without pathspec, they
operate only on paths in the current directory.
The inconsistency of 'git add -u' and 'git add -A' is particularly
problematic since other 'git add' subcommands (namely 'git add -p'
and 'git add -e') are tree-wide by default. It also means that "git
add -u && git commit" will record a state that is different from
what is recorded with "git commit -a".
Flipping the default now is unacceptable, so let's start training
users to type 'git add -u|-A :/' or 'git add -u|-A .' explicitly, to
prepare for the next steps:
* forbid 'git add -u|-A' without pathspec (like 'git add' without
option)
* much later, maybe, re-allow 'git add -u|-A' without pathspec, that
will add all tracked and modified files, or all files, tree-wide.
A nice side effect of this patch is that it makes the :/ magic
pathspec easier to discover for users.
When the command is called from the root of the tree, there is no
ambiguity and no need to change the behavior, hence no need to warn.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch.c')
0 files changed, 0 insertions, 0 deletions