git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Merlin Büge" <toni@bluenox07.de>
To: git@vger.kernel.org
Subject: Question about behaviour of git-checkout --patch option
Date: Mon, 25 May 2020 22:11:00 +0200	[thread overview]
Message-ID: <20200525221100.31d36d4d.toni@bluenox07.de> (raw)

Hi all!


I have a question about the behaviour of the git-checkout --patch/-p
option.

I have a small local git repository containing empty and non-empty
files. I wanted to replicate it in another directory and did the
following:

	cd <target_dir>
	git init
	git remote add origin <origin_dir>
	git fetch
	git branch --track master origin/master
	git checkout master .

This works like expected, I end up with a 1:1 copy of the original
worktree, including empty files. However, if I include the -p option in
the last step:

	git checkout -p master .

... I correctly get asked for any non-empty files/hunks if I want to
apply them - but not for empty ones. It would just display e.g.

	diff --git b/emptyfile a/emptyfile
	new file mode 100644
	index 0000000..e69de29

and then skip over it, asking for the next non-empty hunk.

Why does it skip over empty hunks?


Thanks!

-- 
Merlin Büge

             reply	other threads:[~2020-05-25 20:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25 20:11 Merlin Büge [this message]
2020-05-27  7:56 ` Question about behaviour of git-checkout --patch option Jeff King
2020-05-27  1:49   ` Johannes Schindelin
2020-05-27  8:00   ` Jeff King
2020-05-27 10:32     ` Merlin Büge
2020-05-27  4:48       ` Johannes Schindelin
2020-05-27 21:27         ` Merlin Büge

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=20200525221100.31d36d4d.toni@bluenox07.de \
    --to=toni@bluenox07.de \
    --cc=git@vger.kernel.org \
    /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).