Re: [PATCH 1/6] pull: drop confusing prefix parameter of die_on_unclean_work_tree()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 29, 2016, 22:41 UTC
- Message-ID
- <xmqqvayj6vux.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <8fd43aabe0ee2427276b94928a4d9d8d2ef08613.1472137582.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
Show 26 quoted lines
> -static int has_unstaged_changes(const char *prefix)
> +static int has_unstaged_changes(void)
> {
> struct rev_info rev_info;
> int result;
>
> - init_revisions(&rev_info, prefix);
> + init_revisions(&rev_info, NULL);
> DIFF_OPT_SET(&rev_info.diffopt, IGNORE_SUBMODULES);
> DIFF_OPT_SET(&rev_info.diffopt, QUICK);
> diff_setup_done(&rev_info.diffopt);
> @@ -344,7 +344,7 @@ static int has_unstaged_changes(const char *prefix)
> /**
> * Returns 1 if there are uncommitted changes, 0 otherwise.
> */
> -static int has_uncommitted_changes(const char *prefix)
> +static int has_uncommitted_changes(void)
> {
> struct rev_info rev_info;
> int result;
> @@ -352,7 +352,7 @@ static int has_uncommitted_changes(const char *prefix)
> if (is_cache_unborn())
> return 0;
>
> - init_revisions(&rev_info, prefix);
> + init_revisions(&rev_info, NULL);I agree these are good changes. The prefix being ignored is a mere accident and a time-bomb waiting to go off. As you mentioned in the log message, we do not even want to pass a pathspec to limit the "is there anything modified" check, which may be affected with prefix, but we want a full-tree diff no matter where we started in these two functions.
Good.