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
46508fe6
Commit
46508fe6
authored
Sep 26, 2021
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attr_file: don't take the `repo` as an arg
The `repo` argument is now unnecessary. Remove it.
parent
f5a9f0a2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
10 deletions
+8
-10
src/attr.c
+3
-3
src/attr_file.c
+0
-1
src/attr_file.h
+0
-1
src/ignore.c
+2
-2
tests/attr/lookup.c
+3
-3
No files found.
src/attr.c
View file @
46508fe6
...
@@ -68,7 +68,7 @@ int git_attr_get_ext(
...
@@ -68,7 +68,7 @@ int git_attr_get_ext(
if
(
git_repository_is_bare
(
repo
))
if
(
git_repository_is_bare
(
repo
))
dir_flag
=
GIT_DIR_FLAG_FALSE
;
dir_flag
=
GIT_DIR_FLAG_FALSE
;
if
(
git_attr_path__init
(
&
path
,
repo
,
pathname
,
git_repository_workdir
(
repo
),
dir_flag
)
<
0
)
if
(
git_attr_path__init
(
&
path
,
pathname
,
git_repository_workdir
(
repo
),
dir_flag
)
<
0
)
return
-
1
;
return
-
1
;
if
((
error
=
collect_attr_files
(
repo
,
NULL
,
opts
,
pathname
,
&
files
))
<
0
)
if
((
error
=
collect_attr_files
(
repo
,
NULL
,
opts
,
pathname
,
&
files
))
<
0
)
...
@@ -149,7 +149,7 @@ int git_attr_get_many_with_session(
...
@@ -149,7 +149,7 @@ int git_attr_get_many_with_session(
if
(
git_repository_is_bare
(
repo
))
if
(
git_repository_is_bare
(
repo
))
dir_flag
=
GIT_DIR_FLAG_FALSE
;
dir_flag
=
GIT_DIR_FLAG_FALSE
;
if
(
git_attr_path__init
(
&
path
,
repo
,
pathname
,
git_repository_workdir
(
repo
),
dir_flag
)
<
0
)
if
(
git_attr_path__init
(
&
path
,
pathname
,
git_repository_workdir
(
repo
),
dir_flag
)
<
0
)
return
-
1
;
return
-
1
;
if
((
error
=
collect_attr_files
(
repo
,
attr_session
,
opts
,
pathname
,
&
files
))
<
0
)
if
((
error
=
collect_attr_files
(
repo
,
attr_session
,
opts
,
pathname
,
&
files
))
<
0
)
...
@@ -264,7 +264,7 @@ int git_attr_foreach_ext(
...
@@ -264,7 +264,7 @@ int git_attr_foreach_ext(
if
(
git_repository_is_bare
(
repo
))
if
(
git_repository_is_bare
(
repo
))
dir_flag
=
GIT_DIR_FLAG_FALSE
;
dir_flag
=
GIT_DIR_FLAG_FALSE
;
if
(
git_attr_path__init
(
&
path
,
repo
,
pathname
,
git_repository_workdir
(
repo
),
dir_flag
)
<
0
)
if
(
git_attr_path__init
(
&
path
,
pathname
,
git_repository_workdir
(
repo
),
dir_flag
)
<
0
)
return
-
1
;
return
-
1
;
if
((
error
=
collect_attr_files
(
repo
,
NULL
,
opts
,
pathname
,
&
files
))
<
0
||
if
((
error
=
collect_attr_files
(
repo
,
NULL
,
opts
,
pathname
,
&
files
))
<
0
||
...
...
src/attr_file.c
View file @
46508fe6
...
@@ -551,7 +551,6 @@ git_attr_assignment *git_attr_rule__lookup_assignment(
...
@@ -551,7 +551,6 @@ git_attr_assignment *git_attr_rule__lookup_assignment(
int
git_attr_path__init
(
int
git_attr_path__init
(
git_attr_path
*
info
,
git_attr_path
*
info
,
git_repository
*
repo
,
const
char
*
path
,
const
char
*
path
,
const
char
*
base
,
const
char
*
base
,
git_dir_flag
dir_flag
)
git_dir_flag
dir_flag
)
...
...
src/attr_file.h
View file @
46508fe6
...
@@ -227,7 +227,6 @@ typedef enum { GIT_DIR_FLAG_TRUE = 1, GIT_DIR_FLAG_FALSE = 0, GIT_DIR_FLAG_UNKNO
...
@@ -227,7 +227,6 @@ typedef enum { GIT_DIR_FLAG_TRUE = 1, GIT_DIR_FLAG_FALSE = 0, GIT_DIR_FLAG_UNKNO
extern
int
git_attr_path__init
(
extern
int
git_attr_path__init
(
git_attr_path
*
out
,
git_attr_path
*
out
,
git_repository
*
repo
,
const
char
*
path
,
const
char
*
path
,
const
char
*
base
,
const
char
*
base
,
git_dir_flag
is_dir
);
git_dir_flag
is_dir
);
...
...
src/ignore.c
View file @
46508fe6
...
@@ -468,7 +468,7 @@ int git_ignore__lookup(
...
@@ -468,7 +468,7 @@ int git_ignore__lookup(
*
out
=
GIT_IGNORE_NOTFOUND
;
*
out
=
GIT_IGNORE_NOTFOUND
;
if
(
git_attr_path__init
(
if
(
git_attr_path__init
(
&
path
,
ignores
->
repo
,
pathname
,
git_repository_workdir
(
ignores
->
repo
),
dir_flag
)
<
0
)
&
path
,
pathname
,
git_repository_workdir
(
ignores
->
repo
),
dir_flag
)
<
0
)
return
-
1
;
return
-
1
;
/* first process builtins - success means path was found */
/* first process builtins - success means path was found */
...
@@ -552,7 +552,7 @@ int git_ignore_path_is_ignored(
...
@@ -552,7 +552,7 @@ int git_ignore_path_is_ignored(
else
if
(
git_repository_is_bare
(
repo
))
else
if
(
git_repository_is_bare
(
repo
))
dir_flag
=
GIT_DIR_FLAG_FALSE
;
dir_flag
=
GIT_DIR_FLAG_FALSE
;
if
((
error
=
git_attr_path__init
(
&
path
,
repo
,
pathname
,
workdir
,
dir_flag
))
<
0
||
if
((
error
=
git_attr_path__init
(
&
path
,
pathname
,
workdir
,
dir_flag
))
<
0
||
(
error
=
git_ignore__for_path
(
repo
,
path
.
path
,
&
ignores
))
<
0
)
(
error
=
git_ignore__for_path
(
repo
,
path
.
path
,
&
ignores
))
<
0
)
goto
cleanup
;
goto
cleanup
;
...
...
tests/attr/lookup.c
View file @
46508fe6
...
@@ -13,7 +13,7 @@ void test_attr_lookup__simple(void)
...
@@ -13,7 +13,7 @@ void test_attr_lookup__simple(void)
cl_assert_equal_s
(
cl_fixture
(
"attr/attr0"
),
file
->
entry
->
path
);
cl_assert_equal_s
(
cl_fixture
(
"attr/attr0"
),
file
->
entry
->
path
);
cl_assert
(
file
->
rules
.
length
==
1
);
cl_assert
(
file
->
rules
.
length
==
1
);
cl_git_pass
(
git_attr_path__init
(
&
path
,
NULL
,
"test"
,
NULL
,
GIT_DIR_FLAG_UNKNOWN
));
cl_git_pass
(
git_attr_path__init
(
&
path
,
"test"
,
NULL
,
GIT_DIR_FLAG_UNKNOWN
));
cl_assert_equal_s
(
"test"
,
path
.
path
);
cl_assert_equal_s
(
"test"
,
path
.
path
);
cl_assert_equal_s
(
"test"
,
path
.
basename
);
cl_assert_equal_s
(
"test"
,
path
.
basename
);
cl_assert
(
!
path
.
is_dir
);
cl_assert
(
!
path
.
is_dir
);
...
@@ -36,7 +36,7 @@ static void run_test_cases(git_attr_file *file, struct attr_expected *cases, int
...
@@ -36,7 +36,7 @@ static void run_test_cases(git_attr_file *file, struct attr_expected *cases, int
int
error
;
int
error
;
for
(
c
=
cases
;
c
->
path
!=
NULL
;
c
++
)
{
for
(
c
=
cases
;
c
->
path
!=
NULL
;
c
++
)
{
cl_git_pass
(
git_attr_path__init
(
&
path
,
NULL
,
c
->
path
,
NULL
,
GIT_DIR_FLAG_UNKNOWN
));
cl_git_pass
(
git_attr_path__init
(
&
path
,
c
->
path
,
NULL
,
GIT_DIR_FLAG_UNKNOWN
));
if
(
force_dir
)
if
(
force_dir
)
path
.
is_dir
=
1
;
path
.
is_dir
=
1
;
...
@@ -133,7 +133,7 @@ void test_attr_lookup__match_variants(void)
...
@@ -133,7 +133,7 @@ void test_attr_lookup__match_variants(void)
cl_assert_equal_s
(
cl_fixture
(
"attr/attr1"
),
file
->
entry
->
path
);
cl_assert_equal_s
(
cl_fixture
(
"attr/attr1"
),
file
->
entry
->
path
);
cl_assert
(
file
->
rules
.
length
==
10
);
cl_assert
(
file
->
rules
.
length
==
10
);
cl_git_pass
(
git_attr_path__init
(
&
path
,
NULL
,
"/testing/for/pat0"
,
NULL
,
GIT_DIR_FLAG_UNKNOWN
));
cl_git_pass
(
git_attr_path__init
(
&
path
,
"/testing/for/pat0"
,
NULL
,
GIT_DIR_FLAG_UNKNOWN
));
cl_assert_equal_s
(
"pat0"
,
path
.
basename
);
cl_assert_equal_s
(
"pat0"
,
path
.
basename
);
run_test_cases
(
file
,
cases
,
0
);
run_test_cases
(
file
,
cases
,
0
);
...
...
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