@@ -64,25 +64,25 @@ static void output_attr(struct attr_check *check, const char *file)
6464}
6565
6666static void check_attr (const char * prefix , struct attr_check * check ,
67- const struct object_id * tree_oid , int collect_all ,
67+ int collect_all ,
6868 const char * file )
6969
7070{
7171 char * full_path =
7272 prefix_path (prefix , prefix ? strlen (prefix ) : 0 , file );
7373
7474 if (collect_all ) {
75- git_all_attrs (& the_index , tree_oid , full_path , check );
75+ git_all_attrs (& the_index , full_path , check );
7676 } else {
77- git_check_attr (& the_index , tree_oid , full_path , check );
77+ git_check_attr (& the_index , full_path , check );
7878 }
7979 output_attr (check , file );
8080
8181 free (full_path );
8282}
8383
8484static void check_attr_stdin_paths (const char * prefix , struct attr_check * check ,
85- const struct object_id * tree_oid , int collect_all )
85+ int collect_all )
8686{
8787 struct strbuf buf = STRBUF_INIT ;
8888 struct strbuf unquoted = STRBUF_INIT ;
@@ -96,7 +96,7 @@ static void check_attr_stdin_paths(const char *prefix, struct attr_check *check,
9696 die ("line is badly quoted" );
9797 strbuf_swap (& buf , & unquoted );
9898 }
99- check_attr (prefix , check , tree_oid , collect_all , buf .buf );
99+ check_attr (prefix , check , collect_all , buf .buf );
100100 maybe_flush_or_die (stdout , "attribute to stdout" );
101101 }
102102 strbuf_release (& buf );
@@ -112,7 +112,6 @@ static NORETURN void error_with_usage(const char *msg)
112112int cmd_check_attr (int argc , const char * * argv , const char * prefix )
113113{
114114 struct attr_check * check ;
115- struct object_id * tree_oid = NULL ;
116115 struct object_id initialized_oid ;
117116 int cnt , i , doubledash , filei ;
118117
@@ -188,14 +187,14 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
188187 if (source ) {
189188 if (repo_get_oid_tree (the_repository , source , & initialized_oid ))
190189 die ("%s: not a valid tree-ish source" , source );
191- tree_oid = & initialized_oid ;
190+ set_git_attr_source ( source ) ;
192191 }
193192
194193 if (stdin_paths )
195- check_attr_stdin_paths (prefix , check , tree_oid , all_attrs );
194+ check_attr_stdin_paths (prefix , check , all_attrs );
196195 else {
197196 for (i = filei ; i < argc ; i ++ )
198- check_attr (prefix , check , tree_oid , all_attrs , argv [i ]);
197+ check_attr (prefix , check , all_attrs , argv [i ]);
199198 maybe_flush_or_die (stdout , "attribute to stdout" );
200199 }
201200
0 commit comments