While trying to answer a Stack Overflow question I thought I could contribute to, I've found a scenario that I don't understand that may be a bug.

In http://stackoverflow.com/questions/39144006/identify-merge-into-master MvG asked how to find the point at which a commit on a feature branch was later merged into the main-line.

After some discussion it appeared that
`git log --oneline --first-parent --merges --reverse --ancestry-path :/j.. | head -1` should find the point that 'j' was merged into master (when on master), however it appears that --first-parent and --ancestry-path interact badly to produce no output in the example, but if either is dropped, the expected commit is shown.

What am I missing?

The commit graph. We are looking for F based on knowing J.

. A - B - C - D -- E -- F -- G - H    <-first parent, --merges (C,F,H)
.  \  |  /    \        /    /
.   ----Z     |       /    /
.     |       |       |   /
.      \       \     /   /
.       I -[J]- K - L - M             <-since J, children of J
.        \         /
.         N - O - P

# Steps to reproduce the extended example from
# http://stackoverflow.com/q/39144006/1468366

git init .
echo a > txt
git add txt
git commit -m a
echo a > txt; git commit -a -m a
echo b > txt; git commit -a -m b
git checkout -b side :/a
echo z > txt; git commit -a -m z
git checkout master
git merge :/z; echo c > txt; git add -u; git commit -m c

#echo c > txt; git commit -a -m c
echo d > txt; git commit -a -m d
echo e > txt; git commit -a -m e
git checkout -b 2nd :/b
echo i > txt; git commit -a -m i
echo j > txt; git commit -a -m j
git merge :/d; echo k > txt; git add -u; git commit -m k
git checkout -b 3rd :/i
echo n > txt; git commit -a -m n
echo o > txt; git commit -a -m o
echo p > txt; git commit -a -m p
git checkout 2nd
git merge :/p; echo l > txt; git add -u; git commit -m l
echo m > txt; git commit -a -m m
git checkout master
git merge :/l; echo f > txt; git add -u; git commit -m f
git merge :/m; echo g > txt; git add -u; git commit -m g
echo h > txt; git commit -a -m h

git log --oneline --first-parent --merges --reverse --ancestry-path :/j.. | head -5

# why does this not work --ancestry-path and --first-parent appear to clash.

code available as https://gist.github.com/PhilipOakley/58f344f910e50b72f5a8a2bd55b6c175

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to