git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: split index: sparse warning

From
Duy Nguyen <pclouds@gmail.com>
Date
May 1, 2014, 00:12 UTC
Message-ID
<CACsJy8Ad+hfmJSgKX6O9FTXggUjyMkpJLzf=awnV5oFACsX+vQ@mail.gmail.com>
In-Reply-To
<53618AFA.6070602@ramsay1.demon.co.uk>
On Thu, May 1, 2014 at 6:44 AM, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:
Show 34 quoted lines
> 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().

Ugh.. after removing index_fd the local variable, index_fd now becomes the function from sha1_file.c. Noted and will fix it in the next reroll. -- Duy

Previous: Ramsay JonesNext: Nguyễn Thái Ngọc Duy
Message 2 of 4 in “split index: sparse warning”
  1. Ramsay JonesApr 30, 2014
  2. Duy NguyenMay 1, 2014
  3. fixup! read-cache: new API write_locked_index instead of write_index/write_cacheNguyễn Thái Ngọc Duy, Jun 1, 2014
  4. Ramsay JonesJun 2, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.