Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
8ff0f325
Commit
8ff0f325
authored
Oct 31, 2012
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index: Switch to git_futils_filestamp
parent
dbd6850d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
20 deletions
+18
-20
src/index.c
+17
-19
src/index.h
+1
-1
No files found.
src/index.c
View file @
8ff0f325
...
@@ -334,7 +334,7 @@ void git_index_clear(git_index *index)
...
@@ -334,7 +334,7 @@ void git_index_clear(git_index *index)
git_vector_clear
(
&
index
->
entries
);
git_vector_clear
(
&
index
->
entries
);
git_vector_clear
(
&
index
->
reuc
);
git_vector_clear
(
&
index
->
reuc
);
index
->
last_modified
=
0
;
git_futils_filestamp_set
(
&
index
->
stamp
,
NULL
)
;
git_tree_cache_free
(
index
->
tree
);
git_tree_cache_free
(
index
->
tree
);
index
->
tree
=
NULL
;
index
->
tree
=
NULL
;
...
@@ -390,9 +390,9 @@ unsigned int git_index_caps(const git_index *index)
...
@@ -390,9 +390,9 @@ unsigned int git_index_caps(const git_index *index)
int
git_index_read
(
git_index
*
index
)
int
git_index_read
(
git_index
*
index
)
{
{
int
error
,
updated
;
int
error
=
0
,
updated
;
git_buf
buffer
=
GIT_BUF_INIT
;
git_buf
buffer
=
GIT_BUF_INIT
;
time_t
mtime
;
git_futils_filestamp
stamp
;
assert
(
index
->
index_file_path
);
assert
(
index
->
index_file_path
);
...
@@ -402,23 +402,21 @@ int git_index_read(git_index *index)
...
@@ -402,23 +402,21 @@ int git_index_read(git_index *index)
return
0
;
return
0
;
}
}
/* We don't want to update the mtime if we fail to parse the index */
updated
=
git_futils_filestamp_check
(
&
stamp
,
index
->
index_file_path
);
mtime
=
index
->
last_modified
;
if
(
updated
<=
0
)
error
=
git_futils_readbuffer_updated
(
return
updated
;
&
buffer
,
index
->
index_file_path
,
&
mtime
,
NULL
,
&
updated
);
error
=
git_futils_readbuffer
(
&
buffer
,
index
->
index_file_path
);
if
(
error
<
0
)
if
(
error
<
0
)
return
error
;
return
error
;
if
(
updated
)
{
git_index_clear
(
index
);
git_index_clear
(
index
);
error
=
parse_index
(
index
,
buffer
.
ptr
,
buffer
.
size
);
error
=
parse_index
(
index
,
buffer
.
ptr
,
buffer
.
size
);
if
(
!
error
)
index
->
last_modified
=
mtime
;
git_buf_free
(
&
buffer
);
if
(
!
error
)
}
git_futils_filestamp_set
(
&
index
->
stamp
,
&
stamp
);
git_buf_free
(
&
buffer
);
return
error
;
return
error
;
}
}
...
@@ -443,11 +441,11 @@ int git_index_write(git_index *index)
...
@@ -443,11 +441,11 @@ int git_index_write(git_index *index)
if
((
error
=
git_filebuf_commit
(
&
file
,
GIT_INDEX_FILE_MODE
))
<
0
)
if
((
error
=
git_filebuf_commit
(
&
file
,
GIT_INDEX_FILE_MODE
))
<
0
)
return
error
;
return
error
;
if
(
p_stat
(
index
->
index_file_path
,
&
indexst
)
==
0
)
{
error
=
git_futils_filestamp_check
(
&
index
->
stamp
,
index
->
index_file_path
);
index
->
last_modified
=
indexst
.
st_mtime
;
if
(
error
<
0
)
index
->
on_disk
=
1
;
return
error
;
}
index
->
on_disk
=
1
;
return
0
;
return
0
;
}
}
...
...
src/index.h
View file @
8ff0f325
...
@@ -22,7 +22,7 @@ struct git_index {
...
@@ -22,7 +22,7 @@ struct git_index {
char
*
index_file_path
;
char
*
index_file_path
;
time_t
last_modified
;
git_futils_filestamp
stamp
;
git_vector
entries
;
git_vector
entries
;
unsigned
int
on_disk
:
1
;
unsigned
int
on_disk
:
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment