git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Tilman Vogel <tilman.vogel@web.de>
To: git@vger.kernel.org
Subject: [BUG] git-cherry false-positive on upstream new-line change at end-of-file
Date: Thu, 23 Jul 2020 16:42:08 +0200	[thread overview]
Message-ID: <2639321.dTF8K4C05n@alien.lan> (raw)

Thank you for filling out a Git bug report! 
Please answer the following questions to help us understand your issue. 

What did you do before the bug happened? (Steps to reproduce your issue) 

I was working on two branches "master" and "feature". On "master" I  
"git cherry-pick feature" in order to pick the latest commit from 
"feature".  

What did you expect to happen? (Expected behavior) 

When I run "git cherry master feature" the picked commit is 
marked with "-". 

What happened instead? (Actual behavior) 

When I run "git cherry master feature" the picked commit is 
marked with "+". 

What's different between what you expected and what actually happened? 

Because the commit has just been picked, it should be marked as "-". 
The actual behavior claims the commit had not been picked. 

Anything else you want to add: 

It is important to note that the only change, I did on master after 
branching "feature", was to add a missing newline at the end of the 
file that I changed on "feature".  

If I replay the same scenario with a file that has a newline at the end 
and I am only adding a newline at the beginning of it on master, cherry 
gives the expected "-" after cherry-picking. 

Please see this simple example: 

> git clone https://github.com/tvogel/cherry-broken.git 
> cd cherry-broken 

# see broken behaviour: 
> git cherry origin/master origin/feature 
+ 26f77def8f1380cc3fd08ebc3f70652da79f1a2e 

# check that patch-id is actually the same: 
> git show --patch origin/master | git patch-id 
ca5d666a572ec32bff9cec17b97d611316f89236 
0725b090dd82f2e6f9949ce853778391e60b08d1 
> git show --patch origin/feature | git patch-id 
ca5d666a572ec32bff9cec17b97d611316f89236 
26f77def8f1380cc3fd08ebc3f70652da79f1a2e 

# see OK behaviour: 
> git cherry origin/master-ok origin/feature-ok 
- 7ce2c0ecd3024c04bcf7b78d332841b2e791e06f 

In the "*-ok" branches, the file has newline at the end from the beginning 
and "master" only inserts a newline at the beginning of the file. "feature-ok"
has the same change as "feature" (content-wise).


Please review the rest of the bug report below. 
You can delete any lines you don't wish to share. 


[System Info] 
git version: 
git version 2.27.0 
cpu: x86_64 
no commit associated with this build 
sizeof-long: 8 
sizeof-size_t: 8 
uname: Linux 5.7.5-1-default #1 SMP Tue Jun 23 06:00:46 UTC 2020 (a1775d0) 
x86_64 
compiler info: gnuc: 10.1 
libc info: glibc: 2.31 


[Enabled Hooks] 
not run from a git repository - no hooks to show



             reply	other threads:[~2020-07-23 14:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 14:42 Tilman Vogel [this message]
2020-08-10 11:01 ` [BUG] git-cherry false-positive on upstream new-line change at end-of-file Tilman Vogel
2020-08-18 22:08 ` [PATCH] patch-id: ignore newline at end of file in diff_flush_patch_id() René Scharfe
2020-08-18 22:52   ` Junio C Hamano
2020-08-24 12:42     ` Johannes Schindelin
2020-08-27  9:05   ` Tilman Vogel

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=2639321.dTF8K4C05n@alien.lan \
    --to=tilman.vogel@web.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).