* git update index question
@ 2007-10-17 10:23 Gonzalo Garramuno
2007-10-17 12:49 ` Lars Hjemli
0 siblings, 1 reply; 4+ messages in thread
From: Gonzalo Garramuno @ 2007-10-17 10:23 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git update index question
2007-10-17 10:23 git update index question Gonzalo Garramuno
@ 2007-10-17 12:49 ` Lars Hjemli
2007-10-17 12:58 ` Gonzalo Garramuno
0 siblings, 1 reply; 4+ messages in thread
From: Lars Hjemli @ 2007-10-17 12:49 UTC (permalink / raw)
To: Gonzalo Garramuno; +Cc: git
On 10/17/07, Gonzalo Garramuno <gga@filmaura.com> wrote:
> 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.
Have you tried 'git commit -a'? It will run update-index on all
modified files prior to executing the hook.
Btw: If you want to inspect your changes for offending whitespace,
'git diff --color' and 'git diff --cached --color' are your friends.
And if you give up, there is also 'git commit -a --no-verify'.
--
larsh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git update index question
2007-10-17 12:49 ` Lars Hjemli
@ 2007-10-17 12:58 ` Gonzalo Garramuno
2007-10-17 13:30 ` Lars Hjemli
0 siblings, 1 reply; 4+ messages in thread
From: Gonzalo Garramuno @ 2007-10-17 12:58 UTC (permalink / raw)
To: Lars Hjemli, git
Lars Hjemli wrote:
> On 10/17/07, Gonzalo Garramuno <gga@filmaura.com> wrote:
>> 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.
>
> Have you tried 'git commit -a'? It will run update-index on all
> modified files prior to executing the hook.
>
> Btw: If you want to inspect your changes for offending whitespace,
> 'git diff --color' and 'git diff --cached --color' are your friends.
> And if you give up, there is also 'git commit -a --no-verify'.
>
Thanks. I found out the root of my problem was actually something else.
I had incorrectly done a chmod a+x on the pre-commit hook when all my
previous commits had not been using it, so I think the pre-commit was
actually catching not my new fix but what was already in the repository.
git-commit -a had no effect due to that.
But it's good to know about the --no-verify option, thou.
--
Gonzalo Garramuño
Film Aura
A New Dawn in Media Companies
gga@filmaura.com
http://www.filmaura.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git update index question
2007-10-17 12:58 ` Gonzalo Garramuno
@ 2007-10-17 13:30 ` Lars Hjemli
0 siblings, 0 replies; 4+ messages in thread
From: Lars Hjemli @ 2007-10-17 13:30 UTC (permalink / raw)
To: Gonzalo Garramuno; +Cc: git
On 10/17/07, Gonzalo Garramuno <gga@filmaura.com> wrote:
> I had incorrectly done a chmod a+x on the pre-commit hook when all my
> previous commits had not been using it, so I think the pre-commit was
> actually catching not my new fix but what was already in the repository.
That sounds wrong: the (default) pre-commit hook only verifies the
_new_ content, not the content in HEAD. Is there any chance your
.git/hooks/pre-commit script has been tampered with?
--
larsh
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-17 13:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-17 10:23 git update index question Gonzalo Garramuno
2007-10-17 12:49 ` Lars Hjemli
2007-10-17 12:58 ` Gonzalo Garramuno
2007-10-17 13:30 ` Lars Hjemli
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).