git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Horman <nhorman@tuxdriver.com>
To: git@vger.kernel.org
Cc: mmueller@vigilantsw.com, rene.scharfe@lsrfire.ath.cx,
	Matthieu.Moy@grenoble-inp.fr, gitster@pobox.com,
	Neil Horman <nhorman@tuxdriver.com>
Subject: [PATCH v3] git cherry-pick: Add NULL check to sequencer parsing of HEAD
Date: Thu,  3 May 2012 10:09:19 -0400	[thread overview]
Message-ID: <1336054159-5123-1-git-send-email-nhorman@tuxdriver.com> (raw)
In-Reply-To: <1336044026-16897-1-git-send-email-nhorman@tuxdriver.com>

Michael Mueller noted that a feature I recently added failed to check the return
of lookup_commit to ensure that it was not NULL.  I don't think a NULL can
actually happen in the this particular use case, but regardless it seems a good
idea to check.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
 sequencer.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sequencer.c b/sequencer.c
index f83cdfd..f7eac1d 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -261,9 +261,9 @@ static int is_index_unchanged(void)
 		return error(_("Could not resolve HEAD commit\n"));
 
 	head_commit = lookup_commit(head_sha1);
-	if (!head_commit || parse_commit(head_commit))
-		return error(_("could not parse commit %s\n"),
-			     sha1_to_hex(head_commit->object.sha1));
+
+	if (parse_commit(head_commit))
+		return -1;
 
 	if (!active_cache_tree)
 		active_cache_tree = cache_tree();
-- 
1.7.7.6

  parent reply	other threads:[~2012-05-03 14:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-03 11:20 [PATCH] git cherry-pick: Add NULL check to sequencer parsing of HEAD Neil Horman
2012-05-03 11:45 ` René Scharfe
2012-05-03 12:08   ` Neil Horman
2012-05-03 12:26     ` René Scharfe
2012-05-03 12:10 ` [PATCH v2] " Neil Horman
2012-05-03 14:09 ` Neil Horman [this message]
2012-05-03 16:48   ` [PATCH v3] " Matthieu Moy
2012-05-03 17:13     ` Junio C Hamano
     [not found]   ` <7vsjfhfbko.fsf@alter.siamese.dyndns.org>
2012-05-03 17:34     ` Neil Horman

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=1336054159-5123-1-git-send-email-nhorman@tuxdriver.com \
    --to=nhorman@tuxdriver.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mmueller@vigilantsw.com \
    --cc=rene.scharfe@lsrfire.ath.cx \
    /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).