I've been working on rewriting git stash as a c builtin and I have all but three tests passing. I'm having a bit of trouble fixing them, as well as a few other issues, so I'd really appreciate some help. Don't bother commenting on the small details yet as I still need to go though the code to make sure it matches the code style guidelines.
The commit is a bit big, so I'll just link to it on github. https://github.com/klusark/git/commit/f74d65ae3e06d2c0ab000702ac5e756550e06454 Test Summary Report ------------------- t7601-merge-pull-config.sh (Wstat: 256 Tests: 14 Failed: 2) Failed tests: 11-12 Non-zero exit status: 1 t3903-stash.sh (Wstat: 256 Tests: 74 Failed: 1) Failed test: 69 Non-zero exit status: 1 It looks to be the same issue for both of these cases where merge-recursive reports: error: Your local changes to the following files would be overwritten by merge: file other-file which doesn't make sense as those files didn't exist before the merge. Furthermore if I take the existing git stash implementation and have it stop before running the merge-recursive command and then run it on the commandline manually, I get the same issue. I've tried setting all the same environment variables that the existing git stash implementation does, but it doesn't help. It seems like there could be a bug in merge-recursive, but I'm not sure how to track it down. git stash uses the GIT_INDEX_FILE environment variable in order to not trash the main index. I ended up doing things like this: discard_cache(); ret = read_cache_from(index_path); write_index_as_tree(orig_tree.hash, &the_index, index_path, 0, NULL); discard_cache(); ret = read_cache_from(index_path); in order to have an empty cache. Could someone take a look at my uses of the index and point out better ways to do it? My main goal right now is to cleanup the code and replace more of the commands with native code. Thanks, Joel