Jeff King <p...@peff.net> writes:

> +static const char *add_would_remove_warning = N_(
> +/* indent for "warning: " */
> +         "In Git 2.0, 'git add <pathspec>...' will also update the\n"
> +"index for paths removed from the working tree that match the given\n"
> +"pathspec. If you want to 'add' only changed or newly created paths,\n"
> +"say 'git add --no-all <pathspec>...' instead.\n");
> +
>  static void warn_add_would_remove(const char *path)
>  {
> -     warning(_("In Git 2.0, 'git add <pathspec>...' will also update the\n"
> -               "index for paths removed from the working tree that match\n"
> -               "the given pathspec. If you want to 'add' only changed\n"
> -               "or newly created paths, say 'git add --no-all <pathspec>...'"
> -               " instead.\n\n"
> -               "'%s' would be removed from the index without --no-all."),
> -             path);
> +     static int warned_once;
> +     if (!warned_once++)
> +             warning(_(add_would_remove_warning));
> +     warning("did not stage removal of '%s'", path);
>  }

Would "add --dry-run" say this, too?

>  static void update_callback(struct diff_queue_struct *q,
> @@ -84,10 +88,8 @@ static void update_callback(struct diff_queue_struct *q,
>                       }
>                       break;
>               case DIFF_STATUS_DELETED:
> -                     if (data->warn_add_would_remove) {
> +                     if (data->warn_add_would_remove)
>                               warn_add_would_remove(path);
> -                             data->warn_add_would_remove = 0;
> -                     }
>                       if (data->flags & ADD_CACHE_IGNORE_REMOVAL)
>                               break;
>                       if (!(data->flags & ADD_CACHE_PRETEND))
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to