Skip to content

Instantly share code, notes, and snippets.

Created December 20, 2011 00:37
Show Gist options
  • Save anonymous/1499621 to your computer and use it in GitHub Desktop.
Save anonymous/1499621 to your computer and use it in GitHub Desktop.
Diff to speed up commit time in git
diff --git a/builtin/commit.c b/builtin/commit.c
index 66ffe31..c661135 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -411,7 +411,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,
*/
if (!pathspec || !*pathspec) {
fd = hold_locked_index(&index_lock, 1);
- refresh_cache_or_die(refresh_flags);
+ //refresh_cache_or_die(refresh_flags);
if (active_cache_changed) {
if (write_cache(fd, active_cache, active_nr) ||
commit_locked_index(&index_lock))
@@ -859,15 +859,15 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
* and write it out as a tree. We must do this before we invoke
* the editor and after we invoke run_status above.
*/
- discard_cache();
- read_cache_from(index_file);
- if (!active_cache_tree)
- active_cache_tree = cache_tree();
- if (cache_tree_update(active_cache_tree,
- active_cache, active_nr, 0, 0) < 0) {
- error(_("Error building trees"));
- return 0;
- }
+ //discard_cache();
+ // read_cache_from(index_file);
+ if (!active_cache_tree)
+ active_cache_tree = cache_tree();
+ if (cache_tree_update(active_cache_tree,
+ active_cache, active_nr, 1, 0) < 0) {
+ error(_("Error building trees"));
+ return 0;
+ }
if (run_hook(index_file, "prepare-commit-msg",
git_path(commit_editmsg), hook_arg1, hook_arg2, NULL))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment