git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Catalin(ux) M. BOIE" <catab@embedromix.ro>
To: git@vger.kernel.org
Subject: git merge strange result
Date: Thu, 1 Dec 2011 17:36:00 +0200 (EET)	[thread overview]
Message-ID: <alpine.LFD.2.02.1112011733070.32682@mail.embedromix.ro> (raw)

Hello!

Below is a script that reproduce what a coleague of mine found.
Seems that if in a branch we have a commit that is cherry-picked be 
master, than revert that commit in branch and merge branch in master, the 
revert is ignored. Is it normal?

Thank you very much!

#!/bin/bash

set -e

rm -rf buba1
mkdir buba1
cd buba1

git init
echo -e "aaa\nbbb\nccc" > file1
git add file1
git commit -m "c1"

echo "Create branch b1..."
git branch b1
echo

echo "Create a bad fix..."
sed --in-place -e 's/bbb/bad line/' file1
git add file1
git commit -m "bad commit"
cat file1
echo

echo "Cherry pick on b1..."
git checkout b1
git cherry-pick -x master
echo

echo "Reverting on b1"
git revert --no-edit b1
echo

echo "Switch to master"
git checkout master
echo

echo "merge-base is `git merge-base --all master b1 | git name-rev --stdin`"
echo

echo "diff between master and b1..."
git diff master b1
echo

echo "Merge b1 in master"
git merge --verbose --log b1

if [ "`grep bad file1`" = "" ]; then
 	echo "good!"
else
 	echo "bad!"
fi
# it should prind "good"

--
Catalin(ux) M. BOIE
http://kernel.embedromix.ro/

             reply	other threads:[~2011-12-01 16:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01 15:36 Catalin(ux) M. BOIE [this message]
2011-12-01 18:50 ` git merge strange result Jeff King

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=alpine.LFD.2.02.1112011733070.32682@mail.embedromix.ro \
    --to=catab@embedromix.ro \
    --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).