From: Ramsay Jones <ramsay@ramsay1•demon.co.uk>
To: Nguyen Thai Ngoc Duy <pclouds@gmail•com>
Cc: GIT Mailing-list <git@vger•kernel.org>
Subject: split index: sparse warning
Date: Thu, 01 May 2014 00:44:58 +0100 [thread overview]
Message-ID: <53618AFA.6070602@ramsay1.demon.co.uk> (raw)
Hi Duy,
I haven't looked at your split-index series at all. However, sparse has
nagged me to take a quick squint at the result of the series as it
appears in the 'pu' branch.
In particular, sparse complains thus:
SP sequencer.c
sequencer.c:690:49: error: incompatible types for operation (>=)
sequencer.c:690:49: left side has type int ( extern [toplevel] *<noident> )( ... )
sequencer.c:690:49: right side has type int
... which is fair enough; index_fd is, indeed, a function (pointer) and
not an int file descriptor! The offending code looks like:
683 static void read_and_refresh_cache(struct replay_opts *opts)
684 {
685 static struct lock_file index_lock;
686 hold_locked_index(&index_lock, 0);
687 if (read_index_preload(&the_index, NULL) < 0)
688 die(_("git %s: failed to read the index"), action_name(opts));
689 refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
690 if (the_index.cache_changed && index_fd >= 0) {
691 if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
692 die(_("git %s: failed to refresh the index"), action_name(opts));
693 }
694 rollback_lock_file(&index_lock);
695 }
It seems that, in an earlier commit (33c297aa), index_fd was declared
as a local int variable (hiding the global function) which was then
initialised by a call to hold_locked_index().
I assume that the conditional should be changed to something like:
690 if (the_index.cache_changed && index_lock.fd >= 0) {
... but I haven't spent any time investigating this, so take this
suggestion which a large pinch of salt! :-P
ATB,
Ramsay Jones
next reply other threads:[~2014-04-30 23:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-30 23:44 Ramsay Jones [this message]
2014-05-01 0:12 ` split index: sparse warning Duy Nguyen
2014-06-01 0:47 ` [PATCH nd/split-index] fixup! read-cache: new API write_locked_index instead of write_index/write_cache Nguyễn Thái Ngọc Duy
2014-06-02 15:12 ` Ramsay Jones
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=53618AFA.6070602@ramsay1.demon.co.uk \
--to=ramsay@ramsay1$(echo .)demon.co.uk \
--cc=git@vger$(echo .)kernel.org \
--cc=pclouds@gmail$(echo .)com \
/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