Re: [PATCH 2/2] apply: add --intent-to-add
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- May 20, 2018, 06:34 UTC
- Message-ID
- <20180520063424.GA3062@duynguyen.home>
- In-Reply-To
- <xmqqo9hjc6er.fsf@gitster-ct.c.googlers.com>
On Mon, May 14, 2018 at 11:33:48AM +0900, Junio C Hamano wrote:
Show 27 quoted lines
> > diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt > > index 4ebc3d3271..2374f64b51 100644 > > --- a/Documentation/git-apply.txt > > +++ b/Documentation/git-apply.txt > > @@ -9,7 +9,7 @@ git-apply - Apply a patch to files and/or to the index > > SYNOPSIS > > -------- > > [verse] > > -'git apply' [--stat] [--numstat] [--summary] [--check] [--index] [--3way] > > +'git apply' [--stat] [--numstat] [--summary] [--check] [--index | --intent-to-add] [--3way] > > [--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse] > > [--allow-binary-replacement | --binary] [--reject] [-z] > > [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached] > > @@ -74,6 +74,13 @@ OPTIONS > > cached data, apply the patch, and store the result in the index > > without using the working tree. This implies `--index`. > > > > +--intent-to-add:: > > + When applying the patch only to the working tree, mark new > > + files to be added to the index later (see `--intent-to-add` > > + option in linkgit:git-add[1]). This option is ignored if > > + `--index` is present or the command is not run in a Git > > + repository. > > It may make sense to make it incompatible with "--index" like you > did, but how does this interact with "--cached" or "--3way"? It is > unclear from the above documentation.
I did check --cached and it mentioned about implying --index so I thought that was enough. Will elaborate a bit more.
Show 14 quoted lines
> > diff --git a/apply.c b/apply.c
> > index 7e5792c996..31d3e50401 100644
> > --- a/apply.c
> > +++ b/apply.c
> > @@ -136,6 +136,8 @@ int check_apply_state(struct apply_state *state, int force_apply)
> > state->apply = 0;
> > if (state->check_index && is_not_gitdir)
> > return error(_("--index outside a repository"));
> > + if (state->set_ita && is_not_gitdir)
> > + state->set_ita = 0;
>
> I think this should error out, just like one line above does.
> "I-t-a" is impossible without having the index, just like "--index"
> is impossible without having the index.I was hoping to put this in an alias that works both with or without a repository. Do you feel strongly about this? I may need to find another way to achieve that instead. -- Duy