Skip to content

Commit

Permalink
mv: be quiet about overwriting
Browse files Browse the repository at this point in the history
When a user asks us to force a mv and overwrite the
destination, we print a warning. However, since a typical
use would be:

  $ git mv one two
  fatal: destination exists, source=one, destination=two
  $ git mv -f one two
  warning: overwriting 'two'

this warning is just noise. We already know we're
overwriting; that's why we gave -f!

This patch silences the warning unless "--verbose" is given.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Dec 12, 2011
1 parent cd40b05 commit 534376c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin/mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
* check both source and destination
*/
if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
warning(_("overwriting '%s'"), dst);
if (verbose)
warning(_("overwriting '%s'"), dst);
bad = NULL;
} else
bad = _("Cannot overwrite");
Expand Down

0 comments on commit 534376c

Please sign in to comment.