{"thread":{"id":"10342","subject":"git update index question","startedAt":"2007-10-17T10:23:39Z","lastAt":"2007-10-17T13:30:21Z","messageCount":4,"participants":["Gonzalo Garramuno","Lars Hjemli"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"56235","messageId":"4715E2AB.4030900@filmaura.com","threadId":"10342","inReplyTo":null,"subject":"git update index question","fromName":"Gonzalo Garramuno","fromEmail":"gga@filmaura.com","sentAt":"2007-10-17T10:23:39Z","receivedAt":"2007-10-17T10:23:39Z","isPatch":false,"sender":{"key":"gga@filmaura.com","avatar":null},"body":"Hi.  I'm new to git but have been using it successfully for about three \nmonths now and love it.\n\nI've run into my first problem (or, more specifically) lack of \nunderstanding.\n\nI'm currently working on linux.\n\nAfter some modifications of my source code with a script and doing a \ncommit with qgit, it seems some spaces at the end of those changed lines \ngot added.\n\nNow, whenever I try to do a commit, the result is that git aborts with\n* trailing whitespace (line XXX).\nThat is, it fails due to git's pre-commit perl hook.\n\nNow, I've modified and changed the offending lines, but redoing the \ncommit the problem persists.\n\nAfter loooking into it, I realized the issue is git's index file.  If \ngit-diff-index is called without --cached, the diff matches what's on \ndisk and works as I expect.  However, the pre-commit hook calls it with \n--cached which leads to the problem.\n\nThus, since I don't want to modify the pre-commit hook, the question is \nwhat's the proper way to rebuild git's index file for all the files that \nwere to be committed but weren't due to the abort.\n\nI've tried git-update-index with most of the flags with no success.  I \nonly got it to update the index properly when I specifically specified a \nfilename with the problem, but I have a lot of files with the issue and \ngit already knows about them so I was hoping for a better method.\n\n\n\n\n\n\n-- \nGonzalo Garramuño\n\nFilm Aura\nA New Dawn in Media Companies\n\ngga@filmaura.com\nhttp://www.filmaura.com\n"},{"id":"56242","messageId":"8c5c35580710170549n25c8b692w2466091ea56d641e@mail.gmail.com","threadId":"10342","inReplyTo":"4715E2AB.4030900@filmaura.com","subject":"Re: git update index question","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2007-10-17T12:49:37Z","receivedAt":"2007-10-17T12:49:37Z","isPatch":false,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On 10/17/07, Gonzalo Garramuno <gga@filmaura.com> wrote:\n> what's the proper way to rebuild git's index file for all the files that\n> were to be committed but weren't due to the abort.\n\nHave you tried 'git commit -a'? It will run update-index on all\nmodified files prior to executing the hook.\n\nBtw: If you want to inspect your changes for offending whitespace,\n'git diff --color' and  'git diff --cached --color' are your friends.\nAnd if you give up, there is also 'git commit -a --no-verify'.\n\n--\nlarsh\n"},{"id":"56244","messageId":"47160706.2000706@filmaura.com","threadId":"10342","inReplyTo":"8c5c35580710170549n25c8b692w2466091ea56d641e@mail.gmail.com","subject":"Re: git update index question","fromName":"Gonzalo Garramuno","fromEmail":"gga@filmaura.com","sentAt":"2007-10-17T12:58:46Z","receivedAt":"2007-10-17T12:58:46Z","isPatch":false,"sender":{"key":"gga@filmaura.com","avatar":null},"body":"Lars Hjemli wrote:\n> On 10/17/07, Gonzalo Garramuno <gga@filmaura.com> wrote:\n>> what's the proper way to rebuild git's index file for all the files that\n>> were to be committed but weren't due to the abort.\n> \n> Have you tried 'git commit -a'? It will run update-index on all\n> modified files prior to executing the hook.\n> \n> Btw: If you want to inspect your changes for offending whitespace,\n> 'git diff --color' and  'git diff --cached --color' are your friends.\n> And if you give up, there is also 'git commit -a --no-verify'.\n> \n\nThanks.  I found out the root of my problem was actually something else. \n  I had incorrectly done a chmod a+x on the pre-commit hook when all my \nprevious commits had not been using it, so I think the pre-commit was \nactually catching not my new fix but what was already in the repository.\ngit-commit -a had no effect due to that.\n\nBut it's good to know about the --no-verify option, thou.\n\n-- \nGonzalo Garramuño\n\nFilm Aura\nA New Dawn in Media Companies\n\ngga@filmaura.com\nhttp://www.filmaura.com\n"},{"id":"56245","messageId":"8c5c35580710170630y6ab3a6aehcbbcf9b7feb1bb6d@mail.gmail.com","threadId":"10342","inReplyTo":"47160706.2000706@filmaura.com","subject":"Re: git update index question","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2007-10-17T13:30:21Z","receivedAt":"2007-10-17T13:30:21Z","isPatch":false,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On 10/17/07, Gonzalo Garramuno <gga@filmaura.com> wrote:\n> I had incorrectly done a chmod a+x on the pre-commit hook when all my\n> previous commits had not been using it, so I think the pre-commit was\n> actually catching not my new fix but what was already in the repository.\n\nThat sounds wrong: the (default) pre-commit hook only verifies the\n_new_ content, not the content in HEAD.  Is there any chance your\n.git/hooks/pre-commit script has been tampered with?\n\n--\nlarsh\n"}]}