oh yeah, after testing, the script should return git and the working
directory back to how it was before the script ran.

On Tuesday, October 27, 2015 at 10:12:51 PM UTC-7, ozzloy wrote:
> i am writing a script to test exactly what's staged for the next commit.
> this should work even on root commit, and in orphan branches, so using
> stash by itself doesn't work because there's no HEAD for stash to stash
> on.
> my current solution in those situations is to:
> 0 commit the index
> 1 stash unstaged unignored files
> 2 run tests and save result
> 3 stash pop
> 4 delete HEAD
> 5 return the saved test result
> my concern is that step 0 might modify the index.
> if there's a better way to test the index, i'd be happy to hear it
> On Monday, October 26, 2015 at 4:53:12 AM UTC-7, Konstantin Khomoutov 
> wrote:
>> On Sat, 24 Oct 2015 17:29:30 -0700 (PDT) 
>> ozzloy <ozz...@gmail.com> wrote: 
>> > does `git commit` modify $GIT_DIR/index? 
>> > i just diffed index from before and after a commit and found no 
>> > difference.  i'm guessing this is reliable behavior, but i wanted to 
>> > make sure.  it seems like the idea of index is that it's always ready 
>> > and waiting to be turned into the next commit.  so commits wouldn't 
>> > ever modify it. 
>> > 
>> > i'm writing a script that depends on this behavior and i want to make 
>> > sure i have the concepts right. 
>> Care to elaborate on why you want to depend on this? 
>> (We should try to rule out a possible case of the "XY problem" here.) 
>> The problem with your current approach is that Git seemingly says 
>> nothing about how the index-as-a-regular-file behaves in which case 
>> so it's free to change even in point releases.  I mean, I'd try to 
>> avoid such dependancy at all costs until absolutely necessary. 
>> BTW recently someone popped on the main Git list asking about the 
>> current state of affairs in speeding up certain Git operations, and 
>> one of the concepts which were discussed along the way was "split 
>> index".  While I don't know the details it might mean making the Git 
>> index hierarchical -- where some parts of its information are kept in 
>> files, say, adjacent to the main one or whatever. 

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to