public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jake Goulding <goulding@vivisimo•com>
To: git@vger•kernel.org
Subject: post-receive-email - does not handle creating a new branch with same HEAD as other branch
Date: Wed, 21 Jan 2009 17:12:51 -0500	[thread overview]
Message-ID: <49779DE3.8010906@vivisimo.com> (raw)

Given the simple case of two commits:

A--B

with branches setup like:
master: A
b1: B

If I create a new branch b2 at the same point as b1 from a remote server:

$ git push origin B:b2

The following code will be run in post-receive-email:

git rev-parse --not --branches |
grep -v $(git rev-parse $refname) |
git rev-list --pretty --stdin $newrev

(refname = refs/heads/b2, newrev=B)

The problem occurs because the first rev-parse reports:

^A
^B
^B

And the grep removes lines matching B, leaving:

^A

which causes the eventual rev-list command to be:

git rev-list --pretty ^A B

This problem could be exaggerated if there were a lot of commits between
 A and B, which would cause each commit A..B to be reported.

Is there any alternate way to write this command to cause these false
positives to not be reported? I tried to write a version that uses the
ref name instead of the hash, but it did not end up very pretty (and I
don't think it worked...).

Thanks!

-Jake

                 reply	other threads:[~2009-01-21 22:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=49779DE3.8010906@vivisimo.com \
    --to=goulding@vivisimo$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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