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
fef5344c
Commit
fef5344c
authored
Jun 16, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge::workdir::dirty: tick idx to defeat racy-git
parent
121c3171
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
tests/merge/workdir/dirty.c
+12
-0
No files found.
tests/merge/workdir/dirty.c
View file @
fef5344c
...
...
@@ -2,6 +2,7 @@
#include "git2/merge.h"
#include "buffer.h"
#include "merge.h"
#include "index.h"
#include "../merge_helpers.h"
#include "posix.h"
...
...
@@ -231,9 +232,20 @@ static int merge_differently_filtered_files(char *files[])
cl_git_pass
(
git_reference_peel
(
&
head_object
,
head
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reset
(
repo
,
head_object
,
GIT_RESET_HARD
,
NULL
));
/* Emulate checkout with a broken or misconfigured filter: modify some
* files on-disk and then update the index with the updated file size
* and time, as if some filter applied them. These files should not be
* treated as dirty since we created them.
*
* (Make sure to update the index stamp to defeat racy-git protections
* trying to sanity check the files in the index; those would rehash the
* files, showing them as dirty, the exact mechanism we're trying to avoid.)
*/
write_files
(
files
);
hack_index
(
files
);
repo_index
->
stamp
.
mtime
=
time
(
NULL
)
+
1
;
cl_git_pass
(
git_index_write
(
repo_index
));
error
=
merge_branch
();
...
...
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