Skip to content

Commit a650f43

Browse files
ch3coolicsware
authored andcommitted
Cleanup index.lock after running libgit update-index
(fixes issue #2668) Signed-off-by: Sup Yut Sum <[email protected]> Signed-off-by: Sven Strickroth <[email protected]>
1 parent 53e9668 commit a650f43

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

ext/gitdll/gitdll.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ extern int die_is_recursing_dll(void);
4848
extern void free_all_pack();
4949
extern void reset_git_env();
5050
extern void drop_attr_stack();
51+
extern void git_atexit_dispatch();
52+
extern void git_atexit_clear();
5153
extern void invalidate_ref_cache(const char* submodule);
5254
extern void cmd_log_init(int argc, const char** argv, const char* prefix, struct rev_info* rev, struct setup_revision_opt* opt);
5355
extern int estimate_commit_count(struct rev_info* rev, struct commit_list* list);
@@ -756,6 +758,12 @@ int git_run_cmd(char *cmd, char *arg)
756758
return -1;
757759
}
758760

761+
void git_exit_cleanup(void)
762+
{
763+
git_atexit_dispatch();
764+
git_atexit_clear();
765+
}
766+
759767
int git_for_each_reflog_ent(const char *ref, each_reflog_ent_fn fn, void *cb_data)
760768
{
761769
return for_each_reflog_ent(ref,fn,cb_data);

ext/gitdll/gitdll.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ GITDLL_API int git_free_exclude_list(EXCLUDE_LIST which);
166166
GITDLL_API int git_get_notes(GIT_HASH hash, char **p_note);
167167

168168
GITDLL_API int git_run_cmd(char *cmd, char *arg);
169+
GITDLL_API void git_exit_cleanup();
169170

170171
#define REF_ISSYMREF 01
171172
#define REF_ISPACKED 02

ext/tgit

Submodule tgit updated from 4bf7da9 to 5d12f1f

src/Changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Released: unreleased
3838
* Fixed issue #2676: Swapped Theirs and Mine in Edit conflicts outside of rebase dialog on rebasing
3939
* Fixed issue #2690: Failed to Show log from repository browser when that repository is located on a drive
4040
* Fixed issue #2655: Resolve does not work on multiple selection during deleted-modifed conflict resolution
41+
* Fixed issue #2668: TortoiseGit commit with git-lfs files, show me a error: ".git/index.lock" file exist
4142

4243
= Release 1.8.16.0 =
4344
Released: 2015-11-01

src/Git/Git.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2442,10 +2442,13 @@ int CGit::RefreshGitIndex()
24422442
CAutoLocker lock(g_Git.m_critGitDllSec);
24432443
try
24442444
{
2445-
return [] { return git_run_cmd("update-index","update-index -q --refresh"); }();
2445+
int result = [] { return git_run_cmd("update-index","update-index -q --refresh"); }();
2446+
git_exit_cleanup();
2447+
return result;
24462448

24472449
}catch(...)
24482450
{
2451+
git_exit_cleanup();
24492452
return -1;
24502453
}
24512454

0 commit comments

Comments
 (0)