git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Potapov <dpotapov@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Alexander Litvinov <litvinov2004@gmail.com>,
	git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>
Subject: Re: [PATCH] git-svn now work with crlf convertion enabled.
Date: Sat, 2 Aug 2008 03:10:24 +0400	[thread overview]
Message-ID: <20080801231024.GL7008@dpotapov.dyndns.org> (raw)
In-Reply-To: <7vr698qt6w.fsf@gitster.siamese.dyndns.org>

On Fri, Aug 01, 2008 at 03:14:15PM -0700, Junio C Hamano wrote:
> 
> Even though the patch was not compile tested, I did check the existing
> call sites are giving only 0 or 1, but I think converting these "please
> write -- I give you 1" callers to pass the bitmask would be a sane thing
> to do.

Here it goes. It turned out that there are only two places that actually
needs correction, while two others use '0'. I have run 'make test' and
it's passed the tests.

-- 8< --
From: Dmitry Potapov <dpotapov@gmail.com>
Date: Sat, 2 Aug 2008 02:56:45 +0400
Subject: [PATCH] convert index_path callers to use bitmask instead of 1

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
---
 builtin-update-index.c |    5 +++--
 read-cache.c           |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/builtin-update-index.c b/builtin-update-index.c
index 38eb53c..d3e212c 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -85,7 +85,7 @@ static int process_lstat_error(const char *path, int err)
 
 static int add_one_path(struct cache_entry *old, const char *path, int len, struct stat *st)
 {
-	int option, size;
+	int option, flags, size;
 	struct cache_entry *ce;
 
 	/* Was the old index entry already up-to-date? */
@@ -99,7 +99,8 @@ static int add_one_path(struct cache_entry *old, const char *path, int len, stru
 	fill_stat_cache_info(ce, st);
 	ce->ce_mode = ce_mode_from_stat(old, st->st_mode);
 
-	if (index_path(ce->sha1, path, st, !info_only))
+	flags = info_only ? 0 : HASH_OBJECT_DO_CREATE;
+	if (index_path(ce->sha1, path, st, flags))
 		return -1;
 	option = allow_add ? ADD_CACHE_OK_TO_ADD : 0;
 	option |= allow_replace ? ADD_CACHE_OK_TO_REPLACE : 0;
diff --git a/read-cache.c b/read-cache.c
index 2c03ec3..afd6005 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -550,7 +550,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
 		alias->ce_flags |= CE_ADDED;
 		return 0;
 	}
-	if (index_path(ce->sha1, path, st, 1))
+	if (index_path(ce->sha1, path, st, HASH_OBJECT_DO_CREATE))
 		return error("unable to index file %s", path);
 	if (ignore_case && alias && different_name(ce, alias))
 		ce = create_alias_ce(ce, alias);
-- 
1.6.0.rc1.34.gad373

  reply	other threads:[~2008-08-01 23:11 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23  8:44 git-svn does not seems to work with crlf convertion enabled Alexander Litvinov
2008-07-23  9:18 ` Johannes Schindelin
2008-07-23 11:52   ` Alexander Litvinov
2008-07-23 12:57     ` Johannes Schindelin
2008-07-23 15:49       ` Avery Pennarun
2008-07-23 16:07         ` Johannes Schindelin
2008-07-24  3:13       ` Alexander Litvinov
2008-08-06 11:15       ` Petr Baudis
2008-08-06 12:35         ` Peter Harris
2008-08-06 12:43         ` Johannes Schindelin
2008-08-06 13:51           ` git-svn on MSysGit and why is it (going to be?) unsupported Petr Baudis
2008-08-06 15:23             ` Avery Pennarun
2008-08-06 16:11         ` git-svn does not seems to work with crlf convertion enabled Dmitry Potapov
2008-07-24 14:24     ` Dmitry Potapov
2008-07-24 14:40       ` Johannes Schindelin
2008-07-24 16:28         ` Avery Pennarun
2008-07-30  4:37   ` Alexander Litvinov
2008-07-31  5:43   ` [PATCH] git-svn now " Alexander Litvinov
2008-07-31  5:57     ` Alexander Litvinov
2008-07-31 10:45       ` Dmitry Potapov
2008-07-31 19:09         ` [RFC] hash-object --no-filters Dmitry Potapov
2008-08-01  3:23         ` [PATCH] git-svn now work with crlf convertion enabled Alexander Litvinov
2008-08-01  5:09           ` Junio C Hamano
2008-08-01  7:44             ` Dmitry Potapov
2008-08-01 11:27               ` Alexander Litvinov
2008-08-01  7:47           ` Dmitry Potapov
2008-08-01  8:08             ` Junio C Hamano
2008-08-01  9:24               ` Dmitry Potapov
2008-08-01 19:42                 ` Junio C Hamano
2008-08-01 22:09                   ` Dmitry Potapov
2008-08-01 22:14                     ` Junio C Hamano
2008-08-01 23:10                       ` Dmitry Potapov [this message]
2008-08-02 17:28                     ` [PATCH] hash-object --no-filters Junio C Hamano
2008-08-03  5:42                       ` Dmitry Potapov
2008-08-03  5:56                         ` Dmitry Potapov
2008-08-03 14:36                           ` [PATCH 1/5] correct argument checking test for git hash-object Dmitry Potapov
2008-08-03 14:36                             ` [PATCH 2/5] correct usage help string for git-hash-object Dmitry Potapov
2008-08-03 14:36                               ` [PATCH 3/5] use parse_options() in git hash-object Dmitry Potapov
2008-08-03 14:36                                 ` [PATCH 4/5] add --path option to " Dmitry Potapov
2008-08-03 14:36                                   ` [PATCH 5/5] add --no-filters " Dmitry Potapov
2008-08-03 20:44                           ` [PATCH] hash-object --no-filters Junio C Hamano
2008-08-01 11:11               ` [PATCH] git-svn now work with crlf convertion enabled Alexander Litvinov
2008-08-01 12:36                 ` Dmitry Potapov
2008-08-04  3:10                   ` Alexander Litvinov
2008-08-04  0:48     ` Eric Wong

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=20080801231024.GL7008@dpotapov.dyndns.org \
    --to=dpotapov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=litvinov2004@gmail.com \
    --cc=normalperson@yhbt.net \
    /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).