dir: make the DO_MATCH_SUBMODULE code reusable for a non-submodule case
The specific checks done in match_pathspec_item for the DO_MATCH_SUBMODULE case are useful for other cases which have nothing to do with submodules. Rename this constant; a subsequent commit will make use of this change. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		
				
					committed by
					
						
						Junio C Hamano
					
				
			
			
				
	
			
			
			
						parent
						
							404ebceda0
						
					
				
				
					commit
					a3d89d8f76
				
			
							
								
								
									
										6
									
								
								dir.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								dir.c
									
									
									
									
									
								
							@ -273,7 +273,7 @@ static int do_read_blob(const struct object_id *oid, struct oid_stat *oid_stat,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define DO_MATCH_EXCLUDE   (1<<0)
 | 
					#define DO_MATCH_EXCLUDE   (1<<0)
 | 
				
			||||||
#define DO_MATCH_DIRECTORY (1<<1)
 | 
					#define DO_MATCH_DIRECTORY (1<<1)
 | 
				
			||||||
#define DO_MATCH_SUBMODULE (1<<2)
 | 
					#define DO_MATCH_LEADING_PATHSPEC (1<<2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Does 'match' match the given name?
 | 
					 * Does 'match' match the given name?
 | 
				
			||||||
@ -354,7 +354,7 @@ static int match_pathspec_item(const struct index_state *istate,
 | 
				
			|||||||
		return MATCHED_FNMATCH;
 | 
							return MATCHED_FNMATCH;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Perform checks to see if "name" is a super set of the pathspec */
 | 
						/* Perform checks to see if "name" is a super set of the pathspec */
 | 
				
			||||||
	if (flags & DO_MATCH_SUBMODULE) {
 | 
						if (flags & DO_MATCH_LEADING_PATHSPEC) {
 | 
				
			||||||
		/* name is a literal prefix of the pathspec */
 | 
							/* name is a literal prefix of the pathspec */
 | 
				
			||||||
		int offset = name[namelen-1] == '/' ? 1 : 0;
 | 
							int offset = name[namelen-1] == '/' ? 1 : 0;
 | 
				
			||||||
		if ((namelen < matchlen) &&
 | 
							if ((namelen < matchlen) &&
 | 
				
			||||||
@ -498,7 +498,7 @@ int submodule_path_match(const struct index_state *istate,
 | 
				
			|||||||
					strlen(submodule_name),
 | 
										strlen(submodule_name),
 | 
				
			||||||
					0, seen,
 | 
										0, seen,
 | 
				
			||||||
					DO_MATCH_DIRECTORY |
 | 
										DO_MATCH_DIRECTORY |
 | 
				
			||||||
					DO_MATCH_SUBMODULE);
 | 
										DO_MATCH_LEADING_PATHSPEC);
 | 
				
			||||||
	return matched;
 | 
						return matched;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user