Merge branch 'maint'
* maint: receive-pack: do not insist on fast-forward outside refs/heads/ git-mv: search more precisely for source directory in index Conflicts: receive-pack.cmaint
						commit
						ba988a83f0
					
				
							
								
								
									
										11
									
								
								builtin-mv.c
								
								
								
								
							
							
						
						
									
										11
									
								
								builtin-mv.c
								
								
								
								
							| 
						 | 
					@ -146,21 +146,24 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 | 
				
			||||||
				&& lstat(dst, &st) == 0)
 | 
									&& lstat(dst, &st) == 0)
 | 
				
			||||||
			bad = "cannot move directory over file";
 | 
								bad = "cannot move directory over file";
 | 
				
			||||||
		else if (src_is_dir) {
 | 
							else if (src_is_dir) {
 | 
				
			||||||
 | 
								const char *src_w_slash = add_slash(src);
 | 
				
			||||||
 | 
								int len_w_slash = length + 1;
 | 
				
			||||||
			int first, last;
 | 
								int first, last;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			modes[i] = WORKING_DIRECTORY;
 | 
								modes[i] = WORKING_DIRECTORY;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			first = cache_name_pos(src, length);
 | 
								first = cache_name_pos(src_w_slash, len_w_slash);
 | 
				
			||||||
			if (first >= 0)
 | 
								if (first >= 0)
 | 
				
			||||||
				die ("Huh? %s/ is in index?", src);
 | 
									die ("Huh? %.*s is in index?",
 | 
				
			||||||
 | 
											len_w_slash, src_w_slash);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			first = -1 - first;
 | 
								first = -1 - first;
 | 
				
			||||||
			for (last = first; last < active_nr; last++) {
 | 
								for (last = first; last < active_nr; last++) {
 | 
				
			||||||
				const char *path = active_cache[last]->name;
 | 
									const char *path = active_cache[last]->name;
 | 
				
			||||||
				if (strncmp(path, src, length)
 | 
									if (strncmp(path, src_w_slash, len_w_slash))
 | 
				
			||||||
						|| path[length] != '/')
 | 
					 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								free((char *)src_w_slash);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (last - first < 1)
 | 
								if (last - first < 1)
 | 
				
			||||||
				bad = "source directory is empty";
 | 
									bad = "source directory is empty";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -120,7 +120,8 @@ static int update(struct command *cmd)
 | 
				
			||||||
			     "but I can't find it!", new_hex);
 | 
								     "but I can't find it!", new_hex);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (deny_non_fast_forwards && !is_null_sha1(new_sha1) &&
 | 
						if (deny_non_fast_forwards && !is_null_sha1(new_sha1) &&
 | 
				
			||||||
	    !is_null_sha1(old_sha1)) {
 | 
						    !is_null_sha1(old_sha1) &&
 | 
				
			||||||
 | 
						    !strncmp(name, "refs/heads/", 11)) {
 | 
				
			||||||
		struct commit *old_commit, *new_commit;
 | 
							struct commit *old_commit, *new_commit;
 | 
				
			||||||
		struct commit_list *bases, *ent;
 | 
							struct commit_list *bases, *ent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -105,4 +105,17 @@ test_expect_success "Michael Cassar's test case" '
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
'
 | 
					'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					rm -fr papers partA path?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test_expect_success "Sergey Vlasov's test case" '
 | 
				
			||||||
 | 
						rm -fr .git &&
 | 
				
			||||||
 | 
						git init-db &&
 | 
				
			||||||
 | 
						mkdir ab &&
 | 
				
			||||||
 | 
						date >ab.c &&
 | 
				
			||||||
 | 
						date >ab/d &&
 | 
				
			||||||
 | 
						git add ab.c ab &&
 | 
				
			||||||
 | 
						git commit -m 'initial' &&
 | 
				
			||||||
 | 
						git mv ab a
 | 
				
			||||||
 | 
					'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test_done
 | 
					test_done
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue