git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 1/8] Export matches_pack_name() and fix its return value
Date: Mon, 17 Sep 2007 01:44:47 -0700	[thread overview]
Message-ID: <11900186941912-git-send-email-gitster@pobox.com> (raw)

The function sounds boolean; make it behave as one, not "0 for
success, non-zero for failure".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 cache.h     |    1 +
 sha1_file.c |   14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/cache.h b/cache.h
index 70abbd5..3fa5b8e 100644
--- a/cache.h
+++ b/cache.h
@@ -529,6 +529,7 @@ extern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsign
 extern unsigned long unpack_object_header_gently(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep);
 extern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t);
 extern const char *packed_object_info_detail(struct packed_git *, off_t, unsigned long *, unsigned long *, unsigned int *, unsigned char *);
+extern int matches_pack_name(struct packed_git *p, const char *name);
 
 /* Dumb servers support */
 extern int update_server_info(int);
diff --git a/sha1_file.c b/sha1_file.c
index 9978a58..5801c3e 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1684,22 +1684,22 @@ off_t find_pack_entry_one(const unsigned char *sha1,
 	return 0;
 }
 
-static int matches_pack_name(struct packed_git *p, const char *ig)
+int matches_pack_name(struct packed_git *p, const char *name)
 {
 	const char *last_c, *c;
 
-	if (!strcmp(p->pack_name, ig))
-		return 0;
+	if (!strcmp(p->pack_name, name))
+		return 1;
 
 	for (c = p->pack_name, last_c = c; *c;)
 		if (*c == '/')
 			last_c = ++c;
 		else
 			++c;
-	if (!strcmp(last_c, ig))
-		return 0;
+	if (!strcmp(last_c, name))
+		return 1;
 
-	return 1;
+	return 0;
 }
 
 static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, const char **ignore_packed)
@@ -1717,7 +1717,7 @@ static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, cons
 		if (ignore_packed) {
 			const char **ig;
 			for (ig = ignore_packed; *ig; ig++)
-				if (!matches_pack_name(p, *ig))
+				if (matches_pack_name(p, *ig))
 					break;
 			if (*ig)
 				goto next;
-- 
1.5.3.1.967.g6bb01

             reply	other threads:[~2007-09-17  8:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-17  8:44 Junio C Hamano [this message]
2007-09-17  8:44 ` [PATCH 2/8] pack-objects --keep-unreachable Junio C Hamano
2007-09-17  8:44 ` [PATCH 3/8] repack -A -d: use --keep-unreachable when repacking Junio C Hamano
2007-09-17  9:29   ` Johannes Schindelin
2007-09-17 10:00     ` Andreas Ericsson
2007-09-18  3:01     ` Shawn O. Pearce
2007-09-17  8:44 ` [PATCH 4/8] git-gc --auto: move threshold check to need_to_gc() function Junio C Hamano
2007-09-17  8:44 ` [PATCH 5/8] git-gc --auto: add documentation Junio C Hamano
2007-09-17  9:36   ` Johannes Schindelin
2007-09-17 19:54     ` Junio C Hamano
2007-09-17  8:44 ` [PATCH 6/8] git-gc --auto: protect ourselves from accumulated cruft Junio C Hamano
2007-09-17  8:44 ` [PATCH 7/8] git-gc --auto: restructure the way "repack" command line is built Junio C Hamano
2007-09-17  9:41   ` Johannes Schindelin
2007-09-17 19:53     ` Junio C Hamano
2007-09-17  8:44 ` [PATCH 8/8] git-gc --auto: run "repack -A -d -l" as necessary Junio C Hamano
2007-09-17  9:53   ` Johannes Schindelin
2007-09-17 19:54     ` Junio C Hamano
2007-09-18  2:59   ` Shawn O. Pearce
  -- strict thread matches above, loose matches on Subject: below --
2007-09-17  8:27 [PATCH 0/8] Updated git-gc --auto series Junio C Hamano
2007-09-17  8:27 ` [PATCH 1/8] Export matches_pack_name() and fix its return value Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11900186941912-git-send-email-gitster@pobox.com \
    --to=gitster@pobox.com \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).