Browse Source

Merge branch 'maint'

* maint:
  urls.txt: document optional port specification in git URLS
  builtin-mv.c: check for unversionned files before looking at the destination.
  Add a testcase for "git mv -f" on untracked files.
  Missing && in t/t7001.sh.
maint
Junio C Hamano 16 years ago
parent
commit
de8139005f
  1. 8
      Documentation/urls.txt
  2. 8
      builtin-mv.c
  3. 10
      t/t7001-mv.sh

8
Documentation/urls.txt

@ -6,10 +6,10 @@ to name the remote repository: @@ -6,10 +6,10 @@ to name the remote repository:

===============================================================
- rsync://host.xz/path/to/repo.git/
- http://host.xz/path/to/repo.git/
- https://host.xz/path/to/repo.git/
- git://host.xz/path/to/repo.git/
- git://host.xz/~user/path/to/repo.git/
- http://host.xz{startsb}:port{endsb}/path/to/repo.git/
- https://host.xz{startsb}:port{endsb}/path/to/repo.git/
- git://host.xz{startsb}:port{endsb}/path/to/repo.git/
- git://host.xz{startsb}:port{endsb}/~user/path/to/repo.git/
- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/path/to/repo.git/
- ssh://{startsb}user@{endsb}host.xz/path/to/repo.git/
- ssh://{startsb}user@{endsb}host.xz/~user/path/to/repo.git/

8
builtin-mv.c

@ -162,7 +162,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix) @@ -162,7 +162,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
}
argc += last - first;
}
} else if (lstat(dst, &st) == 0) {
} else if (cache_name_pos(src, length) < 0)
bad = "not under version control";
else if (lstat(dst, &st) == 0) {
bad = "destination exists";
if (force) {
/*
@ -177,9 +179,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix) @@ -177,9 +179,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
} else
bad = "Cannot overwrite";
}
} else if (cache_name_pos(src, length) < 0)
bad = "not under version control";
else if (string_list_has_string(&src_for_dst, dst))
} else if (string_list_has_string(&src_for_dst, dst))
bad = "multiple sources for the same target";
else
string_list_insert(dst, &src_for_dst);

10
t/t7001-mv.sh

@ -55,9 +55,17 @@ test_expect_success \ @@ -55,9 +55,17 @@ test_expect_success \
git mv -k untracked1 untracked2 path0 &&
test -f untracked1 &&
test -f untracked2 &&
test ! -f path0/untracked1
test ! -f path0/untracked1 &&
test ! -f path0/untracked2'

test_expect_success \
'checking -f on untracked file with existing target' \
'touch path0/untracked1 &&
git mv -f untracked1 path0
test ! -f .git/index.lock &&
test -f untracked1 &&
test -f path0/untracked1'

# clean up the mess in case bad things happen
rm -f idontexist untracked1 untracked2 \
path0/idontexist path0/untracked1 path0/untracked2 \

Loading…
Cancel
Save