# No edit option when "git add --patch" a new file

2 messages from 2020-09-08 to 2020-09-09. Participants: Yuchen Ying, Phillip Wood.
Thread: https://gitlist.dev/t/54208

## Yuchen Ying, 2020-09-08 16:16

Subject: No edit option when "git add --patch" a new file
Message-ID: <CAF6j4hcSEhNvS-DYgNLNn3TdH1vkhgHZRC0fqWer_XM0PQxgYA@mail.gmail.com>
URL: https://gitlist.dev/e/CAF6j4hcSEhNvS-DYgNLNn3TdH1vkhgHZRC0fqWer_XM0PQxgYA%40mail.gmail.com

```
Hi list,

I was attempting to "add --patch" a newly created file but the "edit"
option is not provided.

Steps to reproduce this problem:

$ echo "test\ntest" > test
$ git add -N test
$ git add -p test

Expected: e is an option
Got:

$ git add -p
diff --git a/terraform/test b/terraform/test
index 0000000..992533b
--- /dev/null
+++ b/terraform/test
new file mode 100644
@@ -0,0 +1,2 @@
+asdf
+asdf
(1/1) Stage addition [y,n,q,a,d,?]? e
Sorry, cannot edit this hunk

```

## Phillip Wood, 2020-09-09 09:33

Subject: Re: No edit option when "git add --patch" a new file
Message-ID: <4eb2c8ec-3ee3-5097-9cff-b650caf2c888@gmail.com>
URL: https://gitlist.dev/e/4eb2c8ec-3ee3-5097-9cff-b650caf2c888%40gmail.com
In-Reply-To: <CAF6j4hcSEhNvS-DYgNLNn3TdH1vkhgHZRC0fqWer_XM0PQxgYA@mail.gmail.com>

```
On 08/09/2020 17:16, Yuchen Ying wrote:
> Hi list,
> 
> I was attempting to "add --patch" a newly created file but the "edit"
> option is not provided.
> 
> Steps to reproduce this problem:
> 
> $ echo "test\ntest" > test
> $ git add -N test
> $ git add -p test
> 
> Expected: e is an option
> Got:
> 
> $ git add -p
> diff --git a/terraform/test b/terraform/test
> index 0000000..992533b
> --- /dev/null
> +++ b/terraform/test
> new file mode 100644
> @@ -0,0 +1,2 @@
> +asdf
> +asdf
> (1/1) Stage addition [y,n,q,a,d,?]? e
> Sorry, cannot edit this hunk

Thanks for taking the time to report this issue. I'm currently working
on a fix which I hope to post later today as the issue was previously
reported at
https://public-inbox.org/git/CAB+jsAW_+NTJjDLG9uMrf4cc5rcwHLD5kTLk7QgvFCgryb22Gw@mail.gmail.com/
I'll Cc you on the patch

Best Wishes

Phillip


```
