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

git update index question

From
GGGonzalo Garramuno <gga@filmaura.com>
Date
Oct 17, 2007, 10:23 UTC
Message-ID
<4715E2AB.4030900@filmaura.com>

Hi. I'm new to git but have been using it successfully for about three months now and love it.

I've run into my first problem (or, more specifically) lack of understanding.

I'm currently working on linux.

After some modifications of my source code with a script and doing a commit with qgit, it seems some spaces at the end of those changed lines got added.

Now, whenever I try to do a commit, the result is that git aborts with
* trailing whitespace (line XXX).
That is, it fails due to git's pre-commit perl hook.

Now, I've modified and changed the offending lines, but redoing the commit the problem persists.

After loooking into it, I realized the issue is git's index file. If git-diff-index is called without --cached, the diff matches what's on disk and works as I expect. However, the pre-commit hook calls it with --cached which leads to the problem.

Thus, since I don't want to modify the pre-commit hook, the question is what's the proper way to rebuild git's index file for all the files that were to be committed but weren't due to the abort.

I've tried git-update-index with most of the flags with no success. I only got it to update the index properly when I specifically specified a filename with the problem, but I have a lot of files with the issue and git already knows about them so I was hoping for a better method.

-- 
Gonzalo Garramuño

Film Aura
A New Dawn in Media Companies

gga@filmaura.com
http://www.filmaura.com
Next: Lars Hjemli
Message 1 of 4 in “git update index question”
  1. Gonzalo GarramunoOct 17, 2007
  2. Lars HjemliOct 17, 2007
  3. Gonzalo GarramunoOct 17, 2007
  4. Lars HjemliOct 17, 2007

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.