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
53454b68
Unverified
Commit
53454b68
authored
Feb 02, 2018
by
Edward Thomson
Committed by
GitHub
Feb 02, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4510 from pks-t/pks/attr-file-bare-stat
attr: avoid stat'ting files for bare repositories
parents
f55accce
e28e17e6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
src/attr.c
+15
-3
src/ignore.c
+5
-1
No files found.
src/attr.c
View file @
53454b68
...
...
@@ -56,12 +56,16 @@ int git_attr_get(
git_attr_file
*
file
;
git_attr_name
attr
;
git_attr_rule
*
rule
;
git_dir_flag
dir_flag
=
GIT_DIR_FLAG_UNKNOWN
;
assert
(
value
&&
repo
&&
name
);
*
value
=
NULL
;
if
(
git_attr_path__init
(
&
path
,
pathname
,
git_repository_workdir
(
repo
),
GIT_DIR_FLAG_UNKNOWN
)
<
0
)
if
(
git_repository_is_bare
(
repo
))
dir_flag
=
GIT_DIR_FLAG_FALSE
;
if
(
git_attr_path__init
(
&
path
,
pathname
,
git_repository_workdir
(
repo
),
dir_flag
)
<
0
)
return
-
1
;
if
((
error
=
collect_attr_files
(
repo
,
NULL
,
flags
,
pathname
,
&
files
))
<
0
)
...
...
@@ -114,13 +118,17 @@ int git_attr_get_many_with_session(
git_attr_rule
*
rule
;
attr_get_many_info
*
info
=
NULL
;
size_t
num_found
=
0
;
git_dir_flag
dir_flag
=
GIT_DIR_FLAG_UNKNOWN
;
if
(
!
num_attr
)
return
0
;
assert
(
values
&&
repo
&&
names
);
if
(
git_attr_path__init
(
&
path
,
pathname
,
git_repository_workdir
(
repo
),
GIT_DIR_FLAG_UNKNOWN
)
<
0
)
if
(
git_repository_is_bare
(
repo
))
dir_flag
=
GIT_DIR_FLAG_FALSE
;
if
(
git_attr_path__init
(
&
path
,
pathname
,
git_repository_workdir
(
repo
),
dir_flag
)
<
0
)
return
-
1
;
if
((
error
=
collect_attr_files
(
repo
,
attr_session
,
flags
,
pathname
,
&
files
))
<
0
)
...
...
@@ -196,10 +204,14 @@ int git_attr_foreach(
git_attr_rule
*
rule
;
git_attr_assignment
*
assign
;
git_strmap
*
seen
=
NULL
;
git_dir_flag
dir_flag
=
GIT_DIR_FLAG_UNKNOWN
;
assert
(
repo
&&
callback
);
if
(
git_attr_path__init
(
&
path
,
pathname
,
git_repository_workdir
(
repo
),
GIT_DIR_FLAG_UNKNOWN
)
<
0
)
if
(
git_repository_is_bare
(
repo
))
dir_flag
=
GIT_DIR_FLAG_FALSE
;
if
(
git_attr_path__init
(
&
path
,
pathname
,
git_repository_workdir
(
repo
),
dir_flag
)
<
0
)
return
-
1
;
if
((
error
=
collect_attr_files
(
repo
,
NULL
,
flags
,
pathname
,
&
files
))
<
0
||
...
...
src/ignore.c
View file @
53454b68
...
...
@@ -540,6 +540,7 @@ int git_ignore_path_is_ignored(
git_ignores
ignores
;
unsigned
int
i
;
git_attr_file
*
file
;
git_dir_flag
dir_flag
=
GIT_DIR_FLAG_UNKNOWN
;
assert
(
repo
&&
ignored
&&
pathname
);
...
...
@@ -548,7 +549,10 @@ int git_ignore_path_is_ignored(
memset
(
&
path
,
0
,
sizeof
(
path
));
memset
(
&
ignores
,
0
,
sizeof
(
ignores
));
if
((
error
=
git_attr_path__init
(
&
path
,
pathname
,
workdir
,
GIT_DIR_FLAG_UNKNOWN
))
<
0
||
if
(
git_repository_is_bare
(
repo
))
dir_flag
=
GIT_DIR_FLAG_FALSE
;
if
((
error
=
git_attr_path__init
(
&
path
,
pathname
,
workdir
,
dir_flag
))
<
0
||
(
error
=
git_ignore__for_path
(
repo
,
path
.
path
,
&
ignores
))
<
0
)
goto
cleanup
;
...
...
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