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
18e71e6d
Commit
18e71e6d
authored
Nov 28, 2018
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index: use new enum and structure names
Use the new-style index names throughout our own codebase.
parent
19faf7c5
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
152 additions
and
151 deletions
+152
-151
src/diff_generate.c
+3
-3
src/idxmap.c
+3
-3
src/index.c
+47
-47
src/repository.c
+2
-1
src/submodule.c
+1
-1
tests/apply/apply_helpers.c
+2
-2
tests/checkout/conflict.c
+1
-1
tests/checkout/index.c
+3
-3
tests/checkout/tree.c
+3
-3
tests/diff/workdir.c
+3
-3
tests/index/bypath.c
+2
-2
tests/index/collision.c
+5
-5
tests/index/conflicts.c
+19
-19
tests/index/filemodes.c
+3
-3
tests/index/names.c
+3
-3
tests/index/racy.c
+12
-12
tests/index/read_index.c
+3
-3
tests/index/reuc.c
+3
-3
tests/index/tests.c
+6
-6
tests/iterator/index.c
+12
-12
tests/object/tree/duplicateentries.c
+9
-9
tests/reset/hard.c
+1
-1
tests/status/ignore.c
+1
-1
tests/status/renames.c
+2
-2
tests/status/worktree.c
+3
-3
No files found.
src/diff_generate.c
View file @
18e71e6d
...
...
@@ -138,7 +138,7 @@ static int diff_delta__from_one(
if
(
DIFF_FLAG_IS_SET
(
diff
,
GIT_DIFF_REVERSE
))
has_old
=
!
has_old
;
if
((
entry
->
flags
&
GIT_I
DX
ENTRY_VALID
)
!=
0
)
if
((
entry
->
flags
&
GIT_I
NDEX_
ENTRY_VALID
)
!=
0
)
return
0
;
if
(
status
==
GIT_DELTA_IGNORED
&&
...
...
@@ -764,11 +764,11 @@ static int maybe_modified(
status
=
GIT_DELTA_CONFLICTED
;
/* support "assume unchanged" (poorly, b/c we still stat everything) */
}
else
if
((
oitem
->
flags
&
GIT_I
DX
ENTRY_VALID
)
!=
0
)
{
}
else
if
((
oitem
->
flags
&
GIT_I
NDEX_
ENTRY_VALID
)
!=
0
)
{
status
=
GIT_DELTA_UNMODIFIED
;
/* support "skip worktree" index bit */
}
else
if
((
oitem
->
flags_extended
&
GIT_I
DX
ENTRY_SKIP_WORKTREE
)
!=
0
)
{
}
else
if
((
oitem
->
flags_extended
&
GIT_I
NDEX_
ENTRY_SKIP_WORKTREE
)
!=
0
)
{
status
=
GIT_DELTA_UNMODIFIED
;
/* if basic type of file changed, then split into delete and add */
...
...
src/idxmap.c
View file @
18e71e6d
...
...
@@ -23,11 +23,11 @@ static kh_inline khint_t idxentry_hash(const git_index_entry *e)
const
char
*
s
=
e
->
path
;
khint_t
h
=
(
khint_t
)
git__tolower
(
*
s
);
if
(
h
)
for
(
++
s
;
*
s
;
++
s
)
h
=
(
h
<<
5
)
-
h
+
(
khint_t
)
git__tolower
(
*
s
);
return
h
+
GIT_I
DX
ENTRY_STAGE
(
e
);
return
h
+
GIT_I
NDEX_
ENTRY_STAGE
(
e
);
}
#define idxentry_equal(a, b) (GIT_I
DXENTRY_STAGE(a) == GIT_IDX
ENTRY_STAGE(b) && strcmp(a->path, b->path) == 0)
#define idxentry_icase_equal(a, b) (GIT_I
DXENTRY_STAGE(a) == GIT_IDX
ENTRY_STAGE(b) && strcasecmp(a->path, b->path) == 0)
#define idxentry_equal(a, b) (GIT_I
NDEX_ENTRY_STAGE(a) == GIT_INDEX_
ENTRY_STAGE(b) && strcmp(a->path, b->path) == 0)
#define idxentry_icase_equal(a, b) (GIT_I
NDEX_ENTRY_STAGE(a) == GIT_INDEX_
ENTRY_STAGE(b) && strcasecmp(a->path, b->path) == 0)
__KHASH_IMPL
(
idx
,
static
kh_inline
,
const
git_index_entry
*
,
git_index_entry
*
,
1
,
idxentry_hash
,
idxentry_equal
)
__KHASH_IMPL
(
idxicase
,
static
kh_inline
,
const
git_index_entry
*
,
git_index_entry
*
,
1
,
idxentry_hash
,
idxentry_icase_equal
)
...
...
src/index.c
View file @
18e71e6d
...
...
@@ -168,7 +168,7 @@ int git_index_entry_srch(const void *key, const void *array_member)
return
1
;
if
(
srch_key
->
stage
!=
GIT_INDEX_STAGE_ANY
)
return
srch_key
->
stage
-
GIT_I
DX
ENTRY_STAGE
(
&
entry
->
entry
);
return
srch_key
->
stage
-
GIT_I
NDEX_
ENTRY_STAGE
(
&
entry
->
entry
);
return
0
;
}
...
...
@@ -194,7 +194,7 @@ int git_index_entry_isrch(const void *key, const void *array_member)
return
1
;
if
(
srch_key
->
stage
!=
GIT_INDEX_STAGE_ANY
)
return
srch_key
->
stage
-
GIT_I
DX
ENTRY_STAGE
(
&
entry
->
entry
);
return
srch_key
->
stage
-
GIT_I
NDEX_
ENTRY_STAGE
(
&
entry
->
entry
);
return
0
;
}
...
...
@@ -222,7 +222,7 @@ int git_index_entry_cmp(const void *a, const void *b)
diff
=
strcmp
(
entry_a
->
path
,
entry_b
->
path
);
if
(
diff
==
0
)
diff
=
(
GIT_I
DXENTRY_STAGE
(
entry_a
)
-
GIT_IDX
ENTRY_STAGE
(
entry_b
));
diff
=
(
GIT_I
NDEX_ENTRY_STAGE
(
entry_a
)
-
GIT_INDEX_
ENTRY_STAGE
(
entry_b
));
return
diff
;
}
...
...
@@ -236,7 +236,7 @@ int git_index_entry_icmp(const void *a, const void *b)
diff
=
strcasecmp
(
entry_a
->
path
,
entry_b
->
path
);
if
(
diff
==
0
)
diff
=
(
GIT_I
DXENTRY_STAGE
(
entry_a
)
-
GIT_IDX
ENTRY_STAGE
(
entry_b
));
diff
=
(
GIT_I
NDEX_ENTRY_STAGE
(
entry_a
)
-
GIT_INDEX_
ENTRY_STAGE
(
entry_b
));
return
diff
;
}
...
...
@@ -562,7 +562,7 @@ int git_index_set_caps(git_index *index, int caps)
old_ignore_case
=
index
->
ignore_case
;
if
(
caps
==
GIT_INDEX
CAP
_FROM_OWNER
)
{
if
(
caps
==
GIT_INDEX
_CAPABILITY
_FROM_OWNER
)
{
git_repository
*
repo
=
INDEX_OWNER
(
index
);
int
val
;
...
...
@@ -578,9 +578,9 @@ int git_index_set_caps(git_index *index, int caps)
index
->
no_symlinks
=
(
val
==
0
);
}
else
{
index
->
ignore_case
=
((
caps
&
GIT_INDEX
CAP
_IGNORE_CASE
)
!=
0
);
index
->
distrust_filemode
=
((
caps
&
GIT_INDEX
CAP
_NO_FILEMODE
)
!=
0
);
index
->
no_symlinks
=
((
caps
&
GIT_INDEX
CAP
_NO_SYMLINKS
)
!=
0
);
index
->
ignore_case
=
((
caps
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
!=
0
);
index
->
distrust_filemode
=
((
caps
&
GIT_INDEX
_CAPABILITY
_NO_FILEMODE
)
!=
0
);
index
->
no_symlinks
=
((
caps
&
GIT_INDEX
_CAPABILITY
_NO_SYMLINKS
)
!=
0
);
}
if
(
old_ignore_case
!=
index
->
ignore_case
)
{
...
...
@@ -592,9 +592,9 @@ int git_index_set_caps(git_index *index, int caps)
int
git_index_caps
(
const
git_index
*
index
)
{
return
((
index
->
ignore_case
?
GIT_INDEX
CAP
_IGNORE_CASE
:
0
)
|
(
index
->
distrust_filemode
?
GIT_INDEX
CAP
_NO_FILEMODE
:
0
)
|
(
index
->
no_symlinks
?
GIT_INDEX
CAP
_NO_SYMLINKS
:
0
));
return
((
index
->
ignore_case
?
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
:
0
)
|
(
index
->
distrust_filemode
?
GIT_INDEX
_CAPABILITY
_NO_FILEMODE
:
0
)
|
(
index
->
no_symlinks
?
GIT_INDEX
_CAPABILITY
_NO_SYMLINKS
:
0
));
}
const
git_oid
*
git_index_checksum
(
git_index
*
index
)
...
...
@@ -736,7 +736,7 @@ static int truncate_racily_clean(git_index *index)
diff_opts
.
flags
|=
GIT_DIFF_INCLUDE_TYPECHANGE
|
GIT_DIFF_IGNORE_SUBMODULES
|
GIT_DIFF_DISABLE_PATHSPEC_MATCH
;
git_vector_foreach
(
&
index
->
entries
,
i
,
entry
)
{
if
((
entry
->
flags_extended
&
GIT_I
DX
ENTRY_UPTODATE
)
==
0
&&
if
((
entry
->
flags_extended
&
GIT_I
NDEX_
ENTRY_UPTODATE
)
==
0
&&
is_racy_entry
(
index
,
entry
))
git_vector_insert
(
&
paths
,
(
char
*
)
entry
->
path
);
}
...
...
@@ -857,7 +857,7 @@ const git_index_entry *git_index_get_bypath(
assert
(
index
);
key
.
path
=
path
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
key
,
stage
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
key
,
stage
);
LOOKUP_IN_MAP
(
pos
,
index
,
&
key
);
...
...
@@ -890,12 +890,12 @@ static void index_entry_adjust_namemask(
git_index_entry
*
entry
,
size_t
path_length
)
{
entry
->
flags
&=
~
GIT_I
DX
ENTRY_NAMEMASK
;
entry
->
flags
&=
~
GIT_I
NDEX_
ENTRY_NAMEMASK
;
if
(
path_length
<
GIT_I
DX
ENTRY_NAMEMASK
)
entry
->
flags
|=
path_length
&
GIT_I
DX
ENTRY_NAMEMASK
;
if
(
path_length
<
GIT_I
NDEX_
ENTRY_NAMEMASK
)
entry
->
flags
|=
path_length
&
GIT_I
NDEX_
ENTRY_NAMEMASK
;
else
entry
->
flags
|=
GIT_I
DX
ENTRY_NAMEMASK
;
entry
->
flags
|=
GIT_I
NDEX_
ENTRY_NAMEMASK
;
}
/* When `from_workdir` is true, we will validate the paths to avoid placing
...
...
@@ -1078,7 +1078,7 @@ static void index_entry_cpy_nocache(
git_oid_cpy
(
&
tgt
->
id
,
&
src
->
id
);
tgt
->
mode
=
src
->
mode
;
tgt
->
flags
=
src
->
flags
;
tgt
->
flags_extended
=
(
src
->
flags_extended
&
GIT_I
DX
ENTRY_EXTENDED_FLAGS
);
tgt
->
flags_extended
=
(
src
->
flags_extended
&
GIT_I
NDEX_
ENTRY_EXTENDED_FLAGS
);
}
static
int
index_entry_dup_nocache
(
...
...
@@ -1097,7 +1097,7 @@ static int has_file_name(git_index *index,
const
git_index_entry
*
entry
,
size_t
pos
,
int
ok_to_replace
)
{
size_t
len
=
strlen
(
entry
->
path
);
int
stage
=
GIT_I
DX
ENTRY_STAGE
(
entry
);
int
stage
=
GIT_I
NDEX_
ENTRY_STAGE
(
entry
);
const
char
*
name
=
entry
->
path
;
while
(
pos
<
index
->
entries
.
length
)
{
...
...
@@ -1107,7 +1107,7 @@ static int has_file_name(git_index *index,
break
;
if
(
memcmp
(
name
,
p
->
path
,
len
))
break
;
if
(
GIT_I
DX
ENTRY_STAGE
(
&
p
->
entry
)
!=
stage
)
if
(
GIT_I
NDEX_
ENTRY_STAGE
(
&
p
->
entry
)
!=
stage
)
continue
;
if
(
p
->
path
[
len
]
!=
'/'
)
continue
;
...
...
@@ -1127,7 +1127,7 @@ static int has_file_name(git_index *index,
static
int
has_dir_name
(
git_index
*
index
,
const
git_index_entry
*
entry
,
int
ok_to_replace
)
{
int
stage
=
GIT_I
DX
ENTRY_STAGE
(
entry
);
int
stage
=
GIT_I
NDEX_
ENTRY_STAGE
(
entry
);
const
char
*
name
=
entry
->
path
;
const
char
*
slash
=
name
+
strlen
(
name
);
...
...
@@ -1164,7 +1164,7 @@ static int has_dir_name(git_index *index,
memcmp
(
p
->
path
,
name
,
len
))
break
;
/* not our subdirectory */
if
(
GIT_I
DX
ENTRY_STAGE
(
&
p
->
entry
)
==
stage
)
if
(
GIT_I
NDEX_
ENTRY_STAGE
(
&
p
->
entry
)
==
stage
)
return
0
;
}
}
...
...
@@ -1222,7 +1222,7 @@ static int canonicalize_directory_path(
&
pos
,
&
index
->
entries
,
index
->
entries_search_path
,
search
);
while
((
match
=
git_vector_get
(
&
index
->
entries
,
pos
)))
{
if
(
GIT_I
DX
ENTRY_STAGE
(
match
)
!=
0
)
{
if
(
GIT_I
NDEX_
ENTRY_STAGE
(
match
)
!=
0
)
{
/* conflicts do not contribute to canonical paths */
}
else
if
(
strncmp
(
search
,
match
->
path
,
search_len
)
==
0
)
{
/* prefer an exact match to the input filename */
...
...
@@ -1260,7 +1260,7 @@ static int index_no_dups(void **old, void *new)
const
git_index_entry
*
entry
=
new
;
GIT_UNUSED
(
old
);
giterr_set
(
GITERR_INDEX
,
"'%s' appears multiple times at stage %d"
,
entry
->
path
,
GIT_I
DX
ENTRY_STAGE
(
entry
));
entry
->
path
,
GIT_I
NDEX_
ENTRY_STAGE
(
entry
));
return
GIT_EEXISTS
;
}
...
...
@@ -1276,7 +1276,7 @@ static void index_existing_and_best(
int
error
;
error
=
index_find
(
&
pos
,
index
,
entry
->
path
,
0
,
GIT_I
DX
ENTRY_STAGE
(
entry
));
index
,
entry
->
path
,
0
,
GIT_I
NDEX_
ENTRY_STAGE
(
entry
));
if
(
error
==
0
)
{
*
existing
=
index
->
entries
.
contents
[
pos
];
...
...
@@ -1289,7 +1289,7 @@ static void index_existing_and_best(
*
existing_position
=
0
;
*
best
=
NULL
;
if
(
GIT_I
DX
ENTRY_STAGE
(
entry
)
==
0
)
{
if
(
GIT_I
NDEX_
ENTRY_STAGE
(
entry
)
==
0
)
{
for
(;
pos
<
index
->
entries
.
length
;
pos
++
)
{
int
(
*
strcomp
)(
const
char
*
a
,
const
char
*
b
)
=
index
->
ignore_case
?
git__strcasecmp
:
git__strcmp
;
...
...
@@ -1299,7 +1299,7 @@ static void index_existing_and_best(
if
(
strcomp
(
entry
->
path
,
e
->
path
)
!=
0
)
break
;
if
(
GIT_I
DX
ENTRY_STAGE
(
e
)
==
GIT_INDEX_STAGE_ANCESTOR
)
{
if
(
GIT_I
NDEX_
ENTRY_STAGE
(
e
)
==
GIT_INDEX_STAGE_ANCESTOR
)
{
*
best
=
e
;
continue
;
}
else
{
...
...
@@ -1344,7 +1344,7 @@ static int index_insert(
index_entry_adjust_namemask
(
entry
,
path_length
);
/* This entry is now up-to-date and should not be checked for raciness */
entry
->
flags_extended
|=
GIT_I
DX
ENTRY_UPTODATE
;
entry
->
flags_extended
|=
GIT_I
NDEX_
ENTRY_UPTODATE
;
git_vector_sort
(
&
index
->
entries
);
...
...
@@ -1628,7 +1628,7 @@ int git_index__fill(git_index *index, const git_vector *source_entries)
break
;
index_entry_adjust_namemask
(
entry
,
((
struct
entry_internal
*
)
entry
)
->
pathlen
);
entry
->
flags_extended
|=
GIT_I
DX
ENTRY_UPTODATE
;
entry
->
flags_extended
|=
GIT_I
NDEX_
ENTRY_UPTODATE
;
entry
->
mode
=
git_index__create_mode
(
entry
->
mode
);
if
((
ret
=
git_vector_insert
(
&
index
->
entries
,
entry
))
<
0
)
...
...
@@ -1675,7 +1675,7 @@ int git_index_remove(git_index *index, const char *path, int stage)
git_index_entry
remove_key
=
{{
0
}};
remove_key
.
path
=
path
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
remove_key
,
stage
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
remove_key
,
stage
);
DELETE_IN_MAP
(
index
,
&
remove_key
);
...
...
@@ -1706,7 +1706,7 @@ int git_index_remove_directory(git_index *index, const char *dir, int stage)
if
(
!
entry
||
git__prefixcmp
(
entry
->
path
,
pfx
.
ptr
)
!=
0
)
break
;
if
(
GIT_I
DX
ENTRY_STAGE
(
entry
)
!=
stage
)
{
if
(
GIT_I
NDEX_
ENTRY_STAGE
(
entry
)
!=
stage
)
{
++
pos
;
continue
;
}
...
...
@@ -1822,7 +1822,7 @@ int git_index_conflict_add(git_index *index,
continue
;
/* Make sure stage is correct */
GIT_I
DX
ENTRY_STAGE_SET
(
entries
[
i
],
i
+
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
entries
[
i
],
i
+
1
);
if
((
ret
=
index_insert
(
index
,
&
entries
[
i
],
1
,
true
,
true
,
false
))
<
0
)
goto
on_error
;
...
...
@@ -1865,7 +1865,7 @@ static int index_conflict__get_byindex(
if
(
path
&&
index
->
entries_cmp_path
(
conflict_entry
->
path
,
path
)
!=
0
)
break
;
stage
=
GIT_I
DX
ENTRY_STAGE
(
conflict_entry
);
stage
=
GIT_I
NDEX_
ENTRY_STAGE
(
conflict_entry
);
path
=
conflict_entry
->
path
;
switch
(
stage
)
{
...
...
@@ -1932,7 +1932,7 @@ static int index_conflict_remove(git_index *index, const char *path)
index
->
entries_cmp_path
(
conflict_entry
->
path
,
path
)
!=
0
)
break
;
if
(
GIT_I
DX
ENTRY_STAGE
(
conflict_entry
)
==
0
)
{
if
(
GIT_I
NDEX_
ENTRY_STAGE
(
conflict_entry
)
==
0
)
{
pos
++
;
continue
;
}
...
...
@@ -1964,7 +1964,7 @@ int git_index_has_conflicts(const git_index *index)
assert
(
index
);
git_vector_foreach
(
&
index
->
entries
,
i
,
entry
)
{
if
(
GIT_I
DX
ENTRY_STAGE
(
entry
)
>
0
)
if
(
GIT_I
NDEX_
ENTRY_STAGE
(
entry
)
>
0
)
return
1
;
}
...
...
@@ -2386,13 +2386,13 @@ out_err:
static
size_t
index_entry_size
(
size_t
path_len
,
size_t
varint_len
,
uint32_t
flags
)
{
if
(
varint_len
)
{
if
(
flags
&
GIT_I
DX
ENTRY_EXTENDED
)
if
(
flags
&
GIT_I
NDEX_
ENTRY_EXTENDED
)
return
offsetof
(
struct
entry_long
,
path
)
+
path_len
+
1
+
varint_len
;
else
return
offsetof
(
struct
entry_short
,
path
)
+
path_len
+
1
+
varint_len
;
}
else
{
#define entry_size(type,len) ((offsetof(type, path) + (len) + 8) & ~7)
if
(
flags
&
GIT_I
DX
ENTRY_EXTENDED
)
if
(
flags
&
GIT_I
NDEX_
ENTRY_EXTENDED
)
return
entry_size
(
struct
entry_long
,
path_len
);
else
return
entry_size
(
struct
entry_short
,
path_len
);
...
...
@@ -2434,7 +2434,7 @@ static int read_entry(
git_oid_cpy
(
&
entry
.
id
,
&
source
.
oid
);
entry
.
flags
=
ntohs
(
source
.
flags
);
if
(
entry
.
flags
&
GIT_I
DX
ENTRY_EXTENDED
)
{
if
(
entry
.
flags
&
GIT_I
NDEX_
ENTRY_EXTENDED
)
{
uint16_t
flags_raw
;
size_t
flags_offset
;
...
...
@@ -2449,7 +2449,7 @@ static int read_entry(
path_ptr
=
(
const
char
*
)
buffer
+
offsetof
(
struct
entry_short
,
path
);
if
(
!
compressed
)
{
path_length
=
entry
.
flags
&
GIT_I
DX
ENTRY_NAMEMASK
;
path_length
=
entry
.
flags
&
GIT_I
NDEX_
ENTRY_NAMEMASK
;
/* if this is a very long string, we must find its
* real length without overflowing */
...
...
@@ -2694,10 +2694,10 @@ static bool is_index_extended(git_index *index)
extended
=
0
;
git_vector_foreach
(
&
index
->
entries
,
i
,
entry
)
{
entry
->
flags
&=
~
GIT_I
DX
ENTRY_EXTENDED
;
if
(
entry
->
flags_extended
&
GIT_I
DX
ENTRY_EXTENDED_FLAGS
)
{
entry
->
flags
&=
~
GIT_I
NDEX_
ENTRY_EXTENDED
;
if
(
entry
->
flags_extended
&
GIT_I
NDEX_
ENTRY_EXTENDED_FLAGS
)
{
extended
++
;
entry
->
flags
|=
GIT_I
DX
ENTRY_EXTENDED
;
entry
->
flags
|=
GIT_I
NDEX_
ENTRY_EXTENDED
;
}
}
...
...
@@ -2762,11 +2762,11 @@ static int write_disk_entry(git_filebuf *file, git_index_entry *entry, const cha
ondisk
.
flags
=
htons
(
entry
->
flags
);
if
(
entry
->
flags
&
GIT_I
DX
ENTRY_EXTENDED
)
{
if
(
entry
->
flags
&
GIT_I
NDEX_
ENTRY_EXTENDED
)
{
struct
entry_long
ondisk_ext
;
memcpy
(
&
ondisk_ext
,
&
ondisk
,
sizeof
(
struct
entry_short
));
ondisk_ext
.
flags_extended
=
htons
(
entry
->
flags_extended
&
GIT_I
DX
ENTRY_EXTENDED_FLAGS
);
GIT_I
NDEX_
ENTRY_EXTENDED_FLAGS
);
memcpy
(
mem
,
&
ondisk_ext
,
offsetof
(
struct
entry_long
,
path
));
path
=
((
struct
entry_long
*
)
mem
)
->
path
;
disk_size
-=
offsetof
(
struct
entry_long
,
path
);
...
...
@@ -2980,7 +2980,7 @@ static void clear_uptodate(git_index *index)
size_t
i
;
git_vector_foreach
(
&
index
->
entries
,
i
,
entry
)
entry
->
flags_extended
&=
~
GIT_I
DX
ENTRY_UPTODATE
;
entry
->
flags_extended
&=
~
GIT_I
NDEX_
ENTRY_UPTODATE
;
}
static
int
write_index
(
git_oid
*
checksum
,
git_index
*
index
,
git_filebuf
*
file
)
...
...
@@ -3037,12 +3037,12 @@ static int write_index(git_oid *checksum, git_index *index, git_filebuf *file)
int
git_index_entry_stage
(
const
git_index_entry
*
entry
)
{
return
GIT_I
DX
ENTRY_STAGE
(
entry
);
return
GIT_I
NDEX_
ENTRY_STAGE
(
entry
);
}
int
git_index_entry_is_conflict
(
const
git_index_entry
*
entry
)
{
return
(
GIT_I
DX
ENTRY_STAGE
(
entry
)
>
0
);
return
(
GIT_I
NDEX_
ENTRY_STAGE
(
entry
)
>
0
);
}
typedef
struct
read_tree_data
{
...
...
src/repository.c
View file @
18e71e6d
...
...
@@ -1186,7 +1186,8 @@ int git_repository_index__weakptr(git_index **out, git_repository *repo)
git_index_free
(
index
);
}
error
=
git_index_set_caps
(
repo
->
_index
,
GIT_INDEXCAP_FROM_OWNER
);
error
=
git_index_set_caps
(
repo
->
_index
,
GIT_INDEX_CAPABILITY_FROM_OWNER
);
}
git_buf_dispose
(
&
index_path
);
...
...
src/submodule.c
View file @
18e71e6d
...
...
@@ -889,7 +889,7 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
memset
(
&
entry
,
0
,
sizeof
(
entry
));
entry
.
path
=
sm
->
path
;
git_index_entry__init_from_stat
(
&
entry
,
&
st
,
!
(
git_index_caps
(
index
)
&
GIT_INDEX
CAP
_NO_FILEMODE
));
&
entry
,
&
st
,
!
(
git_index_caps
(
index
)
&
GIT_INDEX
_CAPABILITY
_NO_FILEMODE
));
/* calling git_submodule_open will have set sm->wd_oid if possible */
if
((
sm
->
flags
&
GIT_SUBMODULE_STATUS__WD_OID_VALID
)
==
0
)
{
...
...
tests/apply/apply_helpers.c
View file @
18e71e6d
...
...
@@ -13,7 +13,7 @@ static int iterator_compare(const git_index_entry *entry, void *_data)
struct
iterator_compare_data
*
data
=
(
struct
iterator_compare_data
*
)
_data
;
cl_assert_equal_i
(
GIT_I
DX
ENTRY_STAGE
(
entry
),
data
->
expected
[
data
->
idx
].
stage
);
cl_assert_equal_i
(
GIT_I
NDEX_
ENTRY_STAGE
(
entry
),
data
->
expected
[
data
->
idx
].
stage
);
cl_git_pass
(
git_oid_fromstr
(
&
expected_id
,
data
->
expected
[
data
->
idx
].
oid_str
));
cl_assert_equal_oid
(
&
entry
->
id
,
&
expected_id
);
cl_assert_equal_i
(
entry
->
mode
,
data
->
expected
[
data
->
idx
].
mode
);
...
...
@@ -75,7 +75,7 @@ static int iterator_eq(const git_index_entry **entry, void *_data)
if
(
!
entry
[
0
]
||
!
entry
[
1
])
return
-
1
;
cl_assert_equal_i
(
GIT_I
DXENTRY_STAGE
(
entry
[
0
]),
GIT_IDX
ENTRY_STAGE
(
entry
[
1
]));
cl_assert_equal_i
(
GIT_I
NDEX_ENTRY_STAGE
(
entry
[
0
]),
GIT_INDEX_
ENTRY_STAGE
(
entry
[
1
]));
cl_assert_equal_oid
(
&
entry
[
0
]
->
id
,
&
entry
[
1
]
->
id
);
cl_assert_equal_i
(
entry
[
0
]
->
mode
,
entry
[
1
]
->
mode
);
cl_assert_equal_s
(
entry
[
0
]
->
path
,
entry
[
1
]
->
path
);
...
...
tests/checkout/conflict.c
View file @
18e71e6d
...
...
@@ -103,7 +103,7 @@ static void create_index(struct checkout_index_entry *entries, size_t entries_le
memset
(
&
entry
,
0x0
,
sizeof
(
git_index_entry
));
entry
.
mode
=
entries
[
i
].
mode
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
entries
[
i
].
stage
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
entries
[
i
].
stage
);
git_oid_fromstr
(
&
entry
.
id
,
entries
[
i
].
oid_str
);
entry
.
path
=
entries
[
i
].
path
;
...
...
tests/checkout/index.c
View file @
18e71e6d
...
...
@@ -733,15 +733,15 @@ static void add_conflict(git_index *index, const char *path)
entry
.
path
=
path
;
git_oid_fromstr
(
&
entry
.
id
,
"d427e0b2e138501a3d15cc376077a3631e15bd46"
);
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
1
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
git_oid_fromstr
(
&
entry
.
id
,
"4e886e602529caa9ab11d71f86634bd1b6e0de10"
);
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
2
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
git_oid_fromstr
(
&
entry
.
id
,
"2bd0a343aeef7a2cf0d158478966a6e587ff3863"
);
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
3
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
3
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
}
...
...
tests/checkout/tree.c
View file @
18e71e6d
...
...
@@ -941,16 +941,16 @@ static void create_conflict(const char *path)
memset
(
&
entry
,
0x0
,
sizeof
(
git_index_entry
));
entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
1
);
git_oid_fromstr
(
&
entry
.
id
,
"d427e0b2e138501a3d15cc376077a3631e15bd46"
);
entry
.
path
=
path
;
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
2
);
git_oid_fromstr
(
&
entry
.
id
,
"ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf"
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
3
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
3
);
git_oid_fromstr
(
&
entry
.
id
,
"2bd0a343aeef7a2cf0d158478966a6e587ff3863"
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
...
...
tests/diff/workdir.c
View file @
18e71e6d
...
...
@@ -145,12 +145,12 @@ void test_diff_workdir__to_index_with_assume_unchanged(void)
cl_assert
((
iep
=
git_index_get_bypath
(
idx
,
"modified_file"
,
0
))
!=
NULL
);
memcpy
(
&
ie
,
iep
,
sizeof
(
ie
));
ie
.
flags
|=
GIT_I
DX
ENTRY_VALID
;
ie
.
flags
|=
GIT_I
NDEX_
ENTRY_VALID
;
cl_git_pass
(
git_index_add
(
idx
,
&
ie
));
cl_assert
((
iep
=
git_index_get_bypath
(
idx
,
"file_deleted"
,
0
))
!=
NULL
);
memcpy
(
&
ie
,
iep
,
sizeof
(
ie
));
ie
.
flags
|=
GIT_I
DX
ENTRY_VALID
;
ie
.
flags
|=
GIT_I
NDEX_
ENTRY_VALID
;
cl_git_pass
(
git_index_add
(
idx
,
&
ie
));
cl_git_pass
(
git_index_write
(
idx
));
...
...
@@ -749,7 +749,7 @@ void test_diff_workdir__filemode_changes_with_filemode_false(void)
cl_git_pass
(
git_diff_index_to_workdir
(
&
diff
,
g_repo
,
NULL
,
NULL
));
memset
(
&
exp
,
0
,
sizeof
(
exp
));
cl_git_pass
(
git_diff_foreach
(
diff
,
cl_git_pass
(
git_diff_foreach
(
diff
,
diff_file_cb
,
diff_binary_cb
,
diff_hunk_cb
,
diff_line_cb
,
&
exp
));
cl_assert_equal_i
(
0
,
exp
.
files
);
...
...
tests/index/bypath.c
View file @
18e71e6d
...
...
@@ -285,7 +285,7 @@ void test_index_bypath__add_honors_conflict_mode(void)
cl_git_pass
(
git_index_remove_bypath
(
g_idx
,
"README.txt"
));
for
(
stage
=
1
;
stage
<=
3
;
stage
++
)
{
new_entry
.
flags
=
stage
<<
GIT_I
DX
ENTRY_STAGESHIFT
;
new_entry
.
flags
=
stage
<<
GIT_I
NDEX_
ENTRY_STAGESHIFT
;
cl_git_pass
(
git_index_add
(
g_idx
,
&
new_entry
));
}
...
...
@@ -317,7 +317,7 @@ void test_index_bypath__add_honors_conflict_case(void)
cl_git_pass
(
git_index_remove_bypath
(
g_idx
,
"README.txt"
));
for
(
stage
=
1
;
stage
<=
3
;
stage
++
)
{
new_entry
.
flags
=
stage
<<
GIT_I
DX
ENTRY_STAGESHIFT
;
new_entry
.
flags
=
stage
<<
GIT_I
NDEX_
ENTRY_STAGESHIFT
;
cl_git_pass
(
git_index_add
(
g_idx
,
&
new_entry
));
}
...
...
tests/index/collision.c
View file @
18e71e6d
...
...
@@ -108,7 +108,7 @@ void test_index_collision__add_with_highstage_1(void)
git_oid_cpy
(
&
entry
.
id
,
&
g_empty_id
);
entry
.
path
=
"a/b"
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
2
);
cl_git_pass
(
git_index_add
(
g_index
,
&
entry
));
/* create a blob beneath the previous tree entry */
...
...
@@ -118,7 +118,7 @@ void test_index_collision__add_with_highstage_1(void)
/* create another tree entry above the blob */
entry
.
path
=
"a/b"
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
1
);
cl_git_pass
(
git_index_add
(
g_index
,
&
entry
));
}
...
...
@@ -134,16 +134,16 @@ void test_index_collision__add_with_highstage_2(void)
git_oid_cpy
(
&
entry
.
id
,
&
g_empty_id
);
entry
.
path
=
"a/b/c"
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
1
);
cl_git_pass
(
git_index_add
(
g_index
,
&
entry
));
/* create a blob beneath the previous tree entry */
entry
.
path
=
"a/b/c"
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
2
);
cl_git_pass
(
git_index_add
(
g_index
,
&
entry
));
/* create another tree entry above the blob */
entry
.
path
=
"a/b"
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
3
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
3
);
cl_git_pass
(
git_index_add
(
g_index
,
&
entry
));
}
tests/index/conflicts.c
View file @
18e71e6d
...
...
@@ -36,17 +36,17 @@ void test_index_conflicts__add(void)
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor_entry
,
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor_entry
,
1
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
CONFLICTS_ONE_ANCESTOR_OID
);
our_entry
.
path
=
"test-one.txt"
;
our_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
our_entry
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
our_entry
,
2
);
git_oid_fromstr
(
&
our_entry
.
id
,
CONFLICTS_ONE_OUR_OID
);
their_entry
.
path
=
"test-one.txt"
;
their_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor_entry
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor_entry
,
2
);
git_oid_fromstr
(
&
their_entry
.
id
,
CONFLICTS_ONE_THEIR_OID
);
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
...
...
@@ -67,17 +67,17 @@ void test_index_conflicts__add_fixes_incorrect_stage(void)
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor_entry
,
3
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor_entry
,
3
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
CONFLICTS_ONE_ANCESTOR_OID
);
our_entry
.
path
=
"test-one.txt"
;
our_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
our_entry
,
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
our_entry
,
1
);
git_oid_fromstr
(
&
our_entry
.
id
,
CONFLICTS_ONE_OUR_OID
);
their_entry
.
path
=
"test-one.txt"
;
their_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
their_entry
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
their_entry
,
2
);
git_oid_fromstr
(
&
their_entry
.
id
,
CONFLICTS_ONE_THEIR_OID
);
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
...
...
@@ -110,17 +110,17 @@ void test_index_conflicts__add_detects_invalid_filemode(void)
for
(
i
=
0
;
i
<
3
;
i
++
)
{
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor_entry
,
3
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor_entry
,
3
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
CONFLICTS_ONE_ANCESTOR_OID
);
our_entry
.
path
=
"test-one.txt"
;
our_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
our_entry
,
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
our_entry
,
1
);
git_oid_fromstr
(
&
our_entry
.
id
,
CONFLICTS_ONE_OUR_OID
);
their_entry
.
path
=
"test-one.txt"
;
their_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
their_entry
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
their_entry
,
2
);
git_oid_fromstr
(
&
their_entry
.
id
,
CONFLICTS_ONE_THEIR_OID
);
/* Corrupt the conflict entry's mode */
...
...
@@ -150,17 +150,17 @@ void test_index_conflicts__add_removes_stage_zero(void)
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor_entry
,
3
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor_entry
,
3
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
CONFLICTS_ONE_ANCESTOR_OID
);
our_entry
.
path
=
"test-one.txt"
;
our_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
our_entry
,
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
our_entry
,
1
);
git_oid_fromstr
(
&
our_entry
.
id
,
CONFLICTS_ONE_OUR_OID
);
their_entry
.
path
=
"test-one.txt"
;
their_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
their_entry
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
their_entry
,
2
);
git_oid_fromstr
(
&
their_entry
.
id
,
CONFLICTS_ONE_THEIR_OID
);
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
...
...
@@ -356,7 +356,7 @@ void test_index_conflicts__partial(void)
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor_entry
,
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor_entry
,
1
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
CONFLICTS_ONE_ANCESTOR_OID
);
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
NULL
,
NULL
));
...
...
@@ -386,17 +386,17 @@ void test_index_conflicts__case_matters(void)
memset
(
&
their_entry
,
0x0
,
sizeof
(
git_index_entry
));
ancestor_entry
.
path
=
upper_case
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor_entry
,
GIT_INDEX_STAGE_ANCESTOR
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor_entry
,
GIT_INDEX_STAGE_ANCESTOR
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
CONFLICTS_ONE_ANCESTOR_OID
);
ancestor_entry
.
mode
=
GIT_FILEMODE_BLOB
;
our_entry
.
path
=
upper_case
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
our_entry
,
GIT_INDEX_STAGE_OURS
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
our_entry
,
GIT_INDEX_STAGE_OURS
);
git_oid_fromstr
(
&
our_entry
.
id
,
CONFLICTS_ONE_OUR_OID
);
our_entry
.
mode
=
GIT_FILEMODE_BLOB
;
their_entry
.
path
=
upper_case
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
their_entry
,
GIT_INDEX_STAGE_THEIRS
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
their_entry
,
GIT_INDEX_STAGE_THEIRS
);
git_oid_fromstr
(
&
their_entry
.
id
,
CONFLICTS_ONE_THEIR_OID
);
their_entry
.
mode
=
GIT_FILEMODE_BLOB
;
...
...
@@ -404,17 +404,17 @@ void test_index_conflicts__case_matters(void)
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
ancestor_entry
.
path
=
mixed_case
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor_entry
,
GIT_INDEX_STAGE_ANCESTOR
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor_entry
,
GIT_INDEX_STAGE_ANCESTOR
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
CONFLICTS_TWO_ANCESTOR_OID
);
ancestor_entry
.
mode
=
GIT_FILEMODE_BLOB
;
our_entry
.
path
=
mixed_case
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor_entry
,
GIT_INDEX_STAGE_ANCESTOR
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor_entry
,
GIT_INDEX_STAGE_ANCESTOR
);
git_oid_fromstr
(
&
our_entry
.
id
,
CONFLICTS_TWO_OUR_OID
);
ancestor_entry
.
mode
=
GIT_FILEMODE_BLOB
;
their_entry
.
path
=
mixed_case
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
their_entry
,
GIT_INDEX_STAGE_THEIRS
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
their_entry
,
GIT_INDEX_STAGE_THEIRS
);
git_oid_fromstr
(
&
their_entry
.
id
,
CONFLICTS_TWO_THEIR_OID
);
their_entry
.
mode
=
GIT_FILEMODE_BLOB
;
...
...
tests/index/filemodes.c
View file @
18e71e6d
...
...
@@ -78,7 +78,7 @@ void test_index_filemodes__untrusted(void)
cl_repo_set_bool
(
g_repo
,
"core.filemode"
,
false
);
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_assert
((
git_index_caps
(
index
)
&
GIT_INDEX
CAP
_NO_FILEMODE
)
!=
0
);
cl_assert
((
git_index_caps
(
index
)
&
GIT_INDEX
_CAPABILITY
_NO_FILEMODE
)
!=
0
);
/* 1 - add 0644 over existing 0644 -> expect 0644 */
replace_file_with_mode
(
"exec_off"
,
"filemodes/exec_off.0"
,
0644
);
...
...
@@ -122,7 +122,7 @@ void test_index_filemodes__trusted(void)
cl_repo_set_bool
(
g_repo
,
"core.filemode"
,
true
);
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_assert
((
git_index_caps
(
index
)
&
GIT_INDEX
CAP
_NO_FILEMODE
)
==
0
);
cl_assert
((
git_index_caps
(
index
)
&
GIT_INDEX
_CAPABILITY
_NO_FILEMODE
)
==
0
);
/* 1 - add 0644 over existing 0644 -> expect 0644 */
replace_file_with_mode
(
"exec_off"
,
"filemodes/exec_off.0"
,
0644
);
...
...
@@ -245,7 +245,7 @@ void test_index_filemodes__invalid(void)
cl_git_pass
(
git_index_add_bypath
(
index
,
"dummy-file.txt"
));
cl_assert
((
dummy
=
git_index_get_bypath
(
index
,
"dummy-file.txt"
,
0
)));
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
0
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
0
);
entry
.
path
=
"foo"
;
entry
.
mode
=
GIT_OBJ_BLOB
;
git_oid_cpy
(
&
entry
.
id
,
&
dummy
->
id
);
...
...
tests/index/names.c
View file @
18e71e6d
...
...
@@ -41,21 +41,21 @@ static void index_add_conflicts(void)
/* ancestor */
entry
.
path
=
conflict
[
0
];
entry
.
mode
=
GIT_FILEMODE_BLOB
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
GIT_INDEX_STAGE_ANCESTOR
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
GIT_INDEX_STAGE_ANCESTOR
);
git_oid_fromstr
(
&
entry
.
id
,
"1f85ca51b8e0aac893a621b61a9c2661d6aa6d81"
);
cl_git_pass
(
git_index_add
(
repo_index
,
&
entry
));
/* ours */
entry
.
path
=
conflict
[
1
];
entry
.
mode
=
GIT_FILEMODE_BLOB
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
GIT_INDEX_STAGE_OURS
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
GIT_INDEX_STAGE_OURS
);
git_oid_fromstr
(
&
entry
.
id
,
"1f85ca51b8e0aac893a621b61a9c2661d6aa6d81"
);
cl_git_pass
(
git_index_add
(
repo_index
,
&
entry
));
/* theirs */
entry
.
path
=
conflict
[
2
];
entry
.
mode
=
GIT_FILEMODE_BLOB
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
GIT_INDEX_STAGE_THEIRS
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
GIT_INDEX_STAGE_THEIRS
);
git_oid_fromstr
(
&
entry
.
id
,
"1f85ca51b8e0aac893a621b61a9c2661d6aa6d81"
);
cl_git_pass
(
git_index_add
(
repo_index
,
&
entry
));
}
...
...
tests/index/racy.c
View file @
18e71e6d
...
...
@@ -210,13 +210,13 @@ void test_index_racy__adding_to_index_is_uptodate(void)
/* ensure that they're all uptodate */
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"A"
,
0
)));
cl_assert_equal_i
(
GIT_I
DXENTRY_UPTODATE
,
(
entry
->
flags_extended
&
GIT_IDX
ENTRY_UPTODATE
));
cl_assert_equal_i
(
GIT_I
NDEX_ENTRY_UPTODATE
,
(
entry
->
flags_extended
&
GIT_INDEX_
ENTRY_UPTODATE
));
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"B"
,
0
)));
cl_assert_equal_i
(
GIT_I
DXENTRY_UPTODATE
,
(
entry
->
flags_extended
&
GIT_IDX
ENTRY_UPTODATE
));
cl_assert_equal_i
(
GIT_I
NDEX_ENTRY_UPTODATE
,
(
entry
->
flags_extended
&
GIT_INDEX_
ENTRY_UPTODATE
));
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"C"
,
0
)));
cl_assert_equal_i
(
GIT_I
DXENTRY_UPTODATE
,
(
entry
->
flags_extended
&
GIT_IDX
ENTRY_UPTODATE
));
cl_assert_equal_i
(
GIT_I
NDEX_ENTRY_UPTODATE
,
(
entry
->
flags_extended
&
GIT_INDEX_
ENTRY_UPTODATE
));
cl_git_pass
(
git_index_write
(
index
));
...
...
@@ -237,13 +237,13 @@ void test_index_racy__reading_clears_uptodate_bit(void)
/* ensure that no files are uptodate */
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"A"
,
0
)));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
DX
ENTRY_UPTODATE
));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
NDEX_
ENTRY_UPTODATE
));
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"B"
,
0
)));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
DX
ENTRY_UPTODATE
));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
NDEX_
ENTRY_UPTODATE
));
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"C"
,
0
)));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
DX
ENTRY_UPTODATE
));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
NDEX_
ENTRY_UPTODATE
));
git_index_free
(
index
);
}
...
...
@@ -264,13 +264,13 @@ void test_index_racy__read_tree_clears_uptodate_bit(void)
/* ensure that no files are uptodate */
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"A"
,
0
)));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
DX
ENTRY_UPTODATE
));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
NDEX_
ENTRY_UPTODATE
));
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"B"
,
0
)));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
DX
ENTRY_UPTODATE
));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
NDEX_
ENTRY_UPTODATE
));
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"C"
,
0
)));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
DX
ENTRY_UPTODATE
));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
NDEX_
ENTRY_UPTODATE
));
git_tree_free
(
tree
);
git_index_free
(
index
);
...
...
@@ -311,13 +311,13 @@ void test_index_racy__read_index_clears_uptodate_bit(void)
/* ensure that files brought in from the other index are not uptodate */
cl_assert
((
entry
=
git_index_get_bypath
(
newindex
,
"A"
,
0
)));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
DX
ENTRY_UPTODATE
));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
NDEX_
ENTRY_UPTODATE
));
cl_assert
((
entry
=
git_index_get_bypath
(
newindex
,
"B"
,
0
)));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
DX
ENTRY_UPTODATE
));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
NDEX_
ENTRY_UPTODATE
));
cl_assert
((
entry
=
git_index_get_bypath
(
newindex
,
"C"
,
0
)));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
DX
ENTRY_UPTODATE
));
cl_assert_equal_i
(
0
,
(
entry
->
flags_extended
&
GIT_I
NDEX_
ENTRY_UPTODATE
));
git_index_free
(
index
);
git_index_free
(
newindex
);
...
...
tests/index/read_index.c
View file @
18e71e6d
...
...
@@ -147,17 +147,17 @@ static void add_conflicts(git_index *index, const char *filename)
ancestor_entry
.
path
=
filename
;
ancestor_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor_entry
,
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor_entry
,
1
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
ancestor_ids
[
conflict_idx
]);
our_entry
.
path
=
filename
;
our_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
our_entry
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
our_entry
,
2
);
git_oid_fromstr
(
&
our_entry
.
id
,
our_ids
[
conflict_idx
]);
their_entry
.
path
=
filename
;
their_entry
.
mode
=
0100644
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor_entry
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor_entry
,
2
);
git_oid_fromstr
(
&
their_entry
.
id
,
their_ids
[
conflict_idx
]);
cl_git_pass
(
git_index_conflict_add
(
index
,
&
ancestor_entry
,
...
...
tests/index/reuc.c
View file @
18e71e6d
...
...
@@ -129,12 +129,12 @@ void test_index_reuc__ignore_case(void)
index_caps
=
git_index_caps
(
repo_index
);
index_caps
&=
~
GIT_INDEX
CAP
_IGNORE_CASE
;
index_caps
&=
~
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
;
cl_git_pass
(
git_index_set_caps
(
repo_index
,
index_caps
));
cl_assert
(
!
git_index_reuc_get_bypath
(
repo_index
,
"TWO.txt"
));
index_caps
|=
GIT_INDEX
CAP
_IGNORE_CASE
;
index_caps
|=
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
;
cl_git_pass
(
git_index_set_caps
(
repo_index
,
index_caps
));
cl_assert_equal_i
(
2
,
git_index_reuc_entrycount
(
repo_index
));
...
...
@@ -197,7 +197,7 @@ void test_index_reuc__updates_existing(void)
index_caps
=
git_index_caps
(
repo_index
);
index_caps
|=
GIT_INDEX
CAP
_IGNORE_CASE
;
index_caps
|=
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
;
cl_git_pass
(
git_index_set_caps
(
repo_index
,
index_caps
));
git_oid_fromstr
(
&
ancestor_oid
,
TWO_ANCESTOR_OID
);
...
...
tests/index/tests.c
View file @
18e71e6d
...
...
@@ -810,7 +810,7 @@ void test_index_tests__preserves_case(void)
cl_git_rewritefile
(
"myrepo/TEST.txt"
,
"hello again
\n
"
);
cl_git_pass
(
git_index_add_bypath
(
index
,
"TEST.txt"
));
if
(
index_caps
&
GIT_INDEX
CAP
_IGNORE_CASE
)
if
(
index_caps
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
cl_assert_equal_i
(
1
,
(
int
)
git_index_entrycount
(
index
));
else
cl_assert_equal_i
(
2
,
(
int
)
git_index_entrycount
(
index
));
...
...
@@ -821,7 +821,7 @@ void test_index_tests__preserves_case(void)
cl_assert
(
git__strcmp
(
entry
->
path
,
"test.txt"
)
==
0
);
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"TEST.txt"
,
0
))
!=
NULL
);
if
(
index_caps
&
GIT_INDEX
CAP
_IGNORE_CASE
)
if
(
index_caps
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
/* The path should *not* have changed without an explicit remove */
cl_assert
(
git__strcmp
(
entry
->
path
,
"test.txt"
)
==
0
);
else
...
...
@@ -923,13 +923,13 @@ void test_index_tests__reload_while_ignoring_case(void)
cl_git_pass
(
git_vector_verify_sorted
(
&
index
->
entries
));
caps
=
git_index_caps
(
index
);
cl_git_pass
(
git_index_set_caps
(
index
,
caps
&=
~
GIT_INDEX
CAP
_IGNORE_CASE
));
cl_git_pass
(
git_index_set_caps
(
index
,
caps
&=
~
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
));
cl_git_pass
(
git_index_read
(
index
,
true
));
cl_git_pass
(
git_vector_verify_sorted
(
&
index
->
entries
));
cl_assert
(
git_index_get_bypath
(
index
,
".HEADER"
,
0
));
cl_assert_equal_p
(
NULL
,
git_index_get_bypath
(
index
,
".header"
,
0
));
cl_git_pass
(
git_index_set_caps
(
index
,
caps
|
GIT_INDEX
CAP
_IGNORE_CASE
));
cl_git_pass
(
git_index_set_caps
(
index
,
caps
|
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
));
cl_git_pass
(
git_index_read
(
index
,
true
));
cl_git_pass
(
git_vector_verify_sorted
(
&
index
->
entries
));
cl_assert
(
git_index_get_bypath
(
index
,
".HEADER"
,
0
));
...
...
@@ -948,7 +948,7 @@ void test_index_tests__change_icase_on_instance(void)
cl_git_pass
(
git_vector_verify_sorted
(
&
index
->
entries
));
caps
=
git_index_caps
(
index
);
cl_git_pass
(
git_index_set_caps
(
index
,
caps
&=
~
GIT_INDEX
CAP
_IGNORE_CASE
));
cl_git_pass
(
git_index_set_caps
(
index
,
caps
&=
~
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
));
cl_assert_equal_i
(
false
,
index
->
ignore_case
);
cl_git_pass
(
git_vector_verify_sorted
(
&
index
->
entries
));
cl_assert
(
e
=
git_index_get_bypath
(
index
,
"src/common.h"
,
0
));
...
...
@@ -956,7 +956,7 @@ void test_index_tests__change_icase_on_instance(void)
cl_assert
(
e
=
git_index_get_bypath
(
index
,
"COPYING"
,
0
));
cl_assert_equal_p
(
NULL
,
e
=
git_index_get_bypath
(
index
,
"copying"
,
0
));
cl_git_pass
(
git_index_set_caps
(
index
,
caps
|
GIT_INDEX
CAP
_IGNORE_CASE
));
cl_git_pass
(
git_index_set_caps
(
index
,
caps
|
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
));
cl_assert_equal_i
(
true
,
index
->
ignore_case
);
cl_git_pass
(
git_vector_verify_sorted
(
&
index
->
entries
));
cl_assert
(
e
=
git_index_get_bypath
(
index
,
"COPYING"
,
0
));
...
...
tests/iterator/index.c
View file @
18e71e6d
...
...
@@ -222,10 +222,10 @@ static void check_index_range(
cl_git_pass
(
git_repository_index
(
&
index
,
repo
));
caps
=
git_index_caps
(
index
);
is_ignoring_case
=
((
caps
&
GIT_INDEX
CAP
_IGNORE_CASE
)
!=
0
);
is_ignoring_case
=
((
caps
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
!=
0
);
if
(
ignore_case
!=
is_ignoring_case
)
cl_git_pass
(
git_index_set_caps
(
index
,
caps
^
GIT_INDEX
CAP
_IGNORE_CASE
));
cl_git_pass
(
git_index_set_caps
(
index
,
caps
^
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
));
i_opts
.
flags
=
0
;
i_opts
.
start
=
start
;
...
...
@@ -363,7 +363,7 @@ void test_iterator_index__icase_1(void)
caps
=
git_index_caps
(
index
);
/* force case sensitivity */
cl_git_pass
(
git_index_set_caps
(
index
,
caps
&
~
GIT_INDEX
CAP
_IGNORE_CASE
));
cl_git_pass
(
git_index_set_caps
(
index
,
caps
&
~
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
));
/* autoexpand with no tree entries over range */
i_opts
.
start
=
"c"
;
...
...
@@ -409,7 +409,7 @@ void test_iterator_index__icase_1(void)
git_iterator_free
(
i
);
/* force case insensitivity */
cl_git_pass
(
git_index_set_caps
(
index
,
caps
|
GIT_INDEX
CAP
_IGNORE_CASE
));
cl_git_pass
(
git_index_set_caps
(
index
,
caps
|
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
));
/* autoexpand with no tree entries over range */
i_opts
.
flags
=
0
;
...
...
@@ -783,7 +783,7 @@ void test_iterator_index__pathlist_1(void)
cl_git_pass
(
git_vector_insert
(
&
filelist
,
"k/a"
));
/* In this test we DO NOT force a case setting on the index. */
default_icase
=
((
git_index_caps
(
index
)
&
GIT_INDEX
CAP
_IGNORE_CASE
)
!=
0
);
default_icase
=
((
git_index_caps
(
index
)
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
!=
0
);
i_opts
.
pathlist
.
strings
=
(
char
**
)
filelist
.
contents
;
i_opts
.
pathlist
.
count
=
filelist
.
length
;
...
...
@@ -825,7 +825,7 @@ void test_iterator_index__pathlist_2(void)
cl_git_pass
(
git_vector_insert
(
&
filelist
,
"kZZZZZZZ"
));
/* In this test we DO NOT force a case setting on the index. */
default_icase
=
((
git_index_caps
(
index
)
&
GIT_INDEX
CAP
_IGNORE_CASE
)
!=
0
);
default_icase
=
((
git_index_caps
(
index
)
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
!=
0
);
i_opts
.
pathlist
.
strings
=
(
char
**
)
filelist
.
contents
;
i_opts
.
pathlist
.
count
=
filelist
.
length
;
...
...
@@ -867,7 +867,7 @@ void test_iterator_index__pathlist_four(void)
cl_git_pass
(
git_vector_insert
(
&
filelist
,
"kZZZZZZZ"
));
/* In this test we DO NOT force a case setting on the index. */
default_icase
=
((
git_index_caps
(
index
)
&
GIT_INDEX
CAP
_IGNORE_CASE
)
!=
0
);
default_icase
=
((
git_index_caps
(
index
)
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
!=
0
);
i_opts
.
pathlist
.
strings
=
(
char
**
)
filelist
.
contents
;
i_opts
.
pathlist
.
count
=
filelist
.
length
;
...
...
@@ -910,7 +910,7 @@ void test_iterator_index__pathlist_icase(void)
caps
=
git_index_caps
(
index
);
/* force case sensitivity */
cl_git_pass
(
git_index_set_caps
(
index
,
caps
&
~
GIT_INDEX
CAP
_IGNORE_CASE
));
cl_git_pass
(
git_index_set_caps
(
index
,
caps
&
~
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
));
/* All indexfilelist iterator tests are "autoexpand with no tree entries" */
...
...
@@ -930,7 +930,7 @@ void test_iterator_index__pathlist_icase(void)
git_iterator_free
(
i
);
/* force case insensitivity */
cl_git_pass
(
git_index_set_caps
(
index
,
caps
|
GIT_INDEX
CAP
_IGNORE_CASE
));
cl_git_pass
(
git_index_set_caps
(
index
,
caps
|
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
));
i_opts
.
start
=
"c"
;
i_opts
.
end
=
"k/D"
;
...
...
@@ -1297,17 +1297,17 @@ static void add_conflict(
ancestor
.
path
=
ancestor_path
;
ancestor
.
mode
=
GIT_FILEMODE_BLOB
;
git_oid_fromstr
(
&
ancestor
.
id
,
"d44e18fb93b7107b5cd1b95d601591d77869a1b6"
);
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor
,
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor
,
1
);
ours
.
path
=
our_path
;
ours
.
mode
=
GIT_FILEMODE_BLOB
;
git_oid_fromstr
(
&
ours
.
id
,
"d44e18fb93b7107b5cd1b95d601591d77869a1b6"
);
GIT_I
DX
ENTRY_STAGE_SET
(
&
ours
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ours
,
2
);
theirs
.
path
=
their_path
;
theirs
.
mode
=
GIT_FILEMODE_BLOB
;
git_oid_fromstr
(
&
theirs
.
id
,
"d44e18fb93b7107b5cd1b95d601591d77869a1b6"
);
GIT_I
DX
ENTRY_STAGE_SET
(
&
theirs
,
3
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
theirs
,
3
);
cl_git_pass
(
git_index_conflict_add
(
index
,
&
ancestor
,
&
ours
,
&
theirs
));
}
...
...
tests/object/tree/duplicateentries.c
View file @
18e71e6d
...
...
@@ -18,9 +18,9 @@ void test_object_tree_duplicateentries__cleanup(void) {
* parent cf80f8de9f1185bf3a05f993f6121880dd0cfbc9
* author Ben Straub <bstraub@github.com> 1343755506 -0700
* committer Ben Straub <bstraub@github.com> 1343755506 -0700
*
*
* Change a file mode
*
*
* diff --git a/a/b.txt b/a/b.txt
* old mode 100644
* new mode 100755
...
...
@@ -69,7 +69,7 @@ static void two_blobs(git_treebuilder *bld)
{
git_oid
oid
;
const
git_tree_entry
*
entry
;
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
"a8233120f6ad708f843d861ce2b7228ec4e3dec6"
));
/* blob oid (README) */
...
...
@@ -89,7 +89,7 @@ static void one_blob_and_one_tree(git_treebuilder *bld)
{
git_oid
oid
;
const
git_tree_entry
*
entry
;
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
"a8233120f6ad708f843d861ce2b7228ec4e3dec6"
));
/* blob oid (README) */
...
...
@@ -111,7 +111,7 @@ void test_object_tree_duplicateentries__cannot_create_a_duplicate_entry_through_
tree_creator
(
&
tid
,
two_blobs
);
tree_checker
(
&
tid
,
"a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"
,
GIT_FILEMODE_BLOB
);
tree_creator
(
&
tid
,
one_blob_and_one_tree
);
tree_checker
(
&
tid
,
"4e0883eeeeebc1fb1735161cea82f7cb5fab7e63"
,
GIT_FILEMODE_TREE
);
}
...
...
@@ -126,17 +126,17 @@ static void add_fake_conflicts(git_index *index)
ancestor_entry
.
path
=
"duplicate"
;
ancestor_entry
.
mode
=
GIT_FILEMODE_BLOB
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
ancestor_entry
,
1
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
ancestor_entry
,
1
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
"a8233120f6ad708f843d861ce2b7228ec4e3dec6"
);
our_entry
.
path
=
"duplicate"
;
our_entry
.
mode
=
GIT_FILEMODE_BLOB
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
our_entry
,
2
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
our_entry
,
2
);
git_oid_fromstr
(
&
our_entry
.
id
,
"45b983be36b73c0788dc9cbcb76cbb80fc7bb057"
);
their_entry
.
path
=
"duplicate"
;
their_entry
.
mode
=
GIT_FILEMODE_BLOB
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
their_entry
,
3
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
their_entry
,
3
);
git_oid_fromstr
(
&
their_entry
.
id
,
"a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"
);
cl_git_pass
(
git_index_conflict_add
(
index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
...
...
@@ -149,7 +149,7 @@ void test_object_tree_duplicateentries__cannot_create_a_duplicate_entry_building
cl_git_pass
(
git_repository_index
(
&
index
,
_repo
));
add_fake_conflicts
(
index
);
add_fake_conflicts
(
index
);
cl_assert_equal_i
(
GIT_EUNMERGED
,
git_index_write_tree
(
&
tid
,
index
));
...
...
tests/reset/hard.c
View file @
18e71e6d
...
...
@@ -108,7 +108,7 @@ static void index_entry_init(git_index *index, int side, git_oid *oid)
memset
(
&
entry
,
0x0
,
sizeof
(
git_index_entry
));
entry
.
path
=
"conflicting_file"
;
GIT_I
DX
ENTRY_STAGE_SET
(
&
entry
,
side
);
GIT_I
NDEX_
ENTRY_STAGE_SET
(
&
entry
,
side
);
entry
.
mode
=
0100644
;
git_oid_cpy
(
&
entry
.
id
,
oid
);
...
...
tests/status/ignore.c
View file @
18e71e6d
...
...
@@ -167,7 +167,7 @@ void test_status_ignore__ignore_pattern_ignorecase(void)
cl_git_mkfile
(
"empty_standard_repo/A.txt"
,
"Differs in case"
);
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
ignore_case
=
(
git_index_caps
(
index
)
&
GIT_INDEX
CAP
_IGNORE_CASE
)
!=
0
;
ignore_case
=
(
git_index_caps
(
index
)
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
!=
0
;
git_index_free
(
index
);
cl_git_pass
(
git_status_file
(
&
flags
,
g_repo
,
"A.txt"
));
...
...
tests/status/renames.c
View file @
18e71e6d
...
...
@@ -483,7 +483,7 @@ void test_status_renames__both_casechange_one(void)
cl_git_pass
(
git_status_list_new
(
&
statuslist
,
g_repo
,
&
opts
));
check_status
(
statuslist
,
(
index_caps
&
GIT_INDEX
CAP
_IGNORE_CASE
)
?
check_status
(
statuslist
,
(
index_caps
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
?
expected_icase
:
expected_case
,
1
);
git_status_list_free
(
statuslist
);
...
...
@@ -550,7 +550,7 @@ void test_status_renames__both_casechange_two(void)
cl_git_pass
(
git_status_list_new
(
&
statuslist
,
g_repo
,
&
opts
));
check_status
(
statuslist
,
(
index_caps
&
GIT_INDEX
CAP
_IGNORE_CASE
)
?
check_status
(
statuslist
,
(
index_caps
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
?
expected_icase
:
expected_case
,
4
);
git_status_list_free
(
statuslist
);
...
...
tests/status/worktree.c
View file @
18e71e6d
...
...
@@ -154,7 +154,7 @@ void test_status_worktree__swap_subdir_and_file(void)
bool
ignore_case
;
cl_git_pass
(
git_repository_index
(
&
index
,
repo
));
ignore_case
=
(
git_index_caps
(
index
)
&
GIT_INDEX
CAP
_IGNORE_CASE
)
!=
0
;
ignore_case
=
(
git_index_caps
(
index
)
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
!=
0
;
git_index_free
(
index
);
/* first alter the contents of the worktree */
...
...
@@ -889,7 +889,7 @@ void test_status_worktree__sorting_by_case(void)
cl_git_pass
(
git_repository_index
(
&
index
,
repo
));
native_ignore_case
=
(
git_index_caps
(
index
)
&
GIT_INDEX
CAP
_IGNORE_CASE
)
!=
0
;
(
git_index_caps
(
index
)
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
!=
0
;
git_index_free
(
index
);
memset
(
&
counts
,
0
,
sizeof
(
counts
));
...
...
@@ -1222,7 +1222,7 @@ void test_status_worktree__with_directory_in_pathlist(void)
cl_git_pass
(
git_repository_index
(
&
index
,
repo
));
native_ignore_case
=
(
git_index_caps
(
index
)
&
GIT_INDEX
CAP
_IGNORE_CASE
)
!=
0
;
(
git_index_caps
(
index
)
&
GIT_INDEX
_CAPABILITY
_IGNORE_CASE
)
!=
0
;
git_index_free
(
index
);
opts
.
pathspec
.
strings
=
&
subdir_path
;
...
...
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