git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>, git@vger.kernel.org
Subject: Re: False positive from orphaned_commit_warning() ?
Date: Wed, 25 Jul 2012 17:57:30 -0400	[thread overview]
Message-ID: <20120725215730.GA30966@sigill.intra.peff.net> (raw)
In-Reply-To: <7va9ynbj9l.fsf@alter.siamese.dyndns.org>

On Wed, Jul 25, 2012 at 02:52:54PM -0700, Junio C Hamano wrote:

> Paul Gortmaker <paul.gortmaker@windriver.com> writes:
> 
> > Has anyone else noticed false positives coming from the
> > orphan check?
> 
> Thanks.  This should fix it.

I've just been hunting the same bug and came up with the same answer.
Here's a commit message. Feel free to apply or steal text for your
commit.

-- >8 --
Subject: [PATCH] checkout: don't confuse ref and object flags

When we are leaving a detached HEAD, we do a revision
traversal to check whether we are orphaning any commits,
marking the commit we're leaving as the start of the
traversal, and all existing refs as uninteresting.

Prior to commit 468224e5, we did so by calling for_each_ref,
and feeding each resulting refname to setup_revisions.
Commit 468224e5 refactored this to simply mark the pending
objects, saving an extra lookup.

However, it confused the "flags" parameter to the
each_ref_fn clalback, which is about the flags we found
while looking up the ref (e.g., REF_ISSYMREF) with the
object flag (UNINTERESTING), leading to unpredictable
results, as we were setting random flag bits on objects in
the traversal.
---
 builtin/checkout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index a76899d..f855489 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -592,7 +592,7 @@ static int add_pending_uninteresting_ref(const char *refname,
 					 const unsigned char *sha1,
 					 int flags, void *cb_data)
 {
-	add_pending_sha1(cb_data, refname, sha1, flags | UNINTERESTING);
+	add_pending_sha1(cb_data, refname, sha1, UNINTERESTING);
 	return 0;
 }
 

  reply	other threads:[~2012-07-25 21:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25 18:53 False positive from orphaned_commit_warning() ? Paul Gortmaker
2012-07-25 20:43 ` Dan Johnson
2012-07-25 21:52 ` Junio C Hamano
2012-07-25 21:57   ` Jeff King [this message]
2012-07-25 22:05     ` Junio C Hamano
2012-07-25 22:31       ` Jeff King
2012-07-26 13:22   ` Paul Gortmaker

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=20120725215730.GA30966@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=paul.gortmaker@windriver.com \
    /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).