git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] apply: add --intent-to-add
Date: Sun, 20 May 2018 08:34:24 +0200	[thread overview]
Message-ID: <20180520063424.GA3062@duynguyen.home> (raw)
In-Reply-To: <xmqqo9hjc6er.fsf@gitster-ct.c.googlers.com>

On Mon, May 14, 2018 at 11:33:48AM +0900, Junio C Hamano wrote:
> > 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.

> > 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

  reply	other threads:[~2018-05-20  6:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-13 17:54 [PATCH 1/2] diff: turn --ita-invisible-in-index on by default Nguyễn Thái Ngọc Duy
2018-05-13 17:54 ` [PATCH 2/2] apply: add --intent-to-add Nguyễn Thái Ngọc Duy
2018-05-14  2:33   ` Junio C Hamano
2018-05-20  6:34     ` Duy Nguyen [this message]
2018-05-21  3:14       ` Junio C Hamano
2018-05-25  3:39 ` [PATCH 1/2] diff: turn --ita-invisible-in-index on by default Jonathan Nieder
2018-05-25 14:30   ` Duy Nguyen
2018-05-25 16:43     ` Jonathan Nieder
2018-05-25 16:59       ` Duy Nguyen
2018-05-26 12:08 ` [PATCH v2 0/4] Fix i-t-a entries in git-diff and git-apply Nguyễn Thái Ngọc Duy
2018-05-26 12:08   ` [PATCH v2 1/4] diff: ignore --ita-[in]visible-in-index when diffing worktree-to-tree Nguyễn Thái Ngọc Duy
2018-05-27  7:18     ` Eric Sunshine
2018-05-26 12:08   ` [PATCH v2 2/4] diff: turn --ita-invisible-in-index on by default Nguyễn Thái Ngọc Duy
2018-05-26 12:08   ` [PATCH v2 3/4] t2203: add a test about "diff HEAD" case Nguyễn Thái Ngọc Duy
2018-05-26 12:08   ` [PATCH v2 4/4] apply: add --intent-to-add Nguyễn Thái Ngọc Duy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180520063424.GA3062@duynguyen.home \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).