Merge branch 'ho/dashless' into maint

* ho/dashless:
  tests: use "git xyzzy" form (t7200 - t9001)
  tests: use "git xyzzy" form (t7000 - t7199)
  tests: use "git xyzzy" form (t3600 - t6999)
  tests: use "git xyzzy" form (t0000 - t3599)
  'git foo' program identifies itself without dash in die() messages
  Start conforming code to "git subcmd" style
This commit is contained in:
Junio C Hamano 2008-09-03 14:51:56 -07:00
Родитель 73bae1dc46 47a528ad24
Коммит 36f44a0680
96 изменённых файлов: 578 добавлений и 578 удалений

Просмотреть файл

@ -274,7 +274,7 @@ static void say_patch_name(FILE *output, const char *pre,
static void read_patch_file(struct strbuf *sb, int fd) static void read_patch_file(struct strbuf *sb, int fd)
{ {
if (strbuf_read(sb, fd, 0) < 0) if (strbuf_read(sb, fd, 0) < 0)
die("git-apply: read returned %s", strerror(errno)); die("git apply: read returned %s", strerror(errno));
/* /*
* Make sure that we have some slop in the buffer * Make sure that we have some slop in the buffer
@ -506,17 +506,17 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name,
name = orig_name; name = orig_name;
len = strlen(name); len = strlen(name);
if (isnull) if (isnull)
die("git-apply: bad git-diff - expected /dev/null, got %s on line %d", name, linenr); die("git apply: bad git-diff - expected /dev/null, got %s on line %d", name, linenr);
another = find_name(line, NULL, p_value, TERM_TAB); another = find_name(line, NULL, p_value, TERM_TAB);
if (!another || memcmp(another, name, len)) if (!another || memcmp(another, name, len))
die("git-apply: bad git-diff - inconsistent %s filename on line %d", oldnew, linenr); die("git apply: bad git-diff - inconsistent %s filename on line %d", oldnew, linenr);
free(another); free(another);
return orig_name; return orig_name;
} }
else { else {
/* expect "/dev/null" */ /* expect "/dev/null" */
if (memcmp("/dev/null", line, 9) || line[9] != '\n') if (memcmp("/dev/null", line, 9) || line[9] != '\n')
die("git-apply: bad git-diff - expected /dev/null on line %d", linenr); die("git apply: bad git-diff - expected /dev/null on line %d", linenr);
return NULL; return NULL;
} }
} }

Просмотреть файл

@ -47,18 +47,18 @@ static int run_remote_archiver(const char *remote, int argc,
len = packet_read_line(fd[0], buf, sizeof(buf)); len = packet_read_line(fd[0], buf, sizeof(buf));
if (!len) if (!len)
die("git-archive: expected ACK/NAK, got EOF"); die("git archive: expected ACK/NAK, got EOF");
if (buf[len-1] == '\n') if (buf[len-1] == '\n')
buf[--len] = 0; buf[--len] = 0;
if (strcmp(buf, "ACK")) { if (strcmp(buf, "ACK")) {
if (len > 5 && !prefixcmp(buf, "NACK ")) if (len > 5 && !prefixcmp(buf, "NACK "))
die("git-archive: NACK %s", buf + 5); die("git archive: NACK %s", buf + 5);
die("git-archive: protocol error"); die("git archive: protocol error");
} }
len = packet_read_line(fd[0], buf, sizeof(buf)); len = packet_read_line(fd[0], buf, sizeof(buf));
if (len) if (len)
die("git-archive: expected a flush"); die("git archive: expected a flush");
/* Now, start reading from fd[0] and spit it out to stdout */ /* Now, start reading from fd[0] and spit it out to stdout */
rv = recv_sideband("archive", fd[0], 1, 2); rv = recv_sideband("archive", fd[0], 1, 2);

Просмотреть файл

@ -1791,7 +1791,7 @@ static int prepare_lines(struct scoreboard *sb)
/* /*
* Add phony grafts for use with -S; this is primarily to * Add phony grafts for use with -S; this is primarily to
* support git-cvsserver that wants to give a linear history * support git's cvsserver that wants to give a linear history
* to its clients. * to its clients.
*/ */
static int read_ancestry(const char *graft_file) static int read_ancestry(const char *graft_file)

Просмотреть файл

@ -6,10 +6,10 @@
* Basic handler for bundle files to connect repositories via sneakernet. * Basic handler for bundle files to connect repositories via sneakernet.
* Invocation must include action. * Invocation must include action.
* This function can create a bundle or provide information on an existing * This function can create a bundle or provide information on an existing
* bundle supporting git-fetch, git-pull, and git-ls-remote * bundle supporting "fetch", "pull", and "ls-remote".
*/ */
static const char *bundle_usage="git-bundle (create <bundle> <git-rev-list args> | verify <bundle> | list-heads <bundle> [refname]... | unbundle <bundle> [refname]... )"; static const char *bundle_usage="git bundle (create <bundle> <git rev-list args> | verify <bundle> | list-heads <bundle> [refname]... | unbundle <bundle> [refname]... )";
int cmd_bundle(int argc, const char **argv, const char *prefix) int cmd_bundle(int argc, const char **argv, const char *prefix)
{ {

Просмотреть файл

@ -137,11 +137,11 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
break; break;
default: default:
die("git-cat-file: unknown option: %s\n", exp_type); die("git cat-file: unknown option: %s\n", exp_type);
} }
if (!buf) if (!buf)
die("git-cat-file %s: bad file", obj_name); die("git cat-file %s: bad file", obj_name);
write_or_die(1, buf, size); write_or_die(1, buf, size);
return 0; return 0;

Просмотреть файл

@ -9,6 +9,6 @@
int cmd_check_ref_format(int argc, const char **argv, const char *prefix) int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
{ {
if (argc != 2) if (argc != 2)
usage("git-check-ref-format refname"); usage("git check-ref-format refname");
return !!check_ref_format(argv[1]); return !!check_ref_format(argv[1]);
} }

Просмотреть файл

@ -258,9 +258,9 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
const char *p; const char *p;
if (all) if (all)
die("git-checkout-index: don't mix '--all' and explicit filenames"); die("git checkout-index: don't mix '--all' and explicit filenames");
if (read_from_stdin) if (read_from_stdin)
die("git-checkout-index: don't mix '--stdin' and explicit filenames"); die("git checkout-index: don't mix '--stdin' and explicit filenames");
p = prefix_path(prefix, prefix_length, arg); p = prefix_path(prefix, prefix_length, arg);
checkout_file(p, prefix_length); checkout_file(p, prefix_length);
if (p < arg || p > arg + strlen(arg)) if (p < arg || p > arg + strlen(arg))
@ -271,7 +271,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
struct strbuf buf, nbuf; struct strbuf buf, nbuf;
if (all) if (all)
die("git-checkout-index: don't mix '--all' and '--stdin'"); die("git checkout-index: don't mix '--all' and '--stdin'");
strbuf_init(&buf, 0); strbuf_init(&buf, 0);
strbuf_init(&nbuf, 0); strbuf_init(&nbuf, 0);

Просмотреть файл

@ -118,7 +118,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
} }
if (strbuf_read(&buffer, 0, 0) < 0) if (strbuf_read(&buffer, 0, 0) < 0)
die("git-commit-tree: read returned %s", strerror(errno)); die("git commit-tree: read returned %s", strerror(errno));
if (!commit_tree(buffer.buf, tree_sha1, parents, commit_sha1)) { if (!commit_tree(buffer.buf, tree_sha1, parents, commit_sha1)) {
printf("%s\n", sha1_to_hex(commit_sha1)); printf("%s\n", sha1_to_hex(commit_sha1));

Просмотреть файл

@ -609,7 +609,7 @@ static struct ref *do_fetch_pack(int fd[2],
fprintf(stderr, "warning: no common commits\n"); fprintf(stderr, "warning: no common commits\n");
if (get_pack(fd, pack_lockfile)) if (get_pack(fd, pack_lockfile))
die("git-fetch-pack: fetch failed."); die("git fetch-pack: fetch failed.");
all_done: all_done:
return ref; return ref;

Просмотреть файл

@ -774,7 +774,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
/* Make sure we do not get outside of paths */ /* Make sure we do not get outside of paths */
for (i = 0; paths[i]; i++) for (i = 0; paths[i]; i++)
if (strncmp(prefix, paths[i], opt.prefix_length)) if (strncmp(prefix, paths[i], opt.prefix_length))
die("git-grep: cannot generate relative filenames containing '..'"); die("git grep: cannot generate relative filenames containing '..'");
} }
} }
else if (prefix) { else if (prefix) {

Просмотреть файл

@ -78,7 +78,7 @@ static void show_dir_entry(const char *tag, struct dir_entry *ent)
int offset = prefix_offset; int offset = prefix_offset;
if (len >= ent->len) if (len >= ent->len)
die("git-ls-files: internal error - directory entry not superset of prefix"); die("git ls-files: internal error - directory entry not superset of prefix");
if (pathspec && !pathspec_match(pathspec, ps_matched, ent->name, len)) if (pathspec && !pathspec_match(pathspec, ps_matched, ent->name, len))
return; return;
@ -183,7 +183,7 @@ static void show_ce_entry(const char *tag, struct cache_entry *ce)
int offset = prefix_offset; int offset = prefix_offset;
if (len >= ce_namelen(ce)) if (len >= ce_namelen(ce))
die("git-ls-files: internal error - cache entry not superset of prefix"); die("git ls-files: internal error - cache entry not superset of prefix");
if (pathspec && !pathspec_match(pathspec, ps_matched, ce->name, len)) if (pathspec && !pathspec_match(pathspec, ps_matched, ce->name, len))
return; return;
@ -319,7 +319,7 @@ static const char *verify_pathspec(const char *prefix)
} }
if (prefix_offset > max || memcmp(prev, prefix, prefix_offset)) if (prefix_offset > max || memcmp(prev, prefix, prefix_offset))
die("git-ls-files: cannot generate relative filenames containing '..'"); die("git ls-files: cannot generate relative filenames containing '..'");
prefix_len = max; prefix_len = max;
return max ? xmemdupz(prev, max) : NULL; return max ? xmemdupz(prev, max) : NULL;

Просмотреть файл

@ -221,7 +221,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
printf("rm '%s'\n", path); printf("rm '%s'\n", path);
if (remove_file_from_cache(path)) if (remove_file_from_cache(path))
die("git-rm: unable to remove %s", path); die("git rm: unable to remove %s", path);
} }
if (show_only) if (show_only)
@ -244,7 +244,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
continue; continue;
} }
if (!removed) if (!removed)
die("git-rm: %s: %s", path, strerror(errno)); die("git rm: %s: %s", path, strerror(errno));
} }
} }

Просмотреть файл

@ -62,7 +62,7 @@ match:
* ref points at a nonexistent object. * ref points at a nonexistent object.
*/ */
if (!has_sha1_file(sha1)) if (!has_sha1_file(sha1))
die("git-show-ref: bad ref %s (%s)", refname, die("git show-ref: bad ref %s (%s)", refname,
sha1_to_hex(sha1)); sha1_to_hex(sha1));
if (quiet) if (quiet)
@ -82,12 +82,12 @@ match:
else { else {
obj = parse_object(sha1); obj = parse_object(sha1);
if (!obj) if (!obj)
die("git-show-ref: bad ref %s (%s)", refname, die("git show-ref: bad ref %s (%s)", refname,
sha1_to_hex(sha1)); sha1_to_hex(sha1));
if (obj->type == OBJ_TAG) { if (obj->type == OBJ_TAG) {
obj = deref_tag(obj, refname, 0); obj = deref_tag(obj, refname, 0);
if (!obj) if (!obj)
die("git-show-ref: bad tag at ref %s (%s)", refname, die("git show-ref: bad tag at ref %s (%s)", refname,
sha1_to_hex(sha1)); sha1_to_hex(sha1));
hex = find_unique_abbrev(obj->sha1, abbrev); hex = find_unique_abbrev(obj->sha1, abbrev);
printf("%s %s^{}\n", hex, refname); printf("%s %s^{}\n", hex, refname);

Просмотреть файл

@ -76,7 +76,7 @@ int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix)
n = read_in_full(0, buffer, HEADERSIZE); n = read_in_full(0, buffer, HEADERSIZE);
if (n < HEADERSIZE) if (n < HEADERSIZE)
die("git-get-tar-commit-id: read error"); die("git get-tar-commit-id: read error");
if (header->typeflag[0] != 'g') if (header->typeflag[0] != 'g')
return 1; return 1;
if (memcmp(content, "52 comment=", 11)) if (memcmp(content, "52 comment=", 11))
@ -84,7 +84,7 @@ int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix)
n = write_in_full(1, content + 11, 41); n = write_in_full(1, content + 11, 41);
if (n < 41) if (n < 41)
die("git-get-tar-commit-id: write error"); die("git get-tar-commit-id: write error");
return 0; return 0;
} }

Просмотреть файл

@ -262,7 +262,7 @@ static void chmod_path(int flip, const char *path)
report("chmod %cx '%s'", flip, path); report("chmod %cx '%s'", flip, path);
return; return;
fail: fail:
die("git-update-index: cannot chmod %cx '%s'", flip, path); die("git update-index: cannot chmod %cx '%s'", flip, path);
} }
static void update_one(const char *path, const char *prefix, int prefix_length) static void update_one(const char *path, const char *prefix, int prefix_length)
@ -280,7 +280,7 @@ static void update_one(const char *path, const char *prefix, int prefix_length)
if (force_remove) { if (force_remove) {
if (remove_file_from_cache(p)) if (remove_file_from_cache(p))
die("git-update-index: unable to remove %s", path); die("git update-index: unable to remove %s", path);
report("remove '%s'", path); report("remove '%s'", path);
goto free_return; goto free_return;
} }
@ -351,7 +351,7 @@ static void read_index_info(int line_termination)
if (line_termination && path_name[0] == '"') { if (line_termination && path_name[0] == '"') {
strbuf_reset(&uq); strbuf_reset(&uq);
if (unquote_c_style(&uq, path_name, NULL)) { if (unquote_c_style(&uq, path_name, NULL)) {
die("git-update-index: bad quoting of path name"); die("git update-index: bad quoting of path name");
} }
path_name = uq.buf; path_name = uq.buf;
} }
@ -364,7 +364,7 @@ static void read_index_info(int line_termination)
if (!mode) { if (!mode) {
/* mode == 0 means there is no such path -- remove */ /* mode == 0 means there is no such path -- remove */
if (remove_file_from_cache(path_name)) if (remove_file_from_cache(path_name))
die("git-update-index: unable to remove %s", die("git update-index: unable to remove %s",
ptr); ptr);
} }
else { else {
@ -374,7 +374,7 @@ static void read_index_info(int line_termination)
*/ */
ptr[-42] = ptr[-1] = 0; ptr[-42] = ptr[-1] = 0;
if (add_cacheinfo(mode, sha1, path_name, stage)) if (add_cacheinfo(mode, sha1, path_name, stage))
die("git-update-index: unable to update %s", die("git update-index: unable to update %s",
path_name); path_name);
} }
continue; continue;
@ -626,12 +626,12 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
unsigned int mode; unsigned int mode;
if (i+3 >= argc) if (i+3 >= argc)
die("git-update-index: --cacheinfo <mode> <sha1> <path>"); die("git update-index: --cacheinfo <mode> <sha1> <path>");
if (strtoul_ui(argv[i+1], 8, &mode) || if (strtoul_ui(argv[i+1], 8, &mode) ||
get_sha1_hex(argv[i+2], sha1) || get_sha1_hex(argv[i+2], sha1) ||
add_cacheinfo(mode, sha1, argv[i+3], 0)) add_cacheinfo(mode, sha1, argv[i+3], 0))
die("git-update-index: --cacheinfo" die("git update-index: --cacheinfo"
" cannot add %s", argv[i+3]); " cannot add %s", argv[i+3]);
i += 3; i += 3;
continue; continue;
@ -639,7 +639,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
if (!strcmp(path, "--chmod=-x") || if (!strcmp(path, "--chmod=-x") ||
!strcmp(path, "--chmod=+x")) { !strcmp(path, "--chmod=+x")) {
if (argc <= i+1) if (argc <= i+1)
die("git-update-index: %s <path>", path); die("git update-index: %s <path>", path);
set_executable_bit = path[8]; set_executable_bit = path[8];
continue; continue;
} }

Просмотреть файл

@ -97,7 +97,7 @@ int get_ack(int fd, unsigned char *result_sha1)
int len = packet_read_line(fd, line, sizeof(line)); int len = packet_read_line(fd, line, sizeof(line));
if (!len) if (!len)
die("git-fetch-pack: expected ACK/NAK, got EOF"); die("git fetch-pack: expected ACK/NAK, got EOF");
if (line[len-1] == '\n') if (line[len-1] == '\n')
line[--len] = 0; line[--len] = 0;
if (!strcmp(line, "NAK")) if (!strcmp(line, "NAK"))
@ -109,7 +109,7 @@ int get_ack(int fd, unsigned char *result_sha1)
return 1; return 1;
} }
} }
die("git-fetch_pack: expected ACK/NAK, got '%s'", line); die("git fetch_pack: expected ACK/NAK, got '%s'", line);
} }
int path_match(const char *path, int nr, char **match) int path_match(const char *path, int nr, char **match)

20
entry.c
Просмотреть файл

@ -111,7 +111,7 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
case S_IFREG: case S_IFREG:
new = read_blob_entry(ce, path, &size); new = read_blob_entry(ce, path, &size);
if (!new) if (!new)
return error("git-checkout-index: unable to read sha1 file of %s (%s)", return error("git checkout-index: unable to read sha1 file of %s (%s)",
path, sha1_to_hex(ce->sha1)); path, sha1_to_hex(ce->sha1));
/* /*
@ -132,7 +132,7 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
fd = create_file(path, ce->ce_mode); fd = create_file(path, ce->ce_mode);
if (fd < 0) { if (fd < 0) {
free(new); free(new);
return error("git-checkout-index: unable to create file %s (%s)", return error("git checkout-index: unable to create file %s (%s)",
path, strerror(errno)); path, strerror(errno));
} }
@ -140,12 +140,12 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
close(fd); close(fd);
free(new); free(new);
if (wrote != size) if (wrote != size)
return error("git-checkout-index: unable to write file %s", path); return error("git checkout-index: unable to write file %s", path);
break; break;
case S_IFLNK: case S_IFLNK:
new = read_blob_entry(ce, path, &size); new = read_blob_entry(ce, path, &size);
if (!new) if (!new)
return error("git-checkout-index: unable to read sha1 file of %s (%s)", return error("git checkout-index: unable to read sha1 file of %s (%s)",
path, sha1_to_hex(ce->sha1)); path, sha1_to_hex(ce->sha1));
if (to_tempfile || !has_symlinks) { if (to_tempfile || !has_symlinks) {
if (to_tempfile) { if (to_tempfile) {
@ -155,31 +155,31 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
fd = create_file(path, 0666); fd = create_file(path, 0666);
if (fd < 0) { if (fd < 0) {
free(new); free(new);
return error("git-checkout-index: unable to create " return error("git checkout-index: unable to create "
"file %s (%s)", path, strerror(errno)); "file %s (%s)", path, strerror(errno));
} }
wrote = write_in_full(fd, new, size); wrote = write_in_full(fd, new, size);
close(fd); close(fd);
free(new); free(new);
if (wrote != size) if (wrote != size)
return error("git-checkout-index: unable to write file %s", return error("git checkout-index: unable to write file %s",
path); path);
} else { } else {
wrote = symlink(new, path); wrote = symlink(new, path);
free(new); free(new);
if (wrote) if (wrote)
return error("git-checkout-index: unable to create " return error("git checkout-index: unable to create "
"symlink %s (%s)", path, strerror(errno)); "symlink %s (%s)", path, strerror(errno));
} }
break; break;
case S_IFGITLINK: case S_IFGITLINK:
if (to_tempfile) if (to_tempfile)
return error("git-checkout-index: cannot create temporary subproject %s", path); return error("git checkout-index: cannot create temporary subproject %s", path);
if (mkdir(path, 0777) < 0) if (mkdir(path, 0777) < 0)
return error("git-checkout-index: cannot create subproject directory %s", path); return error("git checkout-index: cannot create subproject directory %s", path);
break; break;
default: default:
return error("git-checkout-index: unknown file mode for %s", path); return error("git checkout-index: unknown file mode for %s", path);
} }
if (state->refresh_cache) { if (state->refresh_cache) {

Просмотреть файл

@ -27,7 +27,7 @@ static int merge_entry(int pos, const char *path)
int found; int found;
if (pos >= active_nr) if (pos >= active_nr)
die("git-merge-index: %s not in the cache", path); die("git merge-index: %s not in the cache", path);
arguments[0] = pgm; arguments[0] = pgm;
arguments[1] = ""; arguments[1] = "";
arguments[2] = ""; arguments[2] = "";
@ -53,7 +53,7 @@ static int merge_entry(int pos, const char *path)
arguments[stage + 4] = ownbuf[stage]; arguments[stage + 4] = ownbuf[stage];
} while (++pos < active_nr); } while (++pos < active_nr);
if (!found) if (!found)
die("git-merge-index: %s not in the cache", path); die("git merge-index: %s not in the cache", path);
run_program(); run_program();
return found; return found;
} }
@ -117,7 +117,7 @@ int main(int argc, char **argv)
merge_all(); merge_all();
continue; continue;
} }
die("git-merge-index: unknown option %s", arg); die("git merge-index: unknown option %s", arg);
} }
merge_file(arg); merge_file(arg);
} }

Просмотреть файл

@ -85,7 +85,7 @@ $test_case 'add (with different case)' '
rm camelcase && rm camelcase &&
echo 1 >CamelCase && echo 1 >CamelCase &&
git add CamelCase && git add CamelCase &&
test $(git-ls-files | grep -i camelcase | wc -l) = 1 test $(git ls-files | grep -i camelcase | wc -l) = 1
' '

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description="git-hash-object" test_description="git hash-object"
. ./test-lib.sh . ./test-lib.sh

Просмотреть файл

@ -78,7 +78,7 @@ test_expect_success 'git whatchanged -p --root' 'cmp whatchanged.expect whatchan
git tag my-first-tag git tag my-first-tag
test_expect_success 'git tag my-first-tag' 'cmp .git/refs/heads/master .git/refs/tags/my-first-tag' test_expect_success 'git tag my-first-tag' 'cmp .git/refs/heads/master .git/refs/tags/my-first-tag'
# TODO: test git-clone # TODO: test git clone
git checkout -b mybranch git checkout -b mybranch
test_expect_success 'git checkout -b mybranch' 'cmp .git/refs/heads/master .git/refs/heads/mybranch' test_expect_success 'git checkout -b mybranch' 'cmp .git/refs/heads/master .git/refs/heads/mybranch'

Просмотреть файл

@ -35,7 +35,7 @@ test_expect_success 'add key in different section' '
' '
SECTION="test.q\"s\\sq'sp e.key" SECTION="test.q\"s\\sq'sp e.key"
test_expect_success 'make sure git-config escapes section names properly' ' test_expect_success 'make sure git config escapes section names properly' '
git config "$SECTION" bar && git config "$SECTION" bar &&
check "$SECTION" bar check "$SECTION" bar
' '

Просмотреть файл

@ -228,21 +228,21 @@ test_expect_success \
'echo TEST >F && 'echo TEST >F &&
git add F && git add F &&
GIT_AUTHOR_DATE="2005-05-26 23:30" \ GIT_AUTHOR_DATE="2005-05-26 23:30" \
GIT_COMMITTER_DATE="2005-05-26 23:30" git-commit -m add -a && GIT_COMMITTER_DATE="2005-05-26 23:30" git commit -m add -a &&
h_TEST=$(git rev-parse --verify HEAD) h_TEST=$(git rev-parse --verify HEAD)
echo The other day this did not work. >M && echo The other day this did not work. >M &&
echo And then Bob told me how to fix it. >>M && echo And then Bob told me how to fix it. >>M &&
echo OTHER >F && echo OTHER >F &&
GIT_AUTHOR_DATE="2005-05-26 23:41" \ GIT_AUTHOR_DATE="2005-05-26 23:41" \
GIT_COMMITTER_DATE="2005-05-26 23:41" git-commit -F M -a && GIT_COMMITTER_DATE="2005-05-26 23:41" git commit -F M -a &&
h_OTHER=$(git rev-parse --verify HEAD) && h_OTHER=$(git rev-parse --verify HEAD) &&
GIT_AUTHOR_DATE="2005-05-26 23:44" \ GIT_AUTHOR_DATE="2005-05-26 23:44" \
GIT_COMMITTER_DATE="2005-05-26 23:44" git-commit --amend && GIT_COMMITTER_DATE="2005-05-26 23:44" git commit --amend &&
h_FIXED=$(git rev-parse --verify HEAD) && h_FIXED=$(git rev-parse --verify HEAD) &&
echo Merged initial commit and a later commit. >M && echo Merged initial commit and a later commit. >M &&
echo $h_TEST >.git/MERGE_HEAD && echo $h_TEST >.git/MERGE_HEAD &&
GIT_AUTHOR_DATE="2005-05-26 23:45" \ GIT_AUTHOR_DATE="2005-05-26 23:45" \
GIT_COMMITTER_DATE="2005-05-26 23:45" git-commit -F M && GIT_COMMITTER_DATE="2005-05-26 23:45" git commit -F M &&
h_MERGED=$(git rev-parse --verify HEAD) && h_MERGED=$(git rev-parse --verify HEAD) &&
rm -f M' rm -f M'
@ -253,7 +253,7 @@ $h_OTHER $h_FIXED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151040 +0000 co
$h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000 commit (merge): Merged initial commit and a later commit. $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000 commit (merge): Merged initial commit and a later commit.
EOF EOF
test_expect_success \ test_expect_success \
'git-commit logged updates' \ 'git commit logged updates' \
"diff expect .git/logs/$m" "diff expect .git/logs/$m"
unset h_TEST h_OTHER h_FIXED h_MERGED unset h_TEST h_OTHER h_FIXED h_MERGED

Просмотреть файл

@ -23,7 +23,7 @@ add_line_into_file()
fi fi
test_tick test_tick
git-commit --quiet -m "$MSG" $_file git commit --quiet -m "$MSG" $_file
} }
HASH1= HASH1=

Просмотреть файл

@ -13,7 +13,7 @@ file if core.symlinks is false.'
test_expect_success \ test_expect_success \
'preparation' ' 'preparation' '
git config core.symlinks false && git config core.symlinks false &&
l=$(echo -n file | git-hash-object -t blob -w --stdin) && l=$(echo -n file | git hash-object -t blob -w --stdin) &&
echo "120000 $l symlink" | git update-index --index-info' echo "120000 $l symlink" | git update-index --index-info'
test_expect_success \ test_expect_success \
@ -23,6 +23,6 @@ test -f symlink'
test_expect_success \ test_expect_success \
'the file must be the blob we added during the setup' ' 'the file must be the blob we added during the setup' '
test "$(git-hash-object -t blob symlink)" = $l' test "$(git hash-object -t blob symlink)" = $l'
test_done test_done

Просмотреть файл

@ -26,8 +26,8 @@ chmod +x .git/hooks/post-commit'
test_expect_success 'post-commit hook used ordinarily' ' test_expect_success 'post-commit hook used ordinarily' '
echo initial >top && echo initial >top &&
git-add top git add top
git-commit -m initial && git commit -m initial &&
test -r "${COMMIT_FILE}" test -r "${COMMIT_FILE}"
' '

Просмотреть файл

@ -40,7 +40,7 @@ test_expect_success 'update-index --remove --again' \
git ls-files -s >current && git ls-files -s >current &&
cmp current expected' cmp current expected'
test_expect_success 'first commit' 'git-commit -m initial' test_expect_success 'first commit' 'git commit -m initial'
cat > expected <<\EOF cat > expected <<\EOF
100644 53ab446c3f4e42ce9bb728a0ccb283a101be4979 0 dir1/file3 100644 53ab446c3f4e42ce9bb728a0ccb283a101be4979 0 dir1/file3

Просмотреть файл

@ -13,7 +13,7 @@ even if a plain file is in the working tree if core.symlinks is false.'
test_expect_success \ test_expect_success \
'preparation' ' 'preparation' '
git config core.symlinks false && git config core.symlinks false &&
l=$(echo -n file | git-hash-object -t blob -w --stdin) && l=$(echo -n file | git hash-object -t blob -w --stdin) &&
echo "120000 $l symlink" | git update-index --index-info' echo "120000 $l symlink" | git update-index --index-info'
test_expect_success \ test_expect_success \

Просмотреть файл

@ -26,7 +26,7 @@ test_expect_success setup '
echo initial >dir2/sub3 && echo initial >dir2/sub3 &&
git add check dir1 dir2 top foo && git add check dir1 dir2 top foo &&
test_tick test_tick
git-commit -m initial && git commit -m initial &&
echo changed >check && echo changed >check &&
echo changed >top && echo changed >top &&
@ -40,20 +40,20 @@ test_expect_success update '
' '
test_expect_success 'update noticed a removal' ' test_expect_success 'update noticed a removal' '
test "$(git-ls-files dir1/sub1)" = "" test "$(git ls-files dir1/sub1)" = ""
' '
test_expect_success 'update touched correct path' ' test_expect_success 'update touched correct path' '
test "$(git-diff-files --name-status dir2/sub3)" = "" test "$(git diff-files --name-status dir2/sub3)" = ""
' '
test_expect_success 'update did not touch other tracked files' ' test_expect_success 'update did not touch other tracked files' '
test "$(git-diff-files --name-status check)" = "M check" && test "$(git diff-files --name-status check)" = "M check" &&
test "$(git-diff-files --name-status top)" = "M top" test "$(git diff-files --name-status top)" = "M top"
' '
test_expect_success 'update did not touch untracked files' ' test_expect_success 'update did not touch untracked files' '
test "$(git-ls-files dir2/other)" = "" test "$(git ls-files dir2/other)" = ""
' '
test_expect_success 'cache tree has not been corrupted' ' test_expect_success 'cache tree has not been corrupted' '

Просмотреть файл

@ -96,7 +96,7 @@ cat > expect << EOF
# three/ # three/
EOF EOF
test_expect_success 'git-status honours core.excludesfile' \ test_expect_success 'git status honors core.excludesfile' \
'test_cmp expect output' 'test_cmp expect output'
test_expect_success 'trailing slash in exclude allows directory match(1)' ' test_expect_success 'trailing slash in exclude allows directory match(1)' '

Просмотреть файл

@ -13,7 +13,7 @@ line.
touch foo bar touch foo bar
git update-index --add foo bar git update-index --add foo bar
git-commit -m "add foo bar" git commit -m "add foo bar"
test_expect_success \ test_expect_success \
'git ls-files --error-unmatch should fail with unmatched path.' \ 'git ls-files --error-unmatch should fail with unmatched path.' \

Просмотреть файл

@ -241,7 +241,7 @@ test_expect_success 'merge-recursive simple' '
rm -fr [abcd] && rm -fr [abcd] &&
git checkout -f "$c2" && git checkout -f "$c2" &&
git-merge-recursive "$c0" -- "$c2" "$c1" git merge-recursive "$c0" -- "$c2" "$c1"
status=$? status=$?
case "$status" in case "$status" in
1) 1)
@ -285,7 +285,7 @@ test_expect_success 'merge-recursive remove conflict' '
rm -fr [abcd] && rm -fr [abcd] &&
git checkout -f "$c1" && git checkout -f "$c1" &&
git-merge-recursive "$c0" -- "$c1" "$c5" git merge-recursive "$c0" -- "$c1" "$c5"
status=$? status=$?
case "$status" in case "$status" in
1) 1)
@ -317,7 +317,7 @@ test_expect_success 'merge-recursive d/f simple' '
git reset --hard && git reset --hard &&
git checkout -f "$c1" && git checkout -f "$c1" &&
git-merge-recursive "$c0" -- "$c1" "$c3" git merge-recursive "$c0" -- "$c1" "$c3"
' '
test_expect_success 'merge-recursive result' ' test_expect_success 'merge-recursive result' '
@ -339,7 +339,7 @@ test_expect_success 'merge-recursive d/f conflict' '
git reset --hard && git reset --hard &&
git checkout -f "$c1" && git checkout -f "$c1" &&
git-merge-recursive "$c0" -- "$c1" "$c4" git merge-recursive "$c0" -- "$c1" "$c4"
status=$? status=$?
case "$status" in case "$status" in
1) 1)
@ -373,7 +373,7 @@ test_expect_success 'merge-recursive d/f conflict the other way' '
git reset --hard && git reset --hard &&
git checkout -f "$c4" && git checkout -f "$c4" &&
git-merge-recursive "$c0" -- "$c4" "$c1" git merge-recursive "$c0" -- "$c4" "$c1"
status=$? status=$?
case "$status" in case "$status" in
1) 1)
@ -407,7 +407,7 @@ test_expect_success 'merge-recursive d/f conflict' '
git reset --hard && git reset --hard &&
git checkout -f "$c1" && git checkout -f "$c1" &&
git-merge-recursive "$c0" -- "$c1" "$c6" git merge-recursive "$c0" -- "$c1" "$c6"
status=$? status=$?
case "$status" in case "$status" in
1) 1)
@ -441,7 +441,7 @@ test_expect_success 'merge-recursive d/f conflict' '
git reset --hard && git reset --hard &&
git checkout -f "$c6" && git checkout -f "$c6" &&
git-merge-recursive "$c0" -- "$c6" "$c1" git merge-recursive "$c0" -- "$c6" "$c1"
status=$? status=$?
case "$status" in case "$status" in
1) 1)

Просмотреть файл

@ -14,10 +14,10 @@ test_expect_success \
'prepare a trivial repository' \ 'prepare a trivial repository' \
'echo Hello > A && 'echo Hello > A &&
git update-index --add A && git update-index --add A &&
git-commit -m "Initial commit." && git commit -m "Initial commit." &&
echo World >> A && echo World >> A &&
git update-index --add A && git update-index --add A &&
git-commit -m "Second commit." && git commit -m "Second commit." &&
HEAD=$(git rev-parse --verify HEAD)' HEAD=$(git rev-parse --verify HEAD)'
test_expect_success \ test_expect_success \
@ -123,7 +123,7 @@ test_expect_success \
test_expect_success 'test tracking setup via --track' \ test_expect_success 'test tracking setup via --track' \
'git config remote.local.url . && 'git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --track my1 local/master && git branch --track my1 local/master &&
test $(git config branch.my1.remote) = local && test $(git config branch.my1.remote) = local &&
test $(git config branch.my1.merge) = refs/heads/master' test $(git config branch.my1.merge) = refs/heads/master'
@ -131,7 +131,7 @@ test_expect_success 'test tracking setup via --track' \
test_expect_success 'test tracking setup (non-wildcard, matching)' \ test_expect_success 'test tracking setup (non-wildcard, matching)' \
'git config remote.local.url . && 'git config remote.local.url . &&
git config remote.local.fetch refs/heads/master:refs/remotes/local/master && git config remote.local.fetch refs/heads/master:refs/remotes/local/master &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --track my4 local/master && git branch --track my4 local/master &&
test $(git config branch.my4.remote) = local && test $(git config branch.my4.remote) = local &&
test $(git config branch.my4.merge) = refs/heads/master' test $(git config branch.my4.merge) = refs/heads/master'
@ -139,7 +139,7 @@ test_expect_success 'test tracking setup (non-wildcard, matching)' \
test_expect_success 'test tracking setup (non-wildcard, not matching)' \ test_expect_success 'test tracking setup (non-wildcard, not matching)' \
'git config remote.local.url . && 'git config remote.local.url . &&
git config remote.local.fetch refs/heads/s:refs/remotes/local/s && git config remote.local.fetch refs/heads/s:refs/remotes/local/s &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --track my5 local/master && git branch --track my5 local/master &&
! test "$(git config branch.my5.remote)" = local && ! test "$(git config branch.my5.remote)" = local &&
! test "$(git config branch.my5.merge)" = refs/heads/master' ! test "$(git config branch.my5.merge)" = refs/heads/master'
@ -148,7 +148,7 @@ test_expect_success 'test tracking setup via config' \
'git config branch.autosetupmerge true && 'git config branch.autosetupmerge true &&
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch my3 local/master && git branch my3 local/master &&
test $(git config branch.my3.remote) = local && test $(git config branch.my3.remote) = local &&
test $(git config branch.my3.merge) = refs/heads/master' test $(git config branch.my3.merge) = refs/heads/master'
@ -157,7 +157,7 @@ test_expect_success 'test overriding tracking setup via --no-track' \
'git config branch.autosetupmerge true && 'git config branch.autosetupmerge true &&
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --no-track my2 local/master && git branch --no-track my2 local/master &&
git config branch.autosetupmerge false && git config branch.autosetupmerge false &&
! test "$(git config branch.my2.remote)" = local && ! test "$(git config branch.my2.remote)" = local &&
@ -173,7 +173,7 @@ test_expect_success 'no tracking without .fetch entries' \
test_expect_success 'test tracking setup via --track but deeper' \ test_expect_success 'test tracking setup via --track but deeper' \
'git config remote.local.url . && 'git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/o/o || git-fetch local) && (git show-ref -q refs/remotes/local/o/o || git fetch local) &&
git branch --track my7 local/o/o && git branch --track my7 local/o/o &&
test "$(git config branch.my7.remote)" = local && test "$(git config branch.my7.remote)" = local &&
test "$(git config branch.my7.merge)" = refs/heads/o/o' test "$(git config branch.my7.merge)" = refs/heads/o/o'
@ -209,7 +209,7 @@ EOF
test_expect_success \ test_expect_success \
'git checkout -b g/h/i -l should create a branch and a log' \ 'git checkout -b g/h/i -l should create a branch and a log' \
'GIT_COMMITTER_DATE="2005-05-26 23:30" \ 'GIT_COMMITTER_DATE="2005-05-26 23:30" \
git-checkout -b g/h/i -l master && git checkout -b g/h/i -l master &&
test -f .git/refs/heads/g/h/i && test -f .git/refs/heads/g/h/i &&
test -f .git/logs/refs/heads/g/h/i && test -f .git/logs/refs/heads/g/h/i &&
diff expect .git/logs/refs/heads/g/h/i' diff expect .git/logs/refs/heads/g/h/i'
@ -228,7 +228,7 @@ test_expect_success 'autosetuprebase local on a tracked local branch' '
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase local && git config branch.autosetuprebase local &&
(git show-ref -q refs/remotes/local/o || git-fetch local) && (git show-ref -q refs/remotes/local/o || git fetch local) &&
git branch mybase && git branch mybase &&
git branch --track myr1 mybase && git branch --track myr1 mybase &&
test "$(git config branch.myr1.remote)" = . && test "$(git config branch.myr1.remote)" = . &&
@ -240,7 +240,7 @@ test_expect_success 'autosetuprebase always on a tracked local branch' '
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase always && git config branch.autosetuprebase always &&
(git show-ref -q refs/remotes/local/o || git-fetch local) && (git show-ref -q refs/remotes/local/o || git fetch local) &&
git branch mybase2 && git branch mybase2 &&
git branch --track myr2 mybase && git branch --track myr2 mybase &&
test "$(git config branch.myr2.remote)" = . && test "$(git config branch.myr2.remote)" = . &&
@ -252,7 +252,7 @@ test_expect_success 'autosetuprebase remote on a tracked local branch' '
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase remote && git config branch.autosetuprebase remote &&
(git show-ref -q refs/remotes/local/o || git-fetch local) && (git show-ref -q refs/remotes/local/o || git fetch local) &&
git branch mybase3 && git branch mybase3 &&
git branch --track myr3 mybase2 && git branch --track myr3 mybase2 &&
test "$(git config branch.myr3.remote)" = . && test "$(git config branch.myr3.remote)" = . &&
@ -264,7 +264,7 @@ test_expect_success 'autosetuprebase never on a tracked local branch' '
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase never && git config branch.autosetuprebase never &&
(git show-ref -q refs/remotes/local/o || git-fetch local) && (git show-ref -q refs/remotes/local/o || git fetch local) &&
git branch mybase4 && git branch mybase4 &&
git branch --track myr4 mybase2 && git branch --track myr4 mybase2 &&
test "$(git config branch.myr4.remote)" = . && test "$(git config branch.myr4.remote)" = . &&
@ -276,7 +276,7 @@ test_expect_success 'autosetuprebase local on a tracked remote branch' '
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase local && git config branch.autosetuprebase local &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --track myr5 local/master && git branch --track myr5 local/master &&
test "$(git config branch.myr5.remote)" = local && test "$(git config branch.myr5.remote)" = local &&
test "$(git config branch.myr5.merge)" = refs/heads/master && test "$(git config branch.myr5.merge)" = refs/heads/master &&
@ -287,7 +287,7 @@ test_expect_success 'autosetuprebase never on a tracked remote branch' '
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase never && git config branch.autosetuprebase never &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --track myr6 local/master && git branch --track myr6 local/master &&
test "$(git config branch.myr6.remote)" = local && test "$(git config branch.myr6.remote)" = local &&
test "$(git config branch.myr6.merge)" = refs/heads/master && test "$(git config branch.myr6.merge)" = refs/heads/master &&
@ -298,7 +298,7 @@ test_expect_success 'autosetuprebase remote on a tracked remote branch' '
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase remote && git config branch.autosetuprebase remote &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --track myr7 local/master && git branch --track myr7 local/master &&
test "$(git config branch.myr7.remote)" = local && test "$(git config branch.myr7.remote)" = local &&
test "$(git config branch.myr7.merge)" = refs/heads/master && test "$(git config branch.myr7.merge)" = refs/heads/master &&
@ -309,7 +309,7 @@ test_expect_success 'autosetuprebase always on a tracked remote branch' '
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase remote && git config branch.autosetuprebase remote &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --track myr8 local/master && git branch --track myr8 local/master &&
test "$(git config branch.myr8.remote)" = local && test "$(git config branch.myr8.remote)" = local &&
test "$(git config branch.myr8.merge)" = refs/heads/master && test "$(git config branch.myr8.merge)" = refs/heads/master &&
@ -320,7 +320,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' '
git config --unset branch.autosetuprebase && git config --unset branch.autosetuprebase &&
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --track myr9 local/master && git branch --track myr9 local/master &&
test "$(git config branch.myr9.remote)" = local && test "$(git config branch.myr9.remote)" = local &&
test "$(git config branch.myr9.merge)" = refs/heads/master && test "$(git config branch.myr9.merge)" = refs/heads/master &&
@ -330,7 +330,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' '
test_expect_success 'autosetuprebase unconfigured on a tracked local branch' ' test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/o || git-fetch local) && (git show-ref -q refs/remotes/local/o || git fetch local) &&
git branch mybase10 && git branch mybase10 &&
git branch --track myr10 mybase2 && git branch --track myr10 mybase2 &&
test "$(git config branch.myr10.remote)" = . && test "$(git config branch.myr10.remote)" = . &&
@ -341,7 +341,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '
test_expect_success 'autosetuprebase unconfigured on untracked local branch' ' test_expect_success 'autosetuprebase unconfigured on untracked local branch' '
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --no-track myr11 mybase2 && git branch --no-track myr11 mybase2 &&
test "z$(git config branch.myr11.remote)" = z && test "z$(git config branch.myr11.remote)" = z &&
test "z$(git config branch.myr11.merge)" = z && test "z$(git config branch.myr11.merge)" = z &&
@ -351,7 +351,7 @@ test_expect_success 'autosetuprebase unconfigured on untracked local branch' '
test_expect_success 'autosetuprebase unconfigured on untracked remote branch' ' test_expect_success 'autosetuprebase unconfigured on untracked remote branch' '
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --no-track myr12 local/master && git branch --no-track myr12 local/master &&
test "z$(git config branch.myr12.remote)" = z && test "z$(git config branch.myr12.remote)" = z &&
test "z$(git config branch.myr12.merge)" = z && test "z$(git config branch.myr12.merge)" = z &&
@ -362,7 +362,7 @@ test_expect_success 'autosetuprebase never on an untracked local branch' '
git config branch.autosetuprebase never && git config branch.autosetuprebase never &&
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --no-track myr13 mybase2 && git branch --no-track myr13 mybase2 &&
test "z$(git config branch.myr13.remote)" = z && test "z$(git config branch.myr13.remote)" = z &&
test "z$(git config branch.myr13.merge)" = z && test "z$(git config branch.myr13.merge)" = z &&
@ -373,7 +373,7 @@ test_expect_success 'autosetuprebase local on an untracked local branch' '
git config branch.autosetuprebase local && git config branch.autosetuprebase local &&
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --no-track myr14 mybase2 && git branch --no-track myr14 mybase2 &&
test "z$(git config branch.myr14.remote)" = z && test "z$(git config branch.myr14.remote)" = z &&
test "z$(git config branch.myr14.merge)" = z && test "z$(git config branch.myr14.merge)" = z &&
@ -384,7 +384,7 @@ test_expect_success 'autosetuprebase remote on an untracked local branch' '
git config branch.autosetuprebase remote && git config branch.autosetuprebase remote &&
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --no-track myr15 mybase2 && git branch --no-track myr15 mybase2 &&
test "z$(git config branch.myr15.remote)" = z && test "z$(git config branch.myr15.remote)" = z &&
test "z$(git config branch.myr15.merge)" = z && test "z$(git config branch.myr15.merge)" = z &&
@ -395,7 +395,7 @@ test_expect_success 'autosetuprebase always on an untracked local branch' '
git config branch.autosetuprebase always && git config branch.autosetuprebase always &&
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --no-track myr16 mybase2 && git branch --no-track myr16 mybase2 &&
test "z$(git config branch.myr16.remote)" = z && test "z$(git config branch.myr16.remote)" = z &&
test "z$(git config branch.myr16.merge)" = z && test "z$(git config branch.myr16.merge)" = z &&
@ -406,7 +406,7 @@ test_expect_success 'autosetuprebase never on an untracked remote branch' '
git config branch.autosetuprebase never && git config branch.autosetuprebase never &&
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --no-track myr17 local/master && git branch --no-track myr17 local/master &&
test "z$(git config branch.myr17.remote)" = z && test "z$(git config branch.myr17.remote)" = z &&
test "z$(git config branch.myr17.merge)" = z && test "z$(git config branch.myr17.merge)" = z &&
@ -417,7 +417,7 @@ test_expect_success 'autosetuprebase local on an untracked remote branch' '
git config branch.autosetuprebase local && git config branch.autosetuprebase local &&
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --no-track myr18 local/master && git branch --no-track myr18 local/master &&
test "z$(git config branch.myr18.remote)" = z && test "z$(git config branch.myr18.remote)" = z &&
test "z$(git config branch.myr18.merge)" = z && test "z$(git config branch.myr18.merge)" = z &&
@ -428,7 +428,7 @@ test_expect_success 'autosetuprebase remote on an untracked remote branch' '
git config branch.autosetuprebase remote && git config branch.autosetuprebase remote &&
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --no-track myr19 local/master && git branch --no-track myr19 local/master &&
test "z$(git config branch.myr19.remote)" = z && test "z$(git config branch.myr19.remote)" = z &&
test "z$(git config branch.myr19.merge)" = z && test "z$(git config branch.myr19.merge)" = z &&
@ -439,7 +439,7 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' '
git config branch.autosetuprebase always && git config branch.autosetuprebase always &&
git config remote.local.url . && git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git show-ref -q refs/remotes/local/master || git-fetch local) && (git show-ref -q refs/remotes/local/master || git fetch local) &&
git branch --no-track myr20 local/master && git branch --no-track myr20 local/master &&
test "z$(git config branch.myr20.remote)" = z && test "z$(git config branch.myr20.remote)" = z &&
test "z$(git config branch.myr20.merge)" = z && test "z$(git config branch.myr20.merge)" = z &&

Просмотреть файл

@ -17,7 +17,7 @@ test_expect_success \
'prepare a trivial repository' \ 'prepare a trivial repository' \
'echo Hello > A && 'echo Hello > A &&
git update-index --add A && git update-index --add A &&
git-commit -m "Initial commit." && git commit -m "Initial commit." &&
HEAD=$(git rev-parse --verify HEAD)' HEAD=$(git rev-parse --verify HEAD)'
SHA1= SHA1=
@ -97,7 +97,7 @@ test_expect_success \
git branch n' git branch n'
test_expect_success 'pack, prune and repack' ' test_expect_success 'pack, prune and repack' '
git-tag foo && git tag foo &&
git pack-refs --all --prune && git pack-refs --all --prune &&
git show-ref >all-of-them && git show-ref >all-of-them &&
git pack-refs && git pack-refs &&

Просмотреть файл

@ -16,15 +16,15 @@ test_expect_success \
'prepare repository with topic branches' \ 'prepare repository with topic branches' \
'echo First > A && 'echo First > A &&
git update-index --add A && git update-index --add A &&
git-commit -m "Add A." && git commit -m "Add A." &&
git checkout -b my-topic-branch && git checkout -b my-topic-branch &&
echo Second > B && echo Second > B &&
git update-index --add B && git update-index --add B &&
git-commit -m "Add B." && git commit -m "Add B." &&
git checkout -f master && git checkout -f master &&
echo Third >> A && echo Third >> A &&
git update-index A && git update-index A &&
git-commit -m "Modify A." && git commit -m "Modify A." &&
git checkout -b side my-topic-branch && git checkout -b side my-topic-branch &&
echo Side >> C && echo Side >> C &&
git add C && git add C &&

Просмотреть файл

@ -15,29 +15,29 @@ test_expect_success \
'prepare repository with topic branch' \ 'prepare repository with topic branch' \
'echo First > A && 'echo First > A &&
git update-index --add A && git update-index --add A &&
git-commit -m "Add A." && git commit -m "Add A." &&
git-checkout -b my-topic-branch && git checkout -b my-topic-branch &&
echo Second > B && echo Second > B &&
git update-index --add B && git update-index --add B &&
git-commit -m "Add B." && git commit -m "Add B." &&
echo AnotherSecond > C && echo AnotherSecond > C &&
git update-index --add C && git update-index --add C &&
git-commit -m "Add C." && git commit -m "Add C." &&
git-checkout -f master && git checkout -f master &&
echo Third >> A && echo Third >> A &&
git update-index A && git update-index A &&
git-commit -m "Modify A." git commit -m "Modify A."
' '
test_expect_success \ test_expect_success \
'pick top patch from topic branch into master' \ 'pick top patch from topic branch into master' \
'git cherry-pick my-topic-branch^0 && 'git cherry-pick my-topic-branch^0 &&
git-checkout -f my-topic-branch && git checkout -f my-topic-branch &&
git branch master-merge master && git branch master-merge master &&
git branch my-topic-branch-merge my-topic-branch git branch my-topic-branch-merge my-topic-branch
' '
@ -49,13 +49,13 @@ test_debug \
' '
test_expect_success \ test_expect_success \
'rebase topic branch against new master and check git-am did not get halted' \ 'rebase topic branch against new master and check git am did not get halted' \
'git-rebase master && test ! -d .git/rebase-apply' 'git rebase master && test ! -d .git/rebase-apply'
test_expect_success \ test_expect_success \
'rebase --merge topic branch that was partially merged upstream' \ 'rebase --merge topic branch that was partially merged upstream' \
'git-checkout -f my-topic-branch-merge && 'git checkout -f my-topic-branch-merge &&
git-rebase --merge master-merge && git rebase --merge master-merge &&
test ! -d .git/rebase-merge' test ! -d .git/rebase-merge'
test_done test_done

Просмотреть файл

@ -7,7 +7,7 @@ test_description='git rebase --merge --skip tests'
. ./test-lib.sh . ./test-lib.sh
# we assume the default git-am -3 --skip strategy is tested independently # we assume the default git am -3 --skip strategy is tested independently
# and always works :) # and always works :)
test_expect_success setup ' test_expect_success setup '

Просмотреть файл

@ -161,7 +161,7 @@ test_expect_success 'stop on conflicting pick' '
test "$(git rev-parse HEAD~3)" = "$(git rev-parse master)" && test "$(git rev-parse HEAD~3)" = "$(git rev-parse master)" &&
test_cmp expect .git/rebase-merge/patch && test_cmp expect .git/rebase-merge/patch &&
test_cmp expect2 file1 && test_cmp expect2 file1 &&
test "$(git-diff --name-status | test "$(git diff --name-status |
sed -n -e "/^U/s/^U[^a-z]*//p")" = file1 && sed -n -e "/^U/s/^U[^a-z]*//p")" = file1 &&
test 4 = $(grep -v "^#" < .git/rebase-merge/done | wc -l) && test 4 = $(grep -v "^#" < .git/rebase-merge/done | wc -l) &&
test 0 = $(grep -c "^[^#]" < .git/rebase-merge/git-rebase-todo) test 0 = $(grep -c "^[^#]" < .git/rebase-merge/git-rebase-todo)

Просмотреть файл

@ -52,7 +52,7 @@ testrebase() {
test -d "$dotest" && test -d "$dotest" &&
test_must_fail git rebase --skip && test_must_fail git rebase --skip &&
test $(git rev-parse HEAD) = $(git rev-parse master) && test $(git rev-parse HEAD) = $(git rev-parse master) &&
git-rebase --abort && git rebase --abort &&
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) && test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
test ! -d "$dotest" test ! -d "$dotest"
' '

Просмотреть файл

@ -17,25 +17,25 @@ test_expect_success \
'prepare repository with topic branch, and check cherry finds the 2 patches from there' \ 'prepare repository with topic branch, and check cherry finds the 2 patches from there' \
'echo First > A && 'echo First > A &&
git update-index --add A && git update-index --add A &&
git-commit -m "Add A." && git commit -m "Add A." &&
git-checkout -b my-topic-branch && git checkout -b my-topic-branch &&
echo Second > B && echo Second > B &&
git update-index --add B && git update-index --add B &&
git-commit -m "Add B." && git commit -m "Add B." &&
sleep 2 && sleep 2 &&
echo AnotherSecond > C && echo AnotherSecond > C &&
git update-index --add C && git update-index --add C &&
git-commit -m "Add C." && git commit -m "Add C." &&
git-checkout -f master && git checkout -f master &&
rm -f B C && rm -f B C &&
echo Third >> A && echo Third >> A &&
git update-index A && git update-index A &&
git-commit -m "Modify A." && git commit -m "Modify A." &&
expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* + .*" expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* + .*"
' '

Просмотреть файл

@ -12,14 +12,14 @@ test_expect_success \
'Initialize test directory' \ 'Initialize test directory' \
"touch -- foo bar baz 'space embedded' -q && "touch -- foo bar baz 'space embedded' -q &&
git add -- foo bar baz 'space embedded' -q && git add -- foo bar baz 'space embedded' -q &&
git-commit -m 'add normal files' && git commit -m 'add normal files' &&
test_tabs=y && test_tabs=y &&
if touch -- 'tab embedded' 'newline if touch -- 'tab embedded' 'newline
embedded' embedded'
then then
git add -- 'tab embedded' 'newline git add -- 'tab embedded' 'newline
embedded' && embedded' &&
git-commit -m 'add files with tabs and newlines' git commit -m 'add files with tabs and newlines'
else else
say 'Your filesystem does not allow tabs in filenames.' say 'Your filesystem does not allow tabs in filenames.'
test_tabs=n test_tabs=n

Просмотреть файл

@ -2,7 +2,7 @@
# #
# #
test_description='git-mktag: tag object verify test' test_description='git mktag: tag object verify test'
. ./test-lib.sh . ./test-lib.sh
@ -14,7 +14,7 @@ test_description='git-mktag: tag object verify test'
check_verify_failure () { check_verify_failure () {
expect="$2" expect="$2"
test_expect_success "$1" ' test_expect_success "$1" '
( test_must_fail git-mktag <tag.sig 2>message ) && ( test_must_fail git mktag <tag.sig 2>message ) &&
grep "$expect" message grep "$expect" message
' '
} }
@ -24,7 +24,7 @@ check_verify_failure () {
# for the tag. # for the tag.
echo Hello >A echo Hello >A
git update-index --add A git update-index --add A
git-commit -m "Initial commit" git commit -m "Initial commit"
head=$(git rev-parse --verify HEAD) head=$(git rev-parse --verify HEAD)
############################################################ ############################################################
@ -222,7 +222,7 @@ EOF
test_expect_success \ test_expect_success \
'allow empty tag email' \ 'allow empty tag email' \
'git-mktag <tag.sig >.git/refs/tags/mytag 2>message' 'git mktag <tag.sig >.git/refs/tags/mytag 2>message'
############################################################ ############################################################
# 16. disallow spaces in tag email # 16. disallow spaces in tag email
@ -350,14 +350,14 @@ EOF
test_expect_success \ test_expect_success \
'create valid tag' \ 'create valid tag' \
'git-mktag <tag.sig >.git/refs/tags/mytag 2>message' 'git mktag <tag.sig >.git/refs/tags/mytag 2>message'
############################################################ ############################################################
# 25. check mytag # 25. check mytag
test_expect_success \ test_expect_success \
'check mytag' \ 'check mytag' \
'git-tag -l | grep mytag' 'git tag -l | grep mytag'
test_done test_done

Просмотреть файл

@ -18,7 +18,7 @@ test_expect_success setup '
T=$(git write-tree) && T=$(git write-tree) &&
C=$(git commit-tree $T <../t3900/1-UTF-8.txt) && C=$(git commit-tree $T <../t3900/1-UTF-8.txt) &&
git update-ref HEAD $C && git update-ref HEAD $C &&
git-tag C0 git tag C0
' '
test_expect_success 'no encoding header for base case' ' test_expect_success 'no encoding header for base case' '
@ -30,9 +30,9 @@ for H in ISO-8859-1 EUCJP ISO-2022-JP
do do
test_expect_success "$H setup" ' test_expect_success "$H setup" '
git config i18n.commitencoding $H && git config i18n.commitencoding $H &&
git-checkout -b $H C0 && git checkout -b $H C0 &&
echo $H >F && echo $H >F &&
git-commit -a -F ../t3900/$H.txt git commit -a -F ../t3900/$H.txt
' '
done done

Просмотреть файл

@ -103,7 +103,7 @@ test_expect_success 'rebase (U/U)' '
# we want UTF-8 encoded name. # we want UTF-8 encoded name.
. ../t3901-utf8.txt && . ../t3901-utf8.txt &&
git checkout -b test && git checkout -b test &&
git-rebase master && git rebase master &&
check_encoding 2 check_encoding 2
' '
@ -114,7 +114,7 @@ test_expect_success 'rebase (U/L)' '
. ../t3901-utf8.txt && . ../t3901-utf8.txt &&
git reset --hard side && git reset --hard side &&
git-rebase master && git rebase master &&
check_encoding 2 check_encoding 2
' '
@ -126,7 +126,7 @@ test_expect_success 'rebase (L/L)' '
. ../t3901-8859-1.txt && . ../t3901-8859-1.txt &&
git reset --hard side && git reset --hard side &&
git-rebase master && git rebase master &&
check_encoding 2 8859 check_encoding 2 8859
' '
@ -139,7 +139,7 @@ test_expect_success 'rebase (L/U)' '
. ../t3901-8859-1.txt && . ../t3901-8859-1.txt &&
git reset --hard side && git reset --hard side &&
git-rebase master && git rebase master &&
check_encoding 2 8859 check_encoding 2 8859
' '
@ -211,7 +211,7 @@ test_expect_success 'rebase --merge (U/U)' '
. ../t3901-utf8.txt && . ../t3901-utf8.txt &&
git reset --hard side && git reset --hard side &&
git-rebase --merge master && git rebase --merge master &&
check_encoding 2 check_encoding 2
' '
@ -222,7 +222,7 @@ test_expect_success 'rebase --merge (U/L)' '
. ../t3901-utf8.txt && . ../t3901-utf8.txt &&
git reset --hard side && git reset --hard side &&
git-rebase --merge master && git rebase --merge master &&
check_encoding 2 check_encoding 2
' '
@ -234,7 +234,7 @@ test_expect_success 'rebase --merge (L/L)' '
. ../t3901-8859-1.txt && . ../t3901-8859-1.txt &&
git reset --hard side && git reset --hard side &&
git-rebase --merge master && git rebase --merge master &&
check_encoding 2 8859 check_encoding 2 8859
' '
@ -247,7 +247,7 @@ test_expect_success 'rebase --merge (L/U)' '
. ../t3901-8859-1.txt && . ../t3901-8859-1.txt &&
git reset --hard side && git reset --hard side &&
git-rebase --merge master && git rebase --merge master &&
check_encoding 2 8859 check_encoding 2 8859
' '

Просмотреть файл

@ -3,7 +3,7 @@
# Copyright (c) 2007 Johannes E Schindelin # Copyright (c) 2007 Johannes E Schindelin
# #
test_description='Test git-stash' test_description='Test git stash'
. ./test-lib.sh . ./test-lib.sh

Просмотреть файл

@ -61,7 +61,7 @@ test_expect_success 'apply detecting corrupt patch correctly' \
detected=`sed -ne "${detected}p" broken` && detected=`sed -ne "${detected}p" broken` &&
test "$detected" = xCIT' test "$detected" = xCIT'
test_expect_success 'initial commit' 'git-commit -a -m initial' test_expect_success 'initial commit' 'git commit -a -m initial'
# Try removal (b), modification (d), and creation (e). # Try removal (b), modification (d), and creation (e).
test_expect_success 'diff-index with --binary' \ test_expect_success 'diff-index with --binary' \
@ -72,7 +72,7 @@ test_expect_success 'diff-index with --binary' \
git apply --stat --summary current' git apply --stat --summary current'
test_expect_success 'apply binary patch' \ test_expect_success 'apply binary patch' \
'git-reset --hard && 'git reset --hard &&
git apply --binary --index <current && git apply --binary --index <current &&
tree1=`git write-tree` && tree1=`git write-tree` &&
test "$tree1" = "$tree0"' test "$tree1" = "$tree0"'

Просмотреть файл

@ -21,16 +21,16 @@ cat file1 >file2
cat file1 >file4 cat file1 >file4
git update-index --add --remove file1 file2 file4 git update-index --add --remove file1 file2 file4
git-commit -m 'Initial Version' 2>/dev/null git commit -m 'Initial Version' 2>/dev/null
git-checkout -b binary git checkout -b binary
perl -pe 'y/x/\000/' <file1 >file3 perl -pe 'y/x/\000/' <file1 >file3
cat file3 >file4 cat file3 >file4
git add file2 git add file2
perl -pe 'y/\000/v/' <file3 >file1 perl -pe 'y/\000/v/' <file3 >file1
rm -f file2 rm -f file2
git update-index --add --remove file1 file2 file3 file4 git update-index --add --remove file1 file2 file3 file4
git-commit -m 'Second Version' git commit -m 'Second Version'
git diff-tree -p master binary >B.diff git diff-tree -p master binary >B.diff
git diff-tree -p -C master binary >C.diff git diff-tree -p -C master binary >C.diff
@ -39,47 +39,47 @@ git diff-tree -p --binary master binary >BF.diff
git diff-tree -p --binary -C master binary >CF.diff git diff-tree -p --binary -C master binary >CF.diff
test_expect_success 'stat binary diff -- should not fail.' \ test_expect_success 'stat binary diff -- should not fail.' \
'git-checkout master 'git checkout master
git apply --stat --summary B.diff' git apply --stat --summary B.diff'
test_expect_success 'stat binary diff (copy) -- should not fail.' \ test_expect_success 'stat binary diff (copy) -- should not fail.' \
'git-checkout master 'git checkout master
git apply --stat --summary C.diff' git apply --stat --summary C.diff'
test_expect_success 'check binary diff -- should fail.' \ test_expect_success 'check binary diff -- should fail.' \
'git-checkout master && 'git checkout master &&
test_must_fail git apply --check B.diff' test_must_fail git apply --check B.diff'
test_expect_success 'check binary diff (copy) -- should fail.' \ test_expect_success 'check binary diff (copy) -- should fail.' \
'git-checkout master && 'git checkout master &&
test_must_fail git apply --check C.diff' test_must_fail git apply --check C.diff'
test_expect_success \ test_expect_success \
'check incomplete binary diff with replacement -- should fail.' ' 'check incomplete binary diff with replacement -- should fail.' '
git-checkout master && git checkout master &&
test_must_fail git apply --check --allow-binary-replacement B.diff test_must_fail git apply --check --allow-binary-replacement B.diff
' '
test_expect_success \ test_expect_success \
'check incomplete binary diff with replacement (copy) -- should fail.' ' 'check incomplete binary diff with replacement (copy) -- should fail.' '
git-checkout master && git checkout master &&
test_must_fail git apply --check --allow-binary-replacement C.diff test_must_fail git apply --check --allow-binary-replacement C.diff
' '
test_expect_success 'check binary diff with replacement.' \ test_expect_success 'check binary diff with replacement.' \
'git-checkout master 'git checkout master
git apply --check --allow-binary-replacement BF.diff' git apply --check --allow-binary-replacement BF.diff'
test_expect_success 'check binary diff with replacement (copy).' \ test_expect_success 'check binary diff with replacement (copy).' \
'git-checkout master 'git checkout master
git apply --check --allow-binary-replacement CF.diff' git apply --check --allow-binary-replacement CF.diff'
# Now we start applying them. # Now we start applying them.
do_reset () { do_reset () {
rm -f file? && rm -f file? &&
git-reset --hard && git reset --hard &&
git-checkout -f master git checkout -f master
} }
test_expect_success 'apply binary diff -- should fail.' \ test_expect_success 'apply binary diff -- should fail.' \

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description='core.whitespace rules and git-apply' test_description='core.whitespace rules and git apply'
. ./test-lib.sh . ./test-lib.sh

Просмотреть файл

@ -26,7 +26,7 @@ test_expect_success 'apply same filename with independent changes' '
git diff >> patch0 && git diff >> patch0 &&
cp same_fn same_fn2 && cp same_fn same_fn2 &&
git reset --hard && git reset --hard &&
git-apply patch0 && git apply patch0 &&
diff same_fn same_fn2 diff same_fn same_fn2
' '
@ -39,7 +39,7 @@ test_expect_success 'apply same filename with overlapping changes' '
git diff >> patch0 && git diff >> patch0 &&
cp same_fn same_fn2 && cp same_fn same_fn2 &&
git reset --hard && git reset --hard &&
git-apply patch0 && git apply patch0 &&
diff same_fn same_fn2 diff same_fn same_fn2
' '

Просмотреть файл

@ -164,7 +164,7 @@ test_expect_success 'am --keep really keeps the subject' '
git checkout HEAD^ && git checkout HEAD^ &&
git am --keep patch4 && git am --keep patch4 &&
! test -d .git/rebase-apply && ! test -d .git/rebase-apply &&
git-cat-file commit HEAD | git cat-file commit HEAD |
grep -q -F "Re: Re: Re: [PATCH 1/5 v2] third" grep -q -F "Re: Re: Re: [PATCH 1/5 v2] third"
' '

Просмотреть файл

@ -44,14 +44,14 @@ do
' '
test_expect_success "am$with3 --skip continue after failed am$with3" ' test_expect_success "am$with3 --skip continue after failed am$with3" '
test_must_fail git-am$with3 --skip >output && test_must_fail git am$with3 --skip >output &&
test "$(grep "^Applying" output)" = "Applying: 6" && test "$(grep "^Applying" output)" = "Applying: 6" &&
test_cmp file-2-expect file-2 && test_cmp file-2-expect file-2 &&
test ! -f .git/rr-cache/MERGE_RR test ! -f .git/rr-cache/MERGE_RR
' '
test_expect_success "am --abort goes back after failed am$with3" ' test_expect_success "am --abort goes back after failed am$with3" '
git-am --abort && git am --abort &&
git rev-parse HEAD >actual && git rev-parse HEAD >actual &&
git rev-parse initial >expect && git rev-parse initial >expect &&
test_cmp expect actual && test_cmp expect actual &&

Просмотреть файл

@ -3,7 +3,7 @@
# Copyright (c) 2005 Junio C Hamano # Copyright (c) 2005 Junio C Hamano
# #
test_description='git-pack-object test_description='git pack-object
' '
. ./test-lib.sh . ./test-lib.sh
@ -242,24 +242,24 @@ test_expect_success \
test_expect_success \ test_expect_success \
'build pack index for an existing pack' \ 'build pack index for an existing pack' \
'cat test-1-${packname_1}.pack >test-3.pack && 'cat test-1-${packname_1}.pack >test-3.pack &&
git-index-pack -o tmp.idx test-3.pack && git index-pack -o tmp.idx test-3.pack &&
cmp tmp.idx test-1-${packname_1}.idx && cmp tmp.idx test-1-${packname_1}.idx &&
git-index-pack test-3.pack && git index-pack test-3.pack &&
cmp test-3.idx test-1-${packname_1}.idx && cmp test-3.idx test-1-${packname_1}.idx &&
cat test-2-${packname_2}.pack >test-3.pack && cat test-2-${packname_2}.pack >test-3.pack &&
git-index-pack -o tmp.idx test-2-${packname_2}.pack && git index-pack -o tmp.idx test-2-${packname_2}.pack &&
cmp tmp.idx test-2-${packname_2}.idx && cmp tmp.idx test-2-${packname_2}.idx &&
git-index-pack test-3.pack && git index-pack test-3.pack &&
cmp test-3.idx test-2-${packname_2}.idx && cmp test-3.idx test-2-${packname_2}.idx &&
cat test-3-${packname_3}.pack >test-3.pack && cat test-3-${packname_3}.pack >test-3.pack &&
git-index-pack -o tmp.idx test-3-${packname_3}.pack && git index-pack -o tmp.idx test-3-${packname_3}.pack &&
cmp tmp.idx test-3-${packname_3}.idx && cmp tmp.idx test-3-${packname_3}.idx &&
git-index-pack test-3.pack && git index-pack test-3.pack &&
cmp test-3.idx test-3-${packname_3}.idx && cmp test-3.idx test-3-${packname_3}.idx &&
:' :'
@ -272,7 +272,7 @@ test_expect_success \
test_expect_success \ test_expect_success \
'make sure index-pack detects the SHA1 collision' \ 'make sure index-pack detects the SHA1 collision' \
'test_must_fail git-index-pack -o bad.idx test-3.pack' 'test_must_fail git index-pack -o bad.idx test-3.pack'
test_expect_success \ test_expect_success \
'honor pack.packSizeLimit' \ 'honor pack.packSizeLimit' \

Просмотреть файл

@ -19,7 +19,7 @@ test_expect_success \
tree=`git write-tree` && tree=`git write-tree` &&
commit1=`git commit-tree $tree </dev/null` && commit1=`git commit-tree $tree </dev/null` &&
git update-ref HEAD $commit1 && git update-ref HEAD $commit1 &&
git-repack -a -d && git repack -a -d &&
test "`git count-objects`" = "0 objects, 0 kilobytes" && test "`git count-objects`" = "0 objects, 0 kilobytes" &&
pack1=`ls .git/objects/pack/*.pack` && pack1=`ls .git/objects/pack/*.pack` &&
test -f "$pack1"' test -f "$pack1"'
@ -45,7 +45,7 @@ test_expect_success \
git config core.packedGitLimit 512 && git config core.packedGitLimit 512 &&
commit2=`git commit-tree $tree -p $commit1 </dev/null` && commit2=`git commit-tree $tree -p $commit1 </dev/null` &&
git update-ref HEAD $commit2 && git update-ref HEAD $commit2 &&
git-repack -a -d && git repack -a -d &&
test "`git count-objects`" = "0 objects, 0 kilobytes" && test "`git count-objects`" = "0 objects, 0 kilobytes" &&
pack2=`ls .git/objects/pack/*.pack` && pack2=`ls .git/objects/pack/*.pack` &&
test -f "$pack2" test -f "$pack2"

Просмотреть файл

@ -48,11 +48,11 @@ test_expect_success \
test_expect_success \ test_expect_success \
'index-pack with index version 1' \ 'index-pack with index version 1' \
'git-index-pack --index-version=1 -o 1.idx "test-1-${pack1}.pack"' 'git index-pack --index-version=1 -o 1.idx "test-1-${pack1}.pack"'
test_expect_success \ test_expect_success \
'index-pack with index version 2' \ 'index-pack with index version 2' \
'git-index-pack --index-version=2 -o 2.idx "test-1-${pack1}.pack"' 'git index-pack --index-version=2 -o 2.idx "test-1-${pack1}.pack"'
test_expect_success \ test_expect_success \
'index-pack results should match pack-objects ones' \ 'index-pack results should match pack-objects ones' \
@ -85,7 +85,7 @@ test_expect_success \
test "$have_64bits" && test "$have_64bits" &&
test_expect_success \ test_expect_success \
'index v2: force some 64-bit offsets with index-pack' \ 'index v2: force some 64-bit offsets with index-pack' \
'git-index-pack --index-version=2,0x40000 -o 3.idx "test-1-${pack1}.pack"' 'git index-pack --index-version=2,0x40000 -o 3.idx "test-1-${pack1}.pack"'
test "$have_64bits" && test "$have_64bits" &&
test_expect_success \ test_expect_success \
@ -94,7 +94,7 @@ test_expect_success \
test_expect_success \ test_expect_success \
'[index v1] 1) stream pack to repository' \ '[index v1] 1) stream pack to repository' \
'git-index-pack --index-version=1 --stdin < "test-1-${pack1}.pack" && 'git index-pack --index-version=1 --stdin < "test-1-${pack1}.pack" &&
git prune-packed && git prune-packed &&
git count-objects | ( read nr rest && test "$nr" -eq 1 ) && git count-objects | ( read nr rest && test "$nr" -eq 1 ) &&
cmp "test-1-${pack1}.pack" ".git/objects/pack/pack-${pack1}.pack" && cmp "test-1-${pack1}.pack" ".git/objects/pack/pack-${pack1}.pack" &&
@ -132,7 +132,7 @@ test_expect_success \
test_expect_success \ test_expect_success \
'[index v2] 1) stream pack to repository' \ '[index v2] 1) stream pack to repository' \
'rm -f .git/objects/pack/* && 'rm -f .git/objects/pack/* &&
git-index-pack --index-version=2 --stdin < "test-1-${pack1}.pack" && git index-pack --index-version=2 --stdin < "test-1-${pack1}.pack" &&
git prune-packed && git prune-packed &&
git count-objects | ( read nr rest && test "$nr" -eq 1 ) && git count-objects | ( read nr rest && test "$nr" -eq 1 ) &&
cmp "test-1-${pack1}.pack" ".git/objects/pack/pack-${pack1}.pack" && cmp "test-1-${pack1}.pack" ".git/objects/pack/pack-${pack1}.pack" &&
@ -165,7 +165,7 @@ test_expect_success \
test_expect_success \ test_expect_success \
'[index v2] 6) verify-pack detects CRC mismatch' \ '[index v2] 6) verify-pack detects CRC mismatch' \
'rm -f .git/objects/pack/* && 'rm -f .git/objects/pack/* &&
git-index-pack --index-version=2 --stdin < "test-1-${pack1}.pack" && git index-pack --index-version=2 --stdin < "test-1-${pack1}.pack" &&
git verify-pack ".git/objects/pack/pack-${pack1}.pack" && git verify-pack ".git/objects/pack/pack-${pack1}.pack" &&
chmod +w ".git/objects/pack/pack-${pack1}.idx" && chmod +w ".git/objects/pack/pack-${pack1}.idx" &&
dd if=/dev/zero of=".git/objects/pack/pack-${pack1}.idx" conv=notrunc \ dd if=/dev/zero of=".git/objects/pack/pack-${pack1}.idx" conv=notrunc \

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description='git-pack-object --include-tag' test_description='git pack-object --include-tag'
. ./test-lib.sh . ./test-lib.sh
TRASH=`pwd` TRASH=`pwd`

Просмотреть файл

@ -31,7 +31,7 @@ test_expect_success setup '
parent=$commit || return 1 parent=$commit || return 1
done && done &&
git update-ref HEAD "$commit" && git update-ref HEAD "$commit" &&
git-clone ./. victim && git clone ./. victim &&
cd victim && cd victim &&
git log && git log &&
cd .. && cd .. &&
@ -68,7 +68,7 @@ test_expect_success 'pack the destination repository' '
test_expect_success \ test_expect_success \
'pushing rewound head should not barf but require --force' ' 'pushing rewound head should not barf but require --force' '
# should not fail but refuse to update. # should not fail but refuse to update.
if git-send-pack ./victim/.git/ master if git send-pack ./victim/.git/ master
then then
# now it should fail with Pasky patch # now it should fail with Pasky patch
echo >&2 Gaah, it should have failed. echo >&2 Gaah, it should have failed.
@ -85,7 +85,7 @@ test_expect_success \
true true
fi && fi &&
# this should update # this should update
git-send-pack --force ./victim/.git/ master && git send-pack --force ./victim/.git/ master &&
cmp victim/.git/refs/heads/master .git/refs/heads/master cmp victim/.git/refs/heads/master .git/refs/heads/master
' '
@ -95,7 +95,7 @@ test_expect_success \
git branch extra master && git branch extra master &&
cd .. && cd .. &&
test -f victim/.git/refs/heads/extra && test -f victim/.git/refs/heads/extra &&
git-send-pack ./victim/.git/ :extra master && git send-pack ./victim/.git/ :extra master &&
! test -f victim/.git/refs/heads/extra ! test -f victim/.git/refs/heads/extra
' '
@ -109,27 +109,27 @@ test_expect_success \
git config receive.denyNonFastforwards true && git config receive.denyNonFastforwards true &&
cd .. && cd .. &&
git update-ref refs/heads/master master^ || return 1 git update-ref refs/heads/master master^ || return 1
git-send-pack --force ./victim/.git/ master && return 1 git send-pack --force ./victim/.git/ master && return 1
! test_cmp .git/refs/heads/master victim/.git/refs/heads/master ! test_cmp .git/refs/heads/master victim/.git/refs/heads/master
' '
test_expect_success \ test_expect_success \
'pushing does not include non-head refs' ' 'pushing does not include non-head refs' '
mkdir parent && cd parent && mkdir parent && cd parent &&
git-init && touch file && git-add file && git-commit -m add && git init && touch file && git add file && git commit -m add &&
cd .. && cd .. &&
git-clone parent child && cd child && git-push --all && git clone parent child && cd child && git push --all &&
cd ../parent && cd ../parent &&
git-branch -a >branches && ! grep origin/master branches git branch -a >branches && ! grep origin/master branches
' '
rewound_push_setup() { rewound_push_setup() {
rm -rf parent child && rm -rf parent child &&
mkdir parent && cd parent && mkdir parent && cd parent &&
git-init && echo one >file && git-add file && git-commit -m one && git init && echo one >file && git add file && git commit -m one &&
echo two >file && git-commit -a -m two && echo two >file && git commit -a -m two &&
cd .. && cd .. &&
git-clone parent child && cd child && git-reset --hard HEAD^ git clone parent child && cd child && git reset --hard HEAD^
} }
rewound_push_succeeded() { rewound_push_succeeded() {
@ -148,26 +148,26 @@ rewound_push_failed() {
test_expect_success \ test_expect_success \
'pushing explicit refspecs respects forcing' ' 'pushing explicit refspecs respects forcing' '
rewound_push_setup && rewound_push_setup &&
if git-send-pack ../parent/.git refs/heads/master:refs/heads/master if git send-pack ../parent/.git refs/heads/master:refs/heads/master
then then
false false
else else
true true
fi && rewound_push_failed && fi && rewound_push_failed &&
git-send-pack ../parent/.git +refs/heads/master:refs/heads/master && git send-pack ../parent/.git +refs/heads/master:refs/heads/master &&
rewound_push_succeeded rewound_push_succeeded
' '
test_expect_success \ test_expect_success \
'pushing wildcard refspecs respects forcing' ' 'pushing wildcard refspecs respects forcing' '
rewound_push_setup && rewound_push_setup &&
if git-send-pack ../parent/.git refs/heads/*:refs/heads/* if git send-pack ../parent/.git refs/heads/*:refs/heads/*
then then
false false
else else
true true
fi && rewound_push_failed && fi && rewound_push_failed &&
git-send-pack ../parent/.git +refs/heads/*:refs/heads/* && git send-pack ../parent/.git +refs/heads/*:refs/heads/* &&
rewound_push_succeeded rewound_push_succeeded
' '

Просмотреть файл

@ -17,7 +17,7 @@ test_expect_success setup '
commit1=$(echo modify | git commit-tree $tree1 -p $commit0) && commit1=$(echo modify | git commit-tree $tree1 -p $commit0) &&
git update-ref refs/heads/master $commit0 && git update-ref refs/heads/master $commit0 &&
git update-ref refs/heads/tofail $commit1 && git update-ref refs/heads/tofail $commit1 &&
git-clone ./. victim && git clone ./. victim &&
GIT_DIR=victim/.git git update-ref refs/heads/tofail $commit1 && GIT_DIR=victim/.git git update-ref refs/heads/tofail $commit1 &&
git update-ref refs/heads/master $commit1 && git update-ref refs/heads/master $commit1 &&
git update-ref refs/heads/tofail $commit0 git update-ref refs/heads/tofail $commit0
@ -61,7 +61,7 @@ EOF
chmod u+x victim/.git/hooks/post-update chmod u+x victim/.git/hooks/post-update
test_expect_success push ' test_expect_success push '
test_must_fail git-send-pack --force ./victim/.git \ test_must_fail git send-pack --force ./victim/.git \
master tofail >send.out 2>send.err master tofail >send.out 2>send.err
' '

Просмотреть файл

@ -16,9 +16,9 @@ test_expect_success setup '
tree1=$(git write-tree) && tree1=$(git write-tree) &&
commit1=$(echo modify | git commit-tree $tree1 -p $commit0) && commit1=$(echo modify | git commit-tree $tree1 -p $commit0) &&
git update-ref refs/heads/master $commit0 && git update-ref refs/heads/master $commit0 &&
git-clone ./. clone1 && git clone ./. clone1 &&
GIT_DIR=clone1/.git git update-index --add a && GIT_DIR=clone1/.git git update-index --add a &&
git-clone ./. clone2 && git clone ./. clone2 &&
GIT_DIR=clone2/.git git update-index --add a GIT_DIR=clone2/.git git update-index --add a
' '

Просмотреть файл

@ -14,8 +14,8 @@ test_expect_success setup '
tree0=$(git write-tree) && tree0=$(git write-tree) &&
commit0=$(echo setup | git commit-tree $tree0) && commit0=$(echo setup | git commit-tree $tree0) &&
git update-ref refs/heads/master $commit0 && git update-ref refs/heads/master $commit0 &&
git-clone ./. clone1 && git clone ./. clone1 &&
git-clone ./. clone2 && git clone ./. clone2 &&
GIT_DIR=clone2/.git git branch -a new2 && GIT_DIR=clone2/.git git branch -a new2 &&
echo Data for commit1. >clone2/b && echo Data for commit1. >clone2/b &&
GIT_DIR=clone2/.git git add clone2/b && GIT_DIR=clone2/.git git add clone2/b &&

Просмотреть файл

@ -58,7 +58,7 @@ pull_to_client () {
cd client cd client
test_expect_success "$number pull" \ test_expect_success "$number pull" \
"git-fetch-pack -k -v .. $heads" "git fetch-pack -k -v .. $heads"
case "$heads" in *A*) echo $ATIP > .git/refs/heads/A;; esac case "$heads" in *A*) echo $ATIP > .git/refs/heads/A;; esac
case "$heads" in *B*) echo $BTIP > .git/refs/heads/B;; esac case "$heads" in *B*) echo $BTIP > .git/refs/heads/B;; esac
git symbolic-ref HEAD refs/heads/`echo $heads | sed -e 's/^\(.\).*$/\1/'` git symbolic-ref HEAD refs/heads/`echo $heads | sed -e 's/^\(.\).*$/\1/'`
@ -129,7 +129,7 @@ pull_to_client 2nd "B" $((64*3))
pull_to_client 3rd "A" $((1*3)) # old fails pull_to_client 3rd "A" $((1*3)) # old fails
test_expect_success "clone shallow" 'git-clone --depth 2 "file://$(pwd)/." shallow' test_expect_success "clone shallow" 'git clone --depth 2 "file://$(pwd)/." shallow'
(cd shallow; git count-objects -v) > count.shallow (cd shallow; git count-objects -v) > count.shallow

Просмотреть файл

@ -111,7 +111,7 @@ test_expect_success 'fetch must not resolve short tag name' '
test_expect_success 'fetch must not resolve short remote name' ' test_expect_success 'fetch must not resolve short remote name' '
cd "$D" && cd "$D" &&
git-update-ref refs/remotes/six/HEAD HEAD git update-ref refs/remotes/six/HEAD HEAD
mkdir six && mkdir six &&
cd six && cd six &&

Просмотреть файл

@ -34,7 +34,7 @@ test_expect_success 'upload-pack fails due to error in pack-objects' '
! echo "0032want $(git rev-parse HEAD) ! echo "0032want $(git rev-parse HEAD)
00000009done 00000009done
0000" | git-upload-pack . > /dev/null 2> output.err && 0000" | git upload-pack . > /dev/null 2> output.err &&
grep "pack-objects died" output.err grep "pack-objects died" output.err
' '
@ -52,7 +52,7 @@ test_expect_success 'upload-pack fails due to error in rev-list' '
! echo "0032want $(git rev-parse HEAD) ! echo "0032want $(git rev-parse HEAD)
00000009done 00000009done
0000" | git-upload-pack . > /dev/null 2> output.err && 0000" | git upload-pack . > /dev/null 2> output.err &&
grep "waitpid (async) failed" output.err grep "waitpid (async) failed" output.err
' '

Просмотреть файл

@ -3,9 +3,9 @@
# Copyright (C) 2006 Carl D. Worth <cworth@cworth.org> # Copyright (C) 2006 Carl D. Worth <cworth@cworth.org>
# #
test_description='test git-clone to cleanup after failure test_description='test git clone to cleanup after failure
This test covers the fact that if git-clone fails, it should remove This test covers the fact that if git clone fails, it should remove
the directory it created, to avoid the user having to manually the directory it created, to avoid the user having to manually
remove the directory before attempting a clone again.' remove the directory before attempting a clone again.'
@ -13,7 +13,7 @@ remove the directory before attempting a clone again.'
test_expect_success \ test_expect_success \
'clone of non-existent source should fail' \ 'clone of non-existent source should fail' \
'test_must_fail git-clone foo bar' 'test_must_fail git clone foo bar'
test_expect_success \ test_expect_success \
'failed clone should not leave a directory' \ 'failed clone should not leave a directory' \
@ -25,15 +25,15 @@ test_create_repo foo
# clone doesn't like it if there is no HEAD. Is that a bug? # clone doesn't like it if there is no HEAD. Is that a bug?
(cd foo && touch file && git add file && git commit -m 'add file' >/dev/null 2>&1) (cd foo && touch file && git add file && git commit -m 'add file' >/dev/null 2>&1)
# source repository given to git-clone should be relative to the # source repository given to git clone should be relative to the
# current path not to the target dir # current path not to the target dir
test_expect_success \ test_expect_success \
'clone of non-existent (relative to $PWD) source should fail' \ 'clone of non-existent (relative to $PWD) source should fail' \
'test_must_fail git-clone ../foo baz' 'test_must_fail git clone ../foo baz'
test_expect_success \ test_expect_success \
'clone should work now that source exists' \ 'clone should work now that source exists' \
'git-clone foo bar' 'git clone foo bar'
test_expect_success \ test_expect_success \
'successful clone must leave the directory' \ 'successful clone must leave the directory' \

Просмотреть файл

@ -11,13 +11,13 @@ test_expect_success setup '
chmod +x not_ssh chmod +x not_ssh
' '
test_expect_success 'clone calls git-upload-pack unqualified with no -u option' ' test_expect_success 'clone calls git upload-pack unqualified with no -u option' '
GIT_SSH=./not_ssh git clone localhost:/path/to/repo junk GIT_SSH=./not_ssh git clone localhost:/path/to/repo junk
echo "localhost git-upload-pack '\''/path/to/repo'\''" >expected echo "localhost git-upload-pack '\''/path/to/repo'\''" >expected
test_cmp expected not_ssh_output test_cmp expected not_ssh_output
' '
test_expect_success 'clone calls specified git-upload-pack with -u option' ' test_expect_success 'clone calls specified git upload-pack with -u option' '
GIT_SSH=./not_ssh git clone -u /something/bin/git-upload-pack localhost:/path/to/repo junk GIT_SSH=./not_ssh git clone -u /something/bin/git-upload-pack localhost:/path/to/repo junk
echo "localhost /something/bin/git-upload-pack '\''/path/to/repo'\''" >expected echo "localhost /something/bin/git-upload-pack '\''/path/to/repo'\''" >expected
test_cmp expected not_ssh_output test_cmp expected not_ssh_output

Просмотреть файл

@ -6,8 +6,8 @@ test_description='git rev-list --pretty=format test'
test_tick test_tick
test_expect_success 'setup' ' test_expect_success 'setup' '
touch foo && git add foo && git-commit -m "added foo" && touch foo && git add foo && git commit -m "added foo" &&
echo changed >foo && git-commit -a -m "changed foo" echo changed >foo && git commit -a -m "changed foo"
' '
# usage: test_format name format_string <expected_output # usage: test_format name format_string <expected_output
@ -110,7 +110,7 @@ include an iso8859 character: ¡bueno!
EOF EOF
test_expect_success 'setup complex body' ' test_expect_success 'setup complex body' '
git config i18n.commitencoding iso8859-1 && git config i18n.commitencoding iso8859-1 &&
echo change2 >foo && git-commit -a -F commit-msg echo change2 >foo && git commit -a -F commit-msg
' '
test_format complex-encoding %e <<'EOF' test_format complex-encoding %e <<'EOF'

Просмотреть файл

@ -5,7 +5,7 @@
test_description='merging symlinks on filesystem w/o symlink support. test_description='merging symlinks on filesystem w/o symlink support.
This tests that git-merge-recursive writes merge results as plain files This tests that git merge-recursive writes merge results as plain files
if core.symlinks is false.' if core.symlinks is false.'
. ./test-lib.sh . ./test-lib.sh
@ -15,25 +15,25 @@ test_expect_success \
git config core.symlinks false && git config core.symlinks false &&
> file && > file &&
git add file && git add file &&
git-commit -m initial && git commit -m initial &&
git branch b-symlink && git branch b-symlink &&
git branch b-file && git branch b-file &&
l=$(echo -n file | git-hash-object -t blob -w --stdin) && l=$(echo -n file | git hash-object -t blob -w --stdin) &&
echo "120000 $l symlink" | git update-index --index-info && echo "120000 $l symlink" | git update-index --index-info &&
git-commit -m master && git commit -m master &&
git-checkout b-symlink && git checkout b-symlink &&
l=$(echo -n file-different | git-hash-object -t blob -w --stdin) && l=$(echo -n file-different | git hash-object -t blob -w --stdin) &&
echo "120000 $l symlink" | git update-index --index-info && echo "120000 $l symlink" | git update-index --index-info &&
git-commit -m b-symlink && git commit -m b-symlink &&
git-checkout b-file && git checkout b-file &&
echo plain-file > symlink && echo plain-file > symlink &&
git add symlink && git add symlink &&
git-commit -m b-file' git commit -m b-file'
test_expect_success \ test_expect_success \
'merge master into b-symlink, which has a different symbolic link' ' 'merge master into b-symlink, which has a different symbolic link' '
git-checkout b-symlink && git checkout b-symlink &&
test_must_fail git-merge master' test_must_fail git merge master'
test_expect_success \ test_expect_success \
'the merge result must be a file' ' 'the merge result must be a file' '
@ -41,8 +41,8 @@ test -f symlink'
test_expect_success \ test_expect_success \
'merge master into b-file, which has a file instead of a symbolic link' ' 'merge master into b-file, which has a file instead of a symbolic link' '
git-reset --hard && git-checkout b-file && git reset --hard && git checkout b-file &&
test_must_fail git-merge master' test_must_fail git merge master'
test_expect_success \ test_expect_success \
'the merge result must be a file' ' 'the merge result must be a file' '
@ -50,9 +50,9 @@ test -f symlink'
test_expect_success \ test_expect_success \
'merge b-file, which has a file instead of a symbolic link, into master' ' 'merge b-file, which has a file instead of a symbolic link, into master' '
git-reset --hard && git reset --hard &&
git-checkout master && git checkout master &&
test_must_fail git-merge b-file' test_must_fail git merge b-file'
test_expect_success \ test_expect_success \
'the merge result must be a file' ' 'the merge result must be a file' '

Просмотреть файл

@ -106,9 +106,9 @@ test_expect_success 'custom merge backend' '
cmp binary union && cmp binary union &&
sed -e 1,3d text >check-1 && sed -e 1,3d text >check-1 &&
o=$(git-unpack-file master^:text) && o=$(git unpack-file master^:text) &&
a=$(git-unpack-file side^:text) && a=$(git unpack-file side^:text) &&
b=$(git-unpack-file master:text) && b=$(git unpack-file master:text) &&
sh -c "./custom-merge $o $a $b 0" && sh -c "./custom-merge $o $a $b 0" &&
sed -e 1,3d $a >check-2 && sed -e 1,3d $a >check-2 &&
cmp check-1 check-2 && cmp check-1 check-2 &&
@ -133,9 +133,9 @@ test_expect_success 'custom merge backend' '
cmp binary union && cmp binary union &&
sed -e 1,3d text >check-1 && sed -e 1,3d text >check-1 &&
o=$(git-unpack-file master^:text) && o=$(git unpack-file master^:text) &&
a=$(git-unpack-file anchor:text) && a=$(git unpack-file anchor:text) &&
b=$(git-unpack-file master:text) && b=$(git unpack-file master:text) &&
sh -c "./custom-merge $o $a $b 0" && sh -c "./custom-merge $o $a $b 0" &&
sed -e 1,3d $a >check-2 && sed -e 1,3d $a >check-2 &&
cmp check-1 check-2 && cmp check-1 check-2 &&

Просмотреть файл

@ -2,7 +2,7 @@
# #
# Copyright (c) 2007 Christian Couder # Copyright (c) 2007 Christian Couder
# #
test_description='Tests git-bisect functionality' test_description='Tests git bisect functionality'
exec </dev/null exec </dev/null
@ -23,7 +23,7 @@ add_line_into_file()
fi fi
test_tick test_tick
git-commit --quiet -m "$MSG" $_file git commit --quiet -m "$MSG" $_file
} }
HASH1= HASH1=

Просмотреть файл

@ -31,57 +31,57 @@ check_describe () {
test_expect_success setup ' test_expect_success setup '
test_tick && test_tick &&
echo one >file && git add file && git-commit -m initial && echo one >file && git add file && git commit -m initial &&
one=$(git rev-parse HEAD) && one=$(git rev-parse HEAD) &&
test_tick && test_tick &&
echo two >file && git add file && git-commit -m second && echo two >file && git add file && git commit -m second &&
two=$(git rev-parse HEAD) && two=$(git rev-parse HEAD) &&
test_tick && test_tick &&
echo three >file && git add file && git-commit -m third && echo three >file && git add file && git commit -m third &&
test_tick && test_tick &&
echo A >file && git add file && git-commit -m A && echo A >file && git add file && git commit -m A &&
test_tick && test_tick &&
git-tag -a -m A A && git tag -a -m A A &&
test_tick && test_tick &&
echo c >file && git add file && git-commit -m c && echo c >file && git add file && git commit -m c &&
test_tick && test_tick &&
git-tag c && git tag c &&
git reset --hard $two && git reset --hard $two &&
test_tick && test_tick &&
echo B >side && git add side && git-commit -m B && echo B >side && git add side && git commit -m B &&
test_tick && test_tick &&
git-tag -a -m B B && git tag -a -m B B &&
test_tick && test_tick &&
git-merge -m Merged c && git merge -m Merged c &&
merged=$(git rev-parse HEAD) && merged=$(git rev-parse HEAD) &&
git reset --hard $two && git reset --hard $two &&
test_tick && test_tick &&
echo D >another && git add another && git-commit -m D && echo D >another && git add another && git commit -m D &&
test_tick && test_tick &&
git-tag -a -m D D && git tag -a -m D D &&
test_tick && test_tick &&
echo DD >another && git commit -a -m another && echo DD >another && git commit -a -m another &&
test_tick && test_tick &&
git-tag e && git tag e &&
test_tick && test_tick &&
echo DDD >another && git commit -a -m "yet another" && echo DDD >another && git commit -a -m "yet another" &&
test_tick && test_tick &&
git-merge -m Merged $merged && git merge -m Merged $merged &&
test_tick && test_tick &&
echo X >file && echo X >side && git add file side && echo X >file && echo X >side && git add file side &&
git-commit -m x git commit -m x
' '

Просмотреть файл

@ -97,27 +97,27 @@ test_atom tag contents 'Tagging at 1151939927
' '
test_expect_success 'Check invalid atoms names are errors' ' test_expect_success 'Check invalid atoms names are errors' '
test_must_fail git-for-each-ref --format="%(INVALID)" refs/heads test_must_fail git for-each-ref --format="%(INVALID)" refs/heads
' '
test_expect_success 'Check format specifiers are ignored in naming date atoms' ' test_expect_success 'Check format specifiers are ignored in naming date atoms' '
git-for-each-ref --format="%(authordate)" refs/heads && git for-each-ref --format="%(authordate)" refs/heads &&
git-for-each-ref --format="%(authordate:default) %(authordate)" refs/heads && git for-each-ref --format="%(authordate:default) %(authordate)" refs/heads &&
git-for-each-ref --format="%(authordate) %(authordate:default)" refs/heads && git for-each-ref --format="%(authordate) %(authordate:default)" refs/heads &&
git-for-each-ref --format="%(authordate:default) %(authordate:default)" refs/heads git for-each-ref --format="%(authordate:default) %(authordate:default)" refs/heads
' '
test_expect_success 'Check valid format specifiers for date fields' ' test_expect_success 'Check valid format specifiers for date fields' '
git-for-each-ref --format="%(authordate:default)" refs/heads && git for-each-ref --format="%(authordate:default)" refs/heads &&
git-for-each-ref --format="%(authordate:relative)" refs/heads && git for-each-ref --format="%(authordate:relative)" refs/heads &&
git-for-each-ref --format="%(authordate:short)" refs/heads && git for-each-ref --format="%(authordate:short)" refs/heads &&
git-for-each-ref --format="%(authordate:local)" refs/heads && git for-each-ref --format="%(authordate:local)" refs/heads &&
git-for-each-ref --format="%(authordate:iso8601)" refs/heads && git for-each-ref --format="%(authordate:iso8601)" refs/heads &&
git-for-each-ref --format="%(authordate:rfc2822)" refs/heads git for-each-ref --format="%(authordate:rfc2822)" refs/heads
' '
test_expect_success 'Check invalid format specifiers are errors' ' test_expect_success 'Check invalid format specifiers are errors' '
test_must_fail git-for-each-ref --format="%(authordate:INVALID)" refs/heads test_must_fail git for-each-ref --format="%(authordate:INVALID)" refs/heads
' '
cat >expected <<\EOF cat >expected <<\EOF
@ -207,7 +207,7 @@ refs/tags/testtag
EOF EOF
test_expect_success 'Verify ascending sort' ' test_expect_success 'Verify ascending sort' '
git-for-each-ref --format="%(refname)" --sort=refname >actual && git for-each-ref --format="%(refname)" --sort=refname >actual &&
test_cmp expected actual test_cmp expected actual
' '
@ -218,7 +218,7 @@ refs/heads/master
EOF EOF
test_expect_success 'Verify descending sort' ' test_expect_success 'Verify descending sort' '
git-for-each-ref --format="%(refname)" --sort=-refname >actual && git for-each-ref --format="%(refname)" --sort=-refname >actual &&
test_cmp expected actual test_cmp expected actual
' '

Просмотреть файл

@ -8,7 +8,7 @@ test_expect_success \
'mkdir path0 path1 && 'mkdir path0 path1 &&
cp ../../COPYING path0/COPYING && cp ../../COPYING path0/COPYING &&
git add path0/COPYING && git add path0/COPYING &&
git-commit -m add -a' git commit -m add -a'
test_expect_success \ test_expect_success \
'moving the file out of subdirectory' \ 'moving the file out of subdirectory' \
@ -17,7 +17,7 @@ test_expect_success \
# in path0 currently # in path0 currently
test_expect_success \ test_expect_success \
'commiting the change' \ 'commiting the change' \
'cd .. && git-commit -m move-out -a' 'cd .. && git commit -m move-out -a'
test_expect_success \ test_expect_success \
'checking the commit' \ 'checking the commit' \
@ -31,7 +31,7 @@ test_expect_success \
# in path0 currently # in path0 currently
test_expect_success \ test_expect_success \
'commiting the change' \ 'commiting the change' \
'cd .. && git-commit -m move-in -a' 'cd .. && git commit -m move-in -a'
test_expect_success \ test_expect_success \
'checking the commit' \ 'checking the commit' \
@ -42,7 +42,7 @@ test_expect_success \
'adding another file' \ 'adding another file' \
'cp ../../README path0/README && 'cp ../../README path0/README &&
git add path0/README && git add path0/README &&
git-commit -m add2 -a' git commit -m add2 -a'
test_expect_success \ test_expect_success \
'moving whole subdirectory' \ 'moving whole subdirectory' \
@ -50,7 +50,7 @@ test_expect_success \
test_expect_success \ test_expect_success \
'commiting the change' \ 'commiting the change' \
'git-commit -m dir-move -a' 'git commit -m dir-move -a'
test_expect_success \ test_expect_success \
'checking the commit' \ 'checking the commit' \
@ -69,7 +69,7 @@ test_expect_success \
test_expect_success \ test_expect_success \
'commiting the change' \ 'commiting the change' \
'git-commit -m dir-move -a' 'git commit -m dir-move -a'
test_expect_success \ test_expect_success \
'checking the commit' \ 'checking the commit' \

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description='git-filter-branch' test_description='git filter-branch'
. ./test-lib.sh . ./test-lib.sh
make_commit () { make_commit () {
@ -32,14 +32,14 @@ test_expect_success 'setup' '
H=$(git rev-parse H) H=$(git rev-parse H)
test_expect_success 'rewrite identically' ' test_expect_success 'rewrite identically' '
git-filter-branch branch git filter-branch branch
' '
test_expect_success 'result is really identical' ' test_expect_success 'result is really identical' '
test $H = $(git rev-parse HEAD) test $H = $(git rev-parse HEAD)
' '
test_expect_success 'rewrite bare repository identically' ' test_expect_success 'rewrite bare repository identically' '
(git config core.bare true && cd .git && git-filter-branch branch) (git config core.bare true && cd .git && git filter-branch branch)
' '
git config core.bare false git config core.bare false
test_expect_success 'result is really identical' ' test_expect_success 'result is really identical' '
@ -47,7 +47,7 @@ test_expect_success 'result is really identical' '
' '
test_expect_success 'rewrite, renaming a specific file' ' test_expect_success 'rewrite, renaming a specific file' '
git-filter-branch -f --tree-filter "mv d doh || :" HEAD git filter-branch -f --tree-filter "mv d doh || :" HEAD
' '
test_expect_success 'test that the file was renamed' ' test_expect_success 'test that the file was renamed' '
@ -58,7 +58,7 @@ test_expect_success 'test that the file was renamed' '
' '
test_expect_success 'rewrite, renaming a specific directory' ' test_expect_success 'rewrite, renaming a specific directory' '
git-filter-branch -f --tree-filter "mv dir diroh || :" HEAD git filter-branch -f --tree-filter "mv dir diroh || :" HEAD
' '
test_expect_success 'test that the directory was renamed' ' test_expect_success 'test that the directory was renamed' '
@ -73,7 +73,7 @@ test_expect_success 'test that the directory was renamed' '
git tag oldD HEAD~4 git tag oldD HEAD~4
test_expect_success 'rewrite one branch, keeping a side branch' ' test_expect_success 'rewrite one branch, keeping a side branch' '
git branch modD oldD && git branch modD oldD &&
git-filter-branch -f --tree-filter "mv b boh || :" D..modD git filter-branch -f --tree-filter "mv b boh || :" D..modD
' '
test_expect_success 'common ancestor is still common (unchanged)' ' test_expect_success 'common ancestor is still common (unchanged)' '
@ -96,7 +96,7 @@ test_expect_success 'filter subdirectory only' '
test_tick && test_tick &&
git commit -m "again not subdir" && git commit -m "again not subdir" &&
git branch sub && git branch sub &&
git-filter-branch -f --subdirectory-filter subdir refs/heads/sub git filter-branch -f --subdirectory-filter subdir refs/heads/sub
' '
test_expect_success 'subdirectory filter result looks okay' ' test_expect_success 'subdirectory filter result looks okay' '
@ -120,7 +120,7 @@ test_expect_success 'more setup' '
test_expect_success 'use index-filter to move into a subdirectory' ' test_expect_success 'use index-filter to move into a subdirectory' '
git branch directorymoved && git branch directorymoved &&
git-filter-branch -f --index-filter \ git filter-branch -f --index-filter \
"git ls-files -s | sed \"s-\\t-&newsubdir/-\" | "git ls-files -s | sed \"s-\\t-&newsubdir/-\" |
GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \ GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \
git update-index --index-info && git update-index --index-info &&
@ -129,7 +129,7 @@ test_expect_success 'use index-filter to move into a subdirectory' '
test_expect_success 'stops when msg filter fails' ' test_expect_success 'stops when msg filter fails' '
old=$(git rev-parse HEAD) && old=$(git rev-parse HEAD) &&
test_must_fail git-filter-branch -f --msg-filter false HEAD && test_must_fail git filter-branch -f --msg-filter false HEAD &&
test $old = $(git rev-parse HEAD) && test $old = $(git rev-parse HEAD) &&
rm -rf .git-rewrite rm -rf .git-rewrite
' '
@ -140,7 +140,7 @@ test_expect_success 'author information is preserved' '
test_tick && test_tick &&
GIT_AUTHOR_NAME="B V Uips" git commit -m bvuips && GIT_AUTHOR_NAME="B V Uips" git commit -m bvuips &&
git branch preserved-author && git branch preserved-author &&
git-filter-branch -f --msg-filter "cat; \ git filter-branch -f --msg-filter "cat; \
test \$GIT_COMMIT != $(git rev-parse master) || \ test \$GIT_COMMIT != $(git rev-parse master) || \
echo Hallo" \ echo Hallo" \
preserved-author && preserved-author &&
@ -152,7 +152,7 @@ test_expect_success "remove a certain author's commits" '
test_tick && test_tick &&
git commit -m i i && git commit -m i i &&
git branch removed-author && git branch removed-author &&
git-filter-branch -f --commit-filter "\ git filter-branch -f --commit-filter "\
if [ \"\$GIT_AUTHOR_NAME\" = \"B V Uips\" ];\ if [ \"\$GIT_AUTHOR_NAME\" = \"B V Uips\" ];\
then\ then\
skip_commit \"\$@\"; skip_commit \"\$@\";

Просмотреть файл

@ -3,7 +3,7 @@
# Copyright (c) 2007 Carlos Rica # Copyright (c) 2007 Carlos Rica
# #
test_description='git-tag test_description='git tag
Tests for operations with tags.' Tests for operations with tags.'
@ -22,25 +22,25 @@ test_expect_success 'listing all tags in an empty tree should succeed' '
' '
test_expect_success 'listing all tags in an empty tree should output nothing' ' test_expect_success 'listing all tags in an empty tree should output nothing' '
test `git-tag -l | wc -l` -eq 0 && test `git tag -l | wc -l` -eq 0 &&
test `git-tag | wc -l` -eq 0 test `git tag | wc -l` -eq 0
' '
test_expect_success 'looking for a tag in an empty tree should fail' \ test_expect_success 'looking for a tag in an empty tree should fail' \
'! (tag_exists mytag)' '! (tag_exists mytag)'
test_expect_success 'creating a tag in an empty tree should fail' ' test_expect_success 'creating a tag in an empty tree should fail' '
test_must_fail git-tag mynotag && test_must_fail git tag mynotag &&
! tag_exists mynotag ! tag_exists mynotag
' '
test_expect_success 'creating a tag for HEAD in an empty tree should fail' ' test_expect_success 'creating a tag for HEAD in an empty tree should fail' '
test_must_fail git-tag mytaghead HEAD && test_must_fail git tag mytaghead HEAD &&
! tag_exists mytaghead ! tag_exists mytaghead
' '
test_expect_success 'creating a tag for an unknown revision should fail' ' test_expect_success 'creating a tag for an unknown revision should fail' '
test_must_fail git-tag mytagnorev aaaaaaaaaaa && test_must_fail git tag mytagnorev aaaaaaaaaaa &&
! tag_exists mytagnorev ! tag_exists mytagnorev
' '
@ -54,32 +54,32 @@ test_expect_success 'creating a tag using default HEAD should succeed' '
' '
test_expect_success 'listing all tags if one exists should succeed' ' test_expect_success 'listing all tags if one exists should succeed' '
git-tag -l && git tag -l &&
git-tag git tag
' '
test_expect_success 'listing all tags if one exists should output that tag' ' test_expect_success 'listing all tags if one exists should output that tag' '
test `git-tag -l` = mytag && test `git tag -l` = mytag &&
test `git-tag` = mytag test `git tag` = mytag
' '
# pattern matching: # pattern matching:
test_expect_success 'listing a tag using a matching pattern should succeed' \ test_expect_success 'listing a tag using a matching pattern should succeed' \
'git-tag -l mytag' 'git tag -l mytag'
test_expect_success \ test_expect_success \
'listing a tag using a matching pattern should output that tag' \ 'listing a tag using a matching pattern should output that tag' \
'test `git-tag -l mytag` = mytag' 'test `git tag -l mytag` = mytag'
# todo: git tag -l now returns always zero, when fixed, change this test # todo: git tag -l now returns always zero, when fixed, change this test
test_expect_success \ test_expect_success \
'listing tags using a non-matching pattern should suceed' \ 'listing tags using a non-matching pattern should suceed' \
'git-tag -l xxx' 'git tag -l xxx'
test_expect_success \ test_expect_success \
'listing tags using a non-matching pattern should output nothing' \ 'listing tags using a non-matching pattern should output nothing' \
'test `git-tag -l xxx | wc -l` -eq 0' 'test `git tag -l xxx | wc -l` -eq 0'
# special cases for creating tags: # special cases for creating tags:
@ -89,13 +89,13 @@ test_expect_success \
test_expect_success \ test_expect_success \
'trying to create a tag with a non-valid name should fail' ' 'trying to create a tag with a non-valid name should fail' '
test `git-tag -l | wc -l` -eq 1 && test `git tag -l | wc -l` -eq 1 &&
test_must_fail git tag "" && test_must_fail git tag "" &&
test_must_fail git tag .othertag && test_must_fail git tag .othertag &&
test_must_fail git tag "other tag" && test_must_fail git tag "other tag" &&
test_must_fail git tag "othertag^" && test_must_fail git tag "othertag^" &&
test_must_fail git tag "other~tag" && test_must_fail git tag "other~tag" &&
test `git-tag -l | wc -l` -eq 1 test `git tag -l | wc -l` -eq 1
' '
test_expect_success 'creating a tag using HEAD directly should succeed' ' test_expect_success 'creating a tag using HEAD directly should succeed' '
@ -107,7 +107,7 @@ test_expect_success 'creating a tag using HEAD directly should succeed' '
test_expect_success 'trying to delete an unknown tag should fail' ' test_expect_success 'trying to delete an unknown tag should fail' '
! tag_exists unknown-tag && ! tag_exists unknown-tag &&
test_must_fail git-tag -d unknown-tag test_must_fail git tag -d unknown-tag
' '
cat >expect <<EOF cat >expect <<EOF
@ -117,7 +117,7 @@ EOF
test_expect_success \ test_expect_success \
'trying to delete tags without params should succeed and do nothing' ' 'trying to delete tags without params should succeed and do nothing' '
git tag -l > actual && test_cmp expect actual && git tag -l > actual && test_cmp expect actual &&
git-tag -d && git tag -d &&
git tag -l > actual && test_cmp expect actual git tag -l > actual && test_cmp expect actual
' '
@ -125,7 +125,7 @@ test_expect_success \
'deleting two existing tags in one command should succeed' ' 'deleting two existing tags in one command should succeed' '
tag_exists mytag && tag_exists mytag &&
tag_exists myhead && tag_exists myhead &&
git-tag -d mytag myhead && git tag -d mytag myhead &&
! tag_exists mytag && ! tag_exists mytag &&
! tag_exists myhead ! tag_exists myhead
' '
@ -133,7 +133,7 @@ test_expect_success \
test_expect_success \ test_expect_success \
'creating a tag with the name of another deleted one should succeed' ' 'creating a tag with the name of another deleted one should succeed' '
! tag_exists mytag && ! tag_exists mytag &&
git-tag mytag && git tag mytag &&
tag_exists mytag tag_exists mytag
' '
@ -141,13 +141,13 @@ test_expect_success \
'trying to delete two tags, existing and not, should fail in the 2nd' ' 'trying to delete two tags, existing and not, should fail in the 2nd' '
tag_exists mytag && tag_exists mytag &&
! tag_exists myhead && ! tag_exists myhead &&
test_must_fail git-tag -d mytag anothertag && test_must_fail git tag -d mytag anothertag &&
! tag_exists mytag && ! tag_exists mytag &&
! tag_exists myhead ! tag_exists myhead
' '
test_expect_success 'trying to delete an already deleted tag should fail' \ test_expect_success 'trying to delete an already deleted tag should fail' \
'test_must_fail git-tag -d mytag' 'test_must_fail git tag -d mytag'
# listing various tags with pattern matching: # listing various tags with pattern matching:
@ -185,7 +185,7 @@ cba
EOF EOF
test_expect_success \ test_expect_success \
'listing tags with substring as pattern must print those matching' ' 'listing tags with substring as pattern must print those matching' '
git-tag -l "*a*" > actual && git tag -l "*a*" > actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -195,7 +195,7 @@ v1.0.1
EOF EOF
test_expect_success \ test_expect_success \
'listing tags with a suffix as pattern must print those matching' ' 'listing tags with a suffix as pattern must print those matching' '
git-tag -l "*.1" > actual && git tag -l "*.1" > actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -205,7 +205,7 @@ t211
EOF EOF
test_expect_success \ test_expect_success \
'listing tags with a prefix as pattern must print those matching' ' 'listing tags with a prefix as pattern must print those matching' '
git-tag -l "t21*" > actual && git tag -l "t21*" > actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -214,7 +214,7 @@ a1
EOF EOF
test_expect_success \ test_expect_success \
'listing tags using a name as pattern must print that one matching' ' 'listing tags using a name as pattern must print that one matching' '
git-tag -l a1 > actual && git tag -l a1 > actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -223,7 +223,7 @@ v1.0
EOF EOF
test_expect_success \ test_expect_success \
'listing tags using a name as pattern must print that one matching' ' 'listing tags using a name as pattern must print that one matching' '
git-tag -l v1.0 > actual && git tag -l v1.0 > actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -233,14 +233,14 @@ v1.1.3
EOF EOF
test_expect_success \ test_expect_success \
'listing tags with ? in the pattern should print those matching' ' 'listing tags with ? in the pattern should print those matching' '
git-tag -l "v1.?.?" > actual && git tag -l "v1.?.?" > actual &&
test_cmp expect actual test_cmp expect actual
' '
>expect >expect
test_expect_success \ test_expect_success \
'listing tags using v.* should print nothing because none have v.' ' 'listing tags using v.* should print nothing because none have v.' '
git-tag -l "v.*" > actual && git tag -l "v.*" > actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -252,7 +252,7 @@ v1.1.3
EOF EOF
test_expect_success \ test_expect_success \
'listing tags using v* should print only those having v' ' 'listing tags using v* should print only those having v' '
git-tag -l "v*" > actual && git tag -l "v*" > actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -260,21 +260,21 @@ test_expect_success \
test_expect_success \ test_expect_success \
'a non-annotated tag created without parameters should point to HEAD' ' 'a non-annotated tag created without parameters should point to HEAD' '
git-tag non-annotated-tag && git tag non-annotated-tag &&
test $(git cat-file -t non-annotated-tag) = commit && test $(git cat-file -t non-annotated-tag) = commit &&
test $(git rev-parse non-annotated-tag) = $(git rev-parse HEAD) test $(git rev-parse non-annotated-tag) = $(git rev-parse HEAD)
' '
test_expect_success 'trying to verify an unknown tag should fail' \ test_expect_success 'trying to verify an unknown tag should fail' \
'test_must_fail git-tag -v unknown-tag' 'test_must_fail git tag -v unknown-tag'
test_expect_success \ test_expect_success \
'trying to verify a non-annotated and non-signed tag should fail' \ 'trying to verify a non-annotated and non-signed tag should fail' \
'test_must_fail git-tag -v non-annotated-tag' 'test_must_fail git tag -v non-annotated-tag'
test_expect_success \ test_expect_success \
'trying to verify many non-annotated or unknown tags, should fail' \ 'trying to verify many non-annotated or unknown tags, should fail' \
'test_must_fail git-tag -v unknown-tag1 non-annotated-tag unknown-tag2' 'test_must_fail git tag -v unknown-tag1 non-annotated-tag unknown-tag2'
# creating annotated tags: # creating annotated tags:
@ -300,7 +300,7 @@ get_tag_header annotated-tag $commit commit $time >expect
echo "A message" >>expect echo "A message" >>expect
test_expect_success \ test_expect_success \
'creating an annotated tag with -m message should succeed' ' 'creating an annotated tag with -m message should succeed' '
git-tag -m "A message" annotated-tag && git tag -m "A message" annotated-tag &&
get_tag_msg annotated-tag >actual && get_tag_msg annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -313,7 +313,7 @@ get_tag_header file-annotated-tag $commit commit $time >expect
cat msgfile >>expect cat msgfile >>expect
test_expect_success \ test_expect_success \
'creating an annotated tag with -F messagefile should succeed' ' 'creating an annotated tag with -F messagefile should succeed' '
git-tag -F msgfile file-annotated-tag && git tag -F msgfile file-annotated-tag &&
get_tag_msg file-annotated-tag >actual && get_tag_msg file-annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -325,7 +325,7 @@ EOF
get_tag_header stdin-annotated-tag $commit commit $time >expect get_tag_header stdin-annotated-tag $commit commit $time >expect
cat inputmsg >>expect cat inputmsg >>expect
test_expect_success 'creating an annotated tag with -F - should succeed' ' test_expect_success 'creating an annotated tag with -F - should succeed' '
git-tag -F - stdin-annotated-tag <inputmsg && git tag -F - stdin-annotated-tag <inputmsg &&
get_tag_msg stdin-annotated-tag >actual && get_tag_msg stdin-annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -334,7 +334,7 @@ test_expect_success \
'trying to create a tag with a non-existing -F file should fail' ' 'trying to create a tag with a non-existing -F file should fail' '
! test -f nonexistingfile && ! test -f nonexistingfile &&
! tag_exists notag && ! tag_exists notag &&
test_must_fail git-tag -F nonexistingfile notag && test_must_fail git tag -F nonexistingfile notag &&
! tag_exists notag ! tag_exists notag
' '
@ -343,11 +343,11 @@ test_expect_success \
echo "message file 1" >msgfile1 && echo "message file 1" >msgfile1 &&
echo "message file 2" >msgfile2 && echo "message file 2" >msgfile2 &&
! tag_exists msgtag && ! tag_exists msgtag &&
test_must_fail git-tag -m "message 1" -F msgfile1 msgtag && test_must_fail git tag -m "message 1" -F msgfile1 msgtag &&
! tag_exists msgtag && ! tag_exists msgtag &&
test_must_fail git-tag -F msgfile1 -m "message 1" msgtag && test_must_fail git tag -F msgfile1 -m "message 1" msgtag &&
! tag_exists msgtag && ! tag_exists msgtag &&
test_must_fail git-tag -m "message 1" -F msgfile1 \ test_must_fail git tag -m "message 1" -F msgfile1 \
-m "message 2" msgtag && -m "message 2" msgtag &&
! tag_exists msgtag ! tag_exists msgtag
' '
@ -357,7 +357,7 @@ test_expect_success \
get_tag_header empty-annotated-tag $commit commit $time >expect get_tag_header empty-annotated-tag $commit commit $time >expect
test_expect_success \ test_expect_success \
'creating a tag with an empty -m message should succeed' ' 'creating a tag with an empty -m message should succeed' '
git-tag -m "" empty-annotated-tag && git tag -m "" empty-annotated-tag &&
get_tag_msg empty-annotated-tag >actual && get_tag_msg empty-annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -366,7 +366,7 @@ test_expect_success \
get_tag_header emptyfile-annotated-tag $commit commit $time >expect get_tag_header emptyfile-annotated-tag $commit commit $time >expect
test_expect_success \ test_expect_success \
'creating a tag with an empty -F messagefile should succeed' ' 'creating a tag with an empty -F messagefile should succeed' '
git-tag -F emptyfile emptyfile-annotated-tag && git tag -F emptyfile emptyfile-annotated-tag &&
get_tag_msg emptyfile-annotated-tag >actual && get_tag_msg emptyfile-annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -387,7 +387,7 @@ Trailing blank lines
EOF EOF
test_expect_success \ test_expect_success \
'extra blanks in the message for an annotated tag should be removed' ' 'extra blanks in the message for an annotated tag should be removed' '
git-tag -F blanksfile blanks-annotated-tag && git tag -F blanksfile blanks-annotated-tag &&
get_tag_msg blanks-annotated-tag >actual && get_tag_msg blanks-annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -395,7 +395,7 @@ test_expect_success \
get_tag_header blank-annotated-tag $commit commit $time >expect get_tag_header blank-annotated-tag $commit commit $time >expect
test_expect_success \ test_expect_success \
'creating a tag with blank -m message with spaces should succeed' ' 'creating a tag with blank -m message with spaces should succeed' '
git-tag -m " " blank-annotated-tag && git tag -m " " blank-annotated-tag &&
get_tag_msg blank-annotated-tag >actual && get_tag_msg blank-annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -406,7 +406,7 @@ echo ' ' >>blankfile
get_tag_header blankfile-annotated-tag $commit commit $time >expect get_tag_header blankfile-annotated-tag $commit commit $time >expect
test_expect_success \ test_expect_success \
'creating a tag with blank -F messagefile with spaces should succeed' ' 'creating a tag with blank -F messagefile with spaces should succeed' '
git-tag -F blankfile blankfile-annotated-tag && git tag -F blankfile blankfile-annotated-tag &&
get_tag_msg blankfile-annotated-tag >actual && get_tag_msg blankfile-annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -415,7 +415,7 @@ printf ' ' >blanknonlfile
get_tag_header blanknonlfile-annotated-tag $commit commit $time >expect get_tag_header blanknonlfile-annotated-tag $commit commit $time >expect
test_expect_success \ test_expect_success \
'creating a tag with -F file of spaces and no newline should succeed' ' 'creating a tag with -F file of spaces and no newline should succeed' '
git-tag -F blanknonlfile blanknonlfile-annotated-tag && git tag -F blanknonlfile blanknonlfile-annotated-tag &&
get_tag_msg blanknonlfile-annotated-tag >actual && get_tag_msg blanknonlfile-annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -450,7 +450,7 @@ Last line.
EOF EOF
test_expect_success \ test_expect_success \
'creating a tag using a -F messagefile with #comments should succeed' ' 'creating a tag using a -F messagefile with #comments should succeed' '
git-tag -F commentsfile comments-annotated-tag && git tag -F commentsfile comments-annotated-tag &&
get_tag_msg comments-annotated-tag >actual && get_tag_msg comments-annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -458,7 +458,7 @@ test_expect_success \
get_tag_header comment-annotated-tag $commit commit $time >expect get_tag_header comment-annotated-tag $commit commit $time >expect
test_expect_success \ test_expect_success \
'creating a tag with a #comment in the -m message should succeed' ' 'creating a tag with a #comment in the -m message should succeed' '
git-tag -m "#comment" comment-annotated-tag && git tag -m "#comment" comment-annotated-tag &&
get_tag_msg comment-annotated-tag >actual && get_tag_msg comment-annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -469,7 +469,7 @@ echo '####' >>commentfile
get_tag_header commentfile-annotated-tag $commit commit $time >expect get_tag_header commentfile-annotated-tag $commit commit $time >expect
test_expect_success \ test_expect_success \
'creating a tag with #comments in the -F messagefile should succeed' ' 'creating a tag with #comments in the -F messagefile should succeed' '
git-tag -F commentfile commentfile-annotated-tag && git tag -F commentfile commentfile-annotated-tag &&
get_tag_msg commentfile-annotated-tag >actual && get_tag_msg commentfile-annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -478,7 +478,7 @@ printf '#comment' >commentnonlfile
get_tag_header commentnonlfile-annotated-tag $commit commit $time >expect get_tag_header commentnonlfile-annotated-tag $commit commit $time >expect
test_expect_success \ test_expect_success \
'creating a tag with a file of #comment and no newline should succeed' ' 'creating a tag with a file of #comment and no newline should succeed' '
git-tag -F commentnonlfile commentnonlfile-annotated-tag && git tag -F commentnonlfile commentnonlfile-annotated-tag &&
get_tag_msg commentnonlfile-annotated-tag >actual && get_tag_msg commentnonlfile-annotated-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -487,51 +487,51 @@ test_expect_success \
test_expect_success \ test_expect_success \
'listing the one-line message of a non-signed tag should succeed' ' 'listing the one-line message of a non-signed tag should succeed' '
git-tag -m "A msg" tag-one-line && git tag -m "A msg" tag-one-line &&
echo "tag-one-line" >expect && echo "tag-one-line" >expect &&
git-tag -l | grep "^tag-one-line" >actual && git tag -l | grep "^tag-one-line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n0 -l | grep "^tag-one-line" >actual && git tag -n0 -l | grep "^tag-one-line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n0 -l tag-one-line >actual && git tag -n0 -l tag-one-line >actual &&
test_cmp expect actual && test_cmp expect actual &&
echo "tag-one-line A msg" >expect && echo "tag-one-line A msg" >expect &&
git-tag -n1 -l | grep "^tag-one-line" >actual && git tag -n1 -l | grep "^tag-one-line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n -l | grep "^tag-one-line" >actual && git tag -n -l | grep "^tag-one-line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n1 -l tag-one-line >actual && git tag -n1 -l tag-one-line >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n2 -l tag-one-line >actual && git tag -n2 -l tag-one-line >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n999 -l tag-one-line >actual && git tag -n999 -l tag-one-line >actual &&
test_cmp expect actual test_cmp expect actual
' '
test_expect_success \ test_expect_success \
'listing the zero-lines message of a non-signed tag should succeed' ' 'listing the zero-lines message of a non-signed tag should succeed' '
git-tag -m "" tag-zero-lines && git tag -m "" tag-zero-lines &&
echo "tag-zero-lines" >expect && echo "tag-zero-lines" >expect &&
git-tag -l | grep "^tag-zero-lines" >actual && git tag -l | grep "^tag-zero-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n0 -l | grep "^tag-zero-lines" >actual && git tag -n0 -l | grep "^tag-zero-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n0 -l tag-zero-lines >actual && git tag -n0 -l tag-zero-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
echo "tag-zero-lines " >expect && echo "tag-zero-lines " >expect &&
git-tag -n1 -l | grep "^tag-zero-lines" >actual && git tag -n1 -l | grep "^tag-zero-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n -l | grep "^tag-zero-lines" >actual && git tag -n -l | grep "^tag-zero-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n1 -l tag-zero-lines >actual && git tag -n1 -l tag-zero-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n2 -l tag-zero-lines >actual && git tag -n2 -l tag-zero-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n999 -l tag-zero-lines >actual && git tag -n999 -l tag-zero-lines >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -540,42 +540,42 @@ echo 'tag line two' >>annotagmsg
echo 'tag line three' >>annotagmsg echo 'tag line three' >>annotagmsg
test_expect_success \ test_expect_success \
'listing many message lines of a non-signed tag should succeed' ' 'listing many message lines of a non-signed tag should succeed' '
git-tag -F annotagmsg tag-lines && git tag -F annotagmsg tag-lines &&
echo "tag-lines" >expect && echo "tag-lines" >expect &&
git-tag -l | grep "^tag-lines" >actual && git tag -l | grep "^tag-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n0 -l | grep "^tag-lines" >actual && git tag -n0 -l | grep "^tag-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n0 -l tag-lines >actual && git tag -n0 -l tag-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
echo "tag-lines tag line one" >expect && echo "tag-lines tag line one" >expect &&
git-tag -n1 -l | grep "^tag-lines" >actual && git tag -n1 -l | grep "^tag-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n -l | grep "^tag-lines" >actual && git tag -n -l | grep "^tag-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n1 -l tag-lines >actual && git tag -n1 -l tag-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
echo " tag line two" >>expect && echo " tag line two" >>expect &&
git-tag -n2 -l | grep "^ *tag.line" >actual && git tag -n2 -l | grep "^ *tag.line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n2 -l tag-lines >actual && git tag -n2 -l tag-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
echo " tag line three" >>expect && echo " tag line three" >>expect &&
git-tag -n3 -l | grep "^ *tag.line" >actual && git tag -n3 -l | grep "^ *tag.line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n3 -l tag-lines >actual && git tag -n3 -l tag-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n4 -l | grep "^ *tag.line" >actual && git tag -n4 -l | grep "^ *tag.line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n4 -l tag-lines >actual && git tag -n4 -l tag-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n99 -l | grep "^ *tag.line" >actual && git tag -n99 -l | grep "^ *tag.line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n99 -l tag-lines >actual && git tag -n99 -l tag-lines >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -592,19 +592,19 @@ fi
test_expect_success \ test_expect_success \
'trying to verify an annotated non-signed tag should fail' ' 'trying to verify an annotated non-signed tag should fail' '
tag_exists annotated-tag && tag_exists annotated-tag &&
test_must_fail git-tag -v annotated-tag test_must_fail git tag -v annotated-tag
' '
test_expect_success \ test_expect_success \
'trying to verify a file-annotated non-signed tag should fail' ' 'trying to verify a file-annotated non-signed tag should fail' '
tag_exists file-annotated-tag && tag_exists file-annotated-tag &&
test_must_fail git-tag -v file-annotated-tag test_must_fail git tag -v file-annotated-tag
' '
test_expect_success \ test_expect_success \
'trying to verify two annotated non-signed tags should fail' ' 'trying to verify two annotated non-signed tags should fail' '
tag_exists annotated-tag file-annotated-tag && tag_exists annotated-tag file-annotated-tag &&
test_must_fail git-tag -v annotated-tag file-annotated-tag test_must_fail git tag -v annotated-tag file-annotated-tag
' '
# creating and verifying signed tags: # creating and verifying signed tags:
@ -634,7 +634,7 @@ get_tag_header signed-tag $commit commit $time >expect
echo 'A signed tag message' >>expect echo 'A signed tag message' >>expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success 'creating a signed tag with -m message should succeed' ' test_expect_success 'creating a signed tag with -m message should succeed' '
git-tag -s -m "A signed tag message" signed-tag && git tag -s -m "A signed tag message" signed-tag &&
get_tag_msg signed-tag >actual && get_tag_msg signed-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -675,7 +675,7 @@ get_tag_header implied-sign $commit commit $time >expect
./fakeeditor >>expect ./fakeeditor >>expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success '-u implies signed tag' ' test_expect_success '-u implies signed tag' '
GIT_EDITOR=./fakeeditor git-tag -u CDDE430D implied-sign && GIT_EDITOR=./fakeeditor git tag -u CDDE430D implied-sign &&
get_tag_msg implied-sign >actual && get_tag_msg implied-sign >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -689,7 +689,7 @@ cat sigmsgfile >>expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag with -F messagefile should succeed' ' 'creating a signed tag with -F messagefile should succeed' '
git-tag -s -F sigmsgfile file-signed-tag && git tag -s -F sigmsgfile file-signed-tag &&
get_tag_msg file-signed-tag >actual && get_tag_msg file-signed-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -702,7 +702,7 @@ get_tag_header stdin-signed-tag $commit commit $time >expect
cat siginputmsg >>expect cat siginputmsg >>expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success 'creating a signed tag with -F - should succeed' ' test_expect_success 'creating a signed tag with -F - should succeed' '
git-tag -s -F - stdin-signed-tag <siginputmsg && git tag -s -F - stdin-signed-tag <siginputmsg &&
get_tag_msg stdin-signed-tag >actual && get_tag_msg stdin-signed-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -711,7 +711,7 @@ get_tag_header implied-annotate $commit commit $time >expect
./fakeeditor >>expect ./fakeeditor >>expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success '-s implies annotated tag' ' test_expect_success '-s implies annotated tag' '
GIT_EDITOR=./fakeeditor git-tag -s implied-annotate && GIT_EDITOR=./fakeeditor git tag -s implied-annotate &&
get_tag_msg implied-annotate >actual && get_tag_msg implied-annotate >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -720,23 +720,23 @@ test_expect_success \
'trying to create a signed tag with non-existing -F file should fail' ' 'trying to create a signed tag with non-existing -F file should fail' '
! test -f nonexistingfile && ! test -f nonexistingfile &&
! tag_exists nosigtag && ! tag_exists nosigtag &&
test_must_fail git-tag -s -F nonexistingfile nosigtag && test_must_fail git tag -s -F nonexistingfile nosigtag &&
! tag_exists nosigtag ! tag_exists nosigtag
' '
test_expect_success 'verifying a signed tag should succeed' \ test_expect_success 'verifying a signed tag should succeed' \
'git-tag -v signed-tag' 'git tag -v signed-tag'
test_expect_success 'verifying two signed tags in one command should succeed' \ test_expect_success 'verifying two signed tags in one command should succeed' \
'git-tag -v signed-tag file-signed-tag' 'git tag -v signed-tag file-signed-tag'
test_expect_success \ test_expect_success \
'verifying many signed and non-signed tags should fail' ' 'verifying many signed and non-signed tags should fail' '
test_must_fail git-tag -v signed-tag annotated-tag && test_must_fail git tag -v signed-tag annotated-tag &&
test_must_fail git-tag -v file-annotated-tag file-signed-tag && test_must_fail git tag -v file-annotated-tag file-signed-tag &&
test_must_fail git-tag -v annotated-tag \ test_must_fail git tag -v annotated-tag \
file-signed-tag file-annotated-tag && file-signed-tag file-annotated-tag &&
test_must_fail git-tag -v signed-tag annotated-tag file-signed-tag test_must_fail git tag -v signed-tag annotated-tag file-signed-tag
' '
test_expect_success 'verifying a forged tag should fail' ' test_expect_success 'verifying a forged tag should fail' '
@ -744,7 +744,7 @@ test_expect_success 'verifying a forged tag should fail' '
sed -e "s/signed-tag/forged-tag/" | sed -e "s/signed-tag/forged-tag/" |
git mktag) && git mktag) &&
git tag forged-tag $forged && git tag forged-tag $forged &&
test_must_fail git-tag -v forged-tag test_must_fail git tag -v forged-tag
' '
# blank and empty messages for signed tags: # blank and empty messages for signed tags:
@ -753,10 +753,10 @@ get_tag_header empty-signed-tag $commit commit $time >expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag with an empty -m message should succeed' ' 'creating a signed tag with an empty -m message should succeed' '
git-tag -s -m "" empty-signed-tag && git tag -s -m "" empty-signed-tag &&
get_tag_msg empty-signed-tag >actual && get_tag_msg empty-signed-tag >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -v empty-signed-tag git tag -v empty-signed-tag
' '
>sigemptyfile >sigemptyfile
@ -764,10 +764,10 @@ get_tag_header emptyfile-signed-tag $commit commit $time >expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag with an empty -F messagefile should succeed' ' 'creating a signed tag with an empty -F messagefile should succeed' '
git-tag -s -F sigemptyfile emptyfile-signed-tag && git tag -s -F sigemptyfile emptyfile-signed-tag &&
get_tag_msg emptyfile-signed-tag >actual && get_tag_msg emptyfile-signed-tag >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -v emptyfile-signed-tag git tag -v emptyfile-signed-tag
' '
printf '\n\n \n\t\nLeading blank lines\n' > sigblanksfile printf '\n\n \n\t\nLeading blank lines\n' > sigblanksfile
@ -787,20 +787,20 @@ EOF
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'extra blanks in the message for a signed tag should be removed' ' 'extra blanks in the message for a signed tag should be removed' '
git-tag -s -F sigblanksfile blanks-signed-tag && git tag -s -F sigblanksfile blanks-signed-tag &&
get_tag_msg blanks-signed-tag >actual && get_tag_msg blanks-signed-tag >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -v blanks-signed-tag git tag -v blanks-signed-tag
' '
get_tag_header blank-signed-tag $commit commit $time >expect get_tag_header blank-signed-tag $commit commit $time >expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag with a blank -m message should succeed' ' 'creating a signed tag with a blank -m message should succeed' '
git-tag -s -m " " blank-signed-tag && git tag -s -m " " blank-signed-tag &&
get_tag_msg blank-signed-tag >actual && get_tag_msg blank-signed-tag >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -v blank-signed-tag git tag -v blank-signed-tag
' '
echo ' ' >sigblankfile echo ' ' >sigblankfile
@ -810,10 +810,10 @@ get_tag_header blankfile-signed-tag $commit commit $time >expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag with blank -F file with spaces should succeed' ' 'creating a signed tag with blank -F file with spaces should succeed' '
git-tag -s -F sigblankfile blankfile-signed-tag && git tag -s -F sigblankfile blankfile-signed-tag &&
get_tag_msg blankfile-signed-tag >actual && get_tag_msg blankfile-signed-tag >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -v blankfile-signed-tag git tag -v blankfile-signed-tag
' '
printf ' ' >sigblanknonlfile printf ' ' >sigblanknonlfile
@ -821,10 +821,10 @@ get_tag_header blanknonlfile-signed-tag $commit commit $time >expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag with spaces and no newline should succeed' ' 'creating a signed tag with spaces and no newline should succeed' '
git-tag -s -F sigblanknonlfile blanknonlfile-signed-tag && git tag -s -F sigblanknonlfile blanknonlfile-signed-tag &&
get_tag_msg blanknonlfile-signed-tag >actual && get_tag_msg blanknonlfile-signed-tag >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -v signed-tag git tag -v signed-tag
' '
# messages with commented lines for signed tags: # messages with commented lines for signed tags:
@ -858,20 +858,20 @@ EOF
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag with a -F file with #comments should succeed' ' 'creating a signed tag with a -F file with #comments should succeed' '
git-tag -s -F sigcommentsfile comments-signed-tag && git tag -s -F sigcommentsfile comments-signed-tag &&
get_tag_msg comments-signed-tag >actual && get_tag_msg comments-signed-tag >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -v comments-signed-tag git tag -v comments-signed-tag
' '
get_tag_header comment-signed-tag $commit commit $time >expect get_tag_header comment-signed-tag $commit commit $time >expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag with #commented -m message should succeed' ' 'creating a signed tag with #commented -m message should succeed' '
git-tag -s -m "#comment" comment-signed-tag && git tag -s -m "#comment" comment-signed-tag &&
get_tag_msg comment-signed-tag >actual && get_tag_msg comment-signed-tag >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -v comment-signed-tag git tag -v comment-signed-tag
' '
echo '#comment' >sigcommentfile echo '#comment' >sigcommentfile
@ -881,10 +881,10 @@ get_tag_header commentfile-signed-tag $commit commit $time >expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag with #commented -F messagefile should succeed' ' 'creating a signed tag with #commented -F messagefile should succeed' '
git-tag -s -F sigcommentfile commentfile-signed-tag && git tag -s -F sigcommentfile commentfile-signed-tag &&
get_tag_msg commentfile-signed-tag >actual && get_tag_msg commentfile-signed-tag >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -v commentfile-signed-tag git tag -v commentfile-signed-tag
' '
printf '#comment' >sigcommentnonlfile printf '#comment' >sigcommentnonlfile
@ -892,61 +892,61 @@ get_tag_header commentnonlfile-signed-tag $commit commit $time >expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag with a #comment and no newline should succeed' ' 'creating a signed tag with a #comment and no newline should succeed' '
git-tag -s -F sigcommentnonlfile commentnonlfile-signed-tag && git tag -s -F sigcommentnonlfile commentnonlfile-signed-tag &&
get_tag_msg commentnonlfile-signed-tag >actual && get_tag_msg commentnonlfile-signed-tag >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -v commentnonlfile-signed-tag git tag -v commentnonlfile-signed-tag
' '
# listing messages for signed tags: # listing messages for signed tags:
test_expect_success \ test_expect_success \
'listing the one-line message of a signed tag should succeed' ' 'listing the one-line message of a signed tag should succeed' '
git-tag -s -m "A message line signed" stag-one-line && git tag -s -m "A message line signed" stag-one-line &&
echo "stag-one-line" >expect && echo "stag-one-line" >expect &&
git-tag -l | grep "^stag-one-line" >actual && git tag -l | grep "^stag-one-line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n0 -l | grep "^stag-one-line" >actual && git tag -n0 -l | grep "^stag-one-line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n0 -l stag-one-line >actual && git tag -n0 -l stag-one-line >actual &&
test_cmp expect actual && test_cmp expect actual &&
echo "stag-one-line A message line signed" >expect && echo "stag-one-line A message line signed" >expect &&
git-tag -n1 -l | grep "^stag-one-line" >actual && git tag -n1 -l | grep "^stag-one-line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n -l | grep "^stag-one-line" >actual && git tag -n -l | grep "^stag-one-line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n1 -l stag-one-line >actual && git tag -n1 -l stag-one-line >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n2 -l stag-one-line >actual && git tag -n2 -l stag-one-line >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n999 -l stag-one-line >actual && git tag -n999 -l stag-one-line >actual &&
test_cmp expect actual test_cmp expect actual
' '
test_expect_success \ test_expect_success \
'listing the zero-lines message of a signed tag should succeed' ' 'listing the zero-lines message of a signed tag should succeed' '
git-tag -s -m "" stag-zero-lines && git tag -s -m "" stag-zero-lines &&
echo "stag-zero-lines" >expect && echo "stag-zero-lines" >expect &&
git-tag -l | grep "^stag-zero-lines" >actual && git tag -l | grep "^stag-zero-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n0 -l | grep "^stag-zero-lines" >actual && git tag -n0 -l | grep "^stag-zero-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n0 -l stag-zero-lines >actual && git tag -n0 -l stag-zero-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
echo "stag-zero-lines " >expect && echo "stag-zero-lines " >expect &&
git-tag -n1 -l | grep "^stag-zero-lines" >actual && git tag -n1 -l | grep "^stag-zero-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n -l | grep "^stag-zero-lines" >actual && git tag -n -l | grep "^stag-zero-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n1 -l stag-zero-lines >actual && git tag -n1 -l stag-zero-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n2 -l stag-zero-lines >actual && git tag -n2 -l stag-zero-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n999 -l stag-zero-lines >actual && git tag -n999 -l stag-zero-lines >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -955,42 +955,42 @@ echo 'stag line two' >>sigtagmsg
echo 'stag line three' >>sigtagmsg echo 'stag line three' >>sigtagmsg
test_expect_success \ test_expect_success \
'listing many message lines of a signed tag should succeed' ' 'listing many message lines of a signed tag should succeed' '
git-tag -s -F sigtagmsg stag-lines && git tag -s -F sigtagmsg stag-lines &&
echo "stag-lines" >expect && echo "stag-lines" >expect &&
git-tag -l | grep "^stag-lines" >actual && git tag -l | grep "^stag-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n0 -l | grep "^stag-lines" >actual && git tag -n0 -l | grep "^stag-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n0 -l stag-lines >actual && git tag -n0 -l stag-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
echo "stag-lines stag line one" >expect && echo "stag-lines stag line one" >expect &&
git-tag -n1 -l | grep "^stag-lines" >actual && git tag -n1 -l | grep "^stag-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n -l | grep "^stag-lines" >actual && git tag -n -l | grep "^stag-lines" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n1 -l stag-lines >actual && git tag -n1 -l stag-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
echo " stag line two" >>expect && echo " stag line two" >>expect &&
git-tag -n2 -l | grep "^ *stag.line" >actual && git tag -n2 -l | grep "^ *stag.line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n2 -l stag-lines >actual && git tag -n2 -l stag-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
echo " stag line three" >>expect && echo " stag line three" >>expect &&
git-tag -n3 -l | grep "^ *stag.line" >actual && git tag -n3 -l | grep "^ *stag.line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n3 -l stag-lines >actual && git tag -n3 -l stag-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n4 -l | grep "^ *stag.line" >actual && git tag -n4 -l | grep "^ *stag.line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n4 -l stag-lines >actual && git tag -n4 -l stag-lines >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n99 -l | grep "^ *stag.line" >actual && git tag -n99 -l | grep "^ *stag.line" >actual &&
test_cmp expect actual && test_cmp expect actual &&
git-tag -n99 -l stag-lines >actual && git tag -n99 -l stag-lines >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -1005,7 +1005,7 @@ echo "A message for a tree" >>expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag pointing to a tree should succeed' ' 'creating a signed tag pointing to a tree should succeed' '
git-tag -s -m "A message for a tree" tree-signed-tag HEAD^{tree} && git tag -s -m "A message for a tree" tree-signed-tag HEAD^{tree} &&
get_tag_msg tree-signed-tag >actual && get_tag_msg tree-signed-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -1015,7 +1015,7 @@ echo "A message for a blob" >>expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag pointing to a blob should succeed' ' 'creating a signed tag pointing to a blob should succeed' '
git-tag -s -m "A message for a blob" blob-signed-tag HEAD:foo && git tag -s -m "A message for a blob" blob-signed-tag HEAD:foo &&
get_tag_msg blob-signed-tag >actual && get_tag_msg blob-signed-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -1025,7 +1025,7 @@ echo "A message for another tag" >>expect
echo '-----BEGIN PGP SIGNATURE-----' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect
test_expect_success \ test_expect_success \
'creating a signed tag pointing to another tag should succeed' ' 'creating a signed tag pointing to another tag should succeed' '
git-tag -s -m "A message for another tag" tag-signed-tag signed-tag && git tag -s -m "A message for another tag" tag-signed-tag signed-tag &&
get_tag_msg tag-signed-tag >actual && get_tag_msg tag-signed-tag >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -1033,7 +1033,7 @@ test_expect_success \
# try to sign with bad user.signingkey # try to sign with bad user.signingkey
git config user.signingkey BobTheMouse git config user.signingkey BobTheMouse
test_expect_success \ test_expect_success \
'git-tag -s fails if gpg is misconfigured' \ 'git tag -s fails if gpg is misconfigured' \
'test_must_fail git tag -s -m tail tag-gpg-failure' 'test_must_fail git tag -s -m tail tag-gpg-failure'
git config --unset user.signingkey git config --unset user.signingkey
@ -1042,10 +1042,10 @@ git config --unset user.signingkey
rm -rf gpghome rm -rf gpghome
test_expect_success \ test_expect_success \
'verify signed tag fails when public key is not present' \ 'verify signed tag fails when public key is not present' \
'test_must_fail git-tag -v signed-tag' 'test_must_fail git tag -v signed-tag'
test_expect_success \ test_expect_success \
'git-tag -a fails if tag annotation is empty' ' 'git tag -a fails if tag annotation is empty' '
! (GIT_EDITOR=cat git tag -a initial-comment) ! (GIT_EDITOR=cat git tag -a initial-comment)
' '

Просмотреть файл

@ -3,7 +3,7 @@
# Copyright (c) 2006 Shawn Pearce # Copyright (c) 2006 Shawn Pearce
# #
test_description='git-reset should cull empty subdirs' test_description='git reset should cull empty subdirs'
. ./test-lib.sh . ./test-lib.sh
test_expect_success \ test_expect_success \
@ -11,7 +11,7 @@ test_expect_success \
'mkdir path0 && 'mkdir path0 &&
cp ../../COPYING path0/COPYING && cp ../../COPYING path0/COPYING &&
git add path0/COPYING && git add path0/COPYING &&
git-commit -m add -a' git commit -m add -a'
test_expect_success \ test_expect_success \
'creating second files' \ 'creating second files' \
@ -25,11 +25,11 @@ test_expect_success \
git add path1/COPYING && git add path1/COPYING &&
git add COPYING && git add COPYING &&
git add path0/COPYING-TOO && git add path0/COPYING-TOO &&
git-commit -m change -a' git commit -m change -a'
test_expect_success \ test_expect_success \
'resetting tree HEAD^' \ 'resetting tree HEAD^' \
'git-reset --hard HEAD^' 'git reset --hard HEAD^'
test_expect_success \ test_expect_success \
'checking initial files exist after rewind' \ 'checking initial files exist after rewind' \

Просмотреть файл

@ -3,9 +3,9 @@
# Copyright (c) 2007 Carlos Rica # Copyright (c) 2007 Carlos Rica
# #
test_description='git-reset test_description='git reset
Documented tests for git-reset' Documented tests for git reset'
. ./test-lib.sh . ./test-lib.sh

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description='git-reset in a bare repository' test_description='git reset in a bare repository'
. ./test-lib.sh . ./test-lib.sh
test_expect_success 'setup non-bare' ' test_expect_success 'setup non-bare' '

Просмотреть файл

@ -3,7 +3,7 @@
# Copyright (c) 2006 Junio C Hamano # Copyright (c) 2006 Junio C Hamano
# #
test_description='git-checkout tests. test_description='git checkout tests.
Creates master, forks renamer and side branches from it. Creates master, forks renamer and side branches from it.
Test switching across them. Test switching across them.

Просмотреть файл

@ -3,7 +3,7 @@
# Copyright (c) 2007 Michael Spang # Copyright (c) 2007 Michael Spang
# #
test_description='git-clean basic tests' test_description='git clean basic tests'
. ./test-lib.sh . ./test-lib.sh
@ -16,17 +16,17 @@ test_expect_success 'setup' '
echo build >.gitignore && echo build >.gitignore &&
echo \*.o >>.gitignore && echo \*.o >>.gitignore &&
git add . && git add . &&
git-commit -m setup && git commit -m setup &&
touch src/part2.c README && touch src/part2.c README &&
git add . git add .
' '
test_expect_success 'git-clean' ' test_expect_success 'git clean' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git-clean && git clean &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -39,11 +39,11 @@ test_expect_success 'git-clean' '
' '
test_expect_success 'git-clean src/' ' test_expect_success 'git clean src/' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git-clean src/ && git clean src/ &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -56,11 +56,11 @@ test_expect_success 'git-clean src/' '
' '
test_expect_success 'git-clean src/ src/' ' test_expect_success 'git clean src/ src/' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git-clean src/ src/ && git clean src/ src/ &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -73,11 +73,11 @@ test_expect_success 'git-clean src/ src/' '
' '
test_expect_success 'git-clean with prefix' ' test_expect_success 'git clean with prefix' '
mkdir -p build docs src/test && mkdir -p build docs src/test &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&
(cd src/ && git-clean) && (cd src/ && git clean) &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -91,7 +91,7 @@ test_expect_success 'git-clean with prefix' '
' '
test_expect_success 'git-clean with relative prefix' ' test_expect_success 'git clean with relative prefix' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
@ -106,7 +106,7 @@ test_expect_success 'git-clean with relative prefix' '
} }
' '
test_expect_success 'git-clean with absolute path' ' test_expect_success 'git clean with absolute path' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
@ -121,7 +121,7 @@ test_expect_success 'git-clean with absolute path' '
} }
' '
test_expect_success 'git-clean with out of work tree relative path' ' test_expect_success 'git clean with out of work tree relative path' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
@ -131,7 +131,7 @@ test_expect_success 'git-clean with out of work tree relative path' '
) )
' '
test_expect_success 'git-clean with out of work tree absolute path' ' test_expect_success 'git clean with out of work tree absolute path' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
@ -142,11 +142,11 @@ test_expect_success 'git-clean with out of work tree absolute path' '
) )
' '
test_expect_success 'git-clean -d with prefix and path' ' test_expect_success 'git clean -d with prefix and path' '
mkdir -p build docs src/feature && mkdir -p build docs src/feature &&
touch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so &&
(cd src/ && git-clean -d feature/) && (cd src/ && git clean -d feature/) &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -160,12 +160,12 @@ test_expect_success 'git-clean -d with prefix and path' '
' '
test_expect_success 'git-clean symbolic link' ' test_expect_success 'git clean symbolic link' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
ln -s docs/manual.txt src/part4.c ln -s docs/manual.txt src/part4.c
git-clean && git clean &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -179,10 +179,10 @@ test_expect_success 'git-clean symbolic link' '
' '
test_expect_success 'git-clean with wildcard' ' test_expect_success 'git clean with wildcard' '
touch a.clean b.clean other.c && touch a.clean b.clean other.c &&
git-clean "*.clean" && git clean "*.clean" &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -193,11 +193,11 @@ test_expect_success 'git-clean with wildcard' '
' '
test_expect_success 'git-clean -n' ' test_expect_success 'git clean -n' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git-clean -n && git clean -n &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -210,11 +210,11 @@ test_expect_success 'git-clean -n' '
' '
test_expect_success 'git-clean -d' ' test_expect_success 'git clean -d' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git-clean -d && git clean -d &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -227,11 +227,11 @@ test_expect_success 'git-clean -d' '
' '
test_expect_success 'git-clean -d src/ examples/' ' test_expect_success 'git clean -d src/ examples/' '
mkdir -p build docs examples && mkdir -p build docs examples &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c &&
git-clean -d src/ examples/ && git clean -d src/ examples/ &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -245,11 +245,11 @@ test_expect_success 'git-clean -d src/ examples/' '
' '
test_expect_success 'git-clean -x' ' test_expect_success 'git clean -x' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git-clean -x && git clean -x &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -262,11 +262,11 @@ test_expect_success 'git-clean -x' '
' '
test_expect_success 'git-clean -d -x' ' test_expect_success 'git clean -d -x' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git-clean -d -x && git clean -d -x &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -279,11 +279,11 @@ test_expect_success 'git-clean -d -x' '
' '
test_expect_success 'git-clean -X' ' test_expect_success 'git clean -X' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git-clean -X && git clean -X &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -296,11 +296,11 @@ test_expect_success 'git-clean -X' '
' '
test_expect_success 'git-clean -d -X' ' test_expect_success 'git clean -d -X' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git-clean -d -X && git clean -d -X &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -331,7 +331,7 @@ test_expect_success 'clean.requireForce and -n' '
mkdir -p build docs && mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git-clean -n && git clean -n &&
test -f Makefile && test -f Makefile &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
@ -346,7 +346,7 @@ test_expect_success 'clean.requireForce and -n' '
test_expect_success 'clean.requireForce and -f' ' test_expect_success 'clean.requireForce and -f' '
git-clean -f && git clean -f &&
test -f README && test -f README &&
test -f src/part1.c && test -f src/part1.c &&
test -f src/part2.c && test -f src/part2.c &&

Просмотреть файл

@ -6,7 +6,7 @@
test_description='Basic porcelain support for submodules test_description='Basic porcelain support for submodules
This test tries to verify basic sanity of the init, update and status This test tries to verify basic sanity of the init, update and status
subcommands of git-submodule. subcommands of git submodule.
' '
. ./test-lib.sh . ./test-lib.sh
@ -22,16 +22,16 @@ subcommands of git-submodule.
# #
test_expect_success 'Prepare submodule testing' ' test_expect_success 'Prepare submodule testing' '
: > t && : > t &&
git-add t && git add t &&
git-commit -m "initial commit" && git commit -m "initial commit" &&
git branch initial HEAD && git branch initial HEAD &&
mkdir init && mkdir init &&
cd init && cd init &&
git init && git init &&
echo a >a && echo a >a &&
git add a && git add a &&
git-commit -m "submodule commit 1" && git commit -m "submodule commit 1" &&
git-tag -a -m "rev-1" rev-1 && git tag -a -m "rev-1" rev-1 &&
rev1=$(git rev-parse HEAD) && rev1=$(git rev-parse HEAD) &&
if test -z "$rev1" if test -z "$rev1"
then then
@ -42,13 +42,13 @@ test_expect_success 'Prepare submodule testing' '
echo a >a && echo a >a &&
echo z >z && echo z >z &&
git add a init z && git add a init z &&
git-commit -m "super commit 1" && git commit -m "super commit 1" &&
mv init .subrepo && mv init .subrepo &&
GIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git GIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git
' '
test_expect_success 'status should fail for unmapped paths' ' test_expect_success 'status should fail for unmapped paths' '
if git-submodule status if git submodule status
then then
echo "[OOPS] submodule status succeeded" echo "[OOPS] submodule status succeeded"
false false
@ -60,16 +60,16 @@ test_expect_success 'status should fail for unmapped paths' '
' '
test_expect_success 'status should only print one line' ' test_expect_success 'status should only print one line' '
lines=$(git-submodule status | wc -l) && lines=$(git submodule status | wc -l) &&
test $lines = 1 test $lines = 1
' '
test_expect_success 'status should initially be "missing"' ' test_expect_success 'status should initially be "missing"' '
git-submodule status | grep "^-$rev1" git submodule status | grep "^-$rev1"
' '
test_expect_success 'init should register submodule url in .git/config' ' test_expect_success 'init should register submodule url in .git/config' '
git-submodule init && git submodule init &&
url=$(git config submodule.example.url) && url=$(git config submodule.example.url) &&
if test "$url" != "git://example.com/init.git" if test "$url" != "git://example.com/init.git"
then then
@ -84,7 +84,7 @@ test_expect_success 'init should register submodule url in .git/config' '
test_expect_success 'update should fail when path is used by a file' ' test_expect_success 'update should fail when path is used by a file' '
echo "hello" >init && echo "hello" >init &&
if git-submodule update if git submodule update
then then
echo "[OOPS] update should have failed" echo "[OOPS] update should have failed"
false false
@ -100,7 +100,7 @@ test_expect_success 'update should fail when path is used by a file' '
test_expect_success 'update should fail when path is used by a nonempty directory' ' test_expect_success 'update should fail when path is used by a nonempty directory' '
mkdir init && mkdir init &&
echo "hello" >init/a && echo "hello" >init/a &&
if git-submodule update if git submodule update
then then
echo "[OOPS] update should have failed" echo "[OOPS] update should have failed"
false false
@ -116,7 +116,7 @@ test_expect_success 'update should fail when path is used by a nonempty director
test_expect_success 'update should work when path is an empty dir' ' test_expect_success 'update should work when path is an empty dir' '
rm -rf init && rm -rf init &&
mkdir init && mkdir init &&
git-submodule update && git submodule update &&
head=$(cd init && git rev-parse HEAD) && head=$(cd init && git rev-parse HEAD) &&
if test -z "$head" if test -z "$head"
then then
@ -130,14 +130,14 @@ test_expect_success 'update should work when path is an empty dir' '
' '
test_expect_success 'status should be "up-to-date" after update' ' test_expect_success 'status should be "up-to-date" after update' '
git-submodule status | grep "^ $rev1" git submodule status | grep "^ $rev1"
' '
test_expect_success 'status should be "modified" after submodule commit' ' test_expect_success 'status should be "modified" after submodule commit' '
cd init && cd init &&
echo b >b && echo b >b &&
git add b && git add b &&
git-commit -m "submodule commit 2" && git commit -m "submodule commit 2" &&
rev2=$(git rev-parse HEAD) && rev2=$(git rev-parse HEAD) &&
cd .. && cd .. &&
if test -z "$rev2" if test -z "$rev2"
@ -145,19 +145,19 @@ test_expect_success 'status should be "modified" after submodule commit' '
echo "[OOPS] submodule git rev-parse returned nothing" echo "[OOPS] submodule git rev-parse returned nothing"
false false
fi && fi &&
git-submodule status | grep "^+$rev2" git submodule status | grep "^+$rev2"
' '
test_expect_success 'the --cached sha1 should be rev1' ' test_expect_success 'the --cached sha1 should be rev1' '
git-submodule --cached status | grep "^+$rev1" git submodule --cached status | grep "^+$rev1"
' '
test_expect_success 'git diff should report the SHA1 of the new submodule commit' ' test_expect_success 'git diff should report the SHA1 of the new submodule commit' '
git-diff | grep "^+Subproject commit $rev2" git diff | grep "^+Subproject commit $rev2"
' '
test_expect_success 'update should checkout rev1' ' test_expect_success 'update should checkout rev1' '
git-submodule update init && git submodule update init &&
head=$(cd init && git rev-parse HEAD) && head=$(cd init && git rev-parse HEAD) &&
if test -z "$head" if test -z "$head"
then then
@ -171,12 +171,12 @@ test_expect_success 'update should checkout rev1' '
' '
test_expect_success 'status should be "up-to-date" after update' ' test_expect_success 'status should be "up-to-date" after update' '
git-submodule status | grep "^ $rev1" git submodule status | grep "^ $rev1"
' '
test_expect_success 'checkout superproject with subproject already present' ' test_expect_success 'checkout superproject with subproject already present' '
git-checkout initial && git checkout initial &&
git-checkout master git checkout master
' '
test_expect_success 'apply submodule diff' ' test_expect_success 'apply submodule diff' '
@ -188,8 +188,8 @@ test_expect_success 'apply submodule diff' '
git commit -m "change subproject" git commit -m "change subproject"
) && ) &&
git update-index --add init && git update-index --add init &&
git-commit -m "change init" && git commit -m "change init" &&
git-format-patch -1 --stdout >P.diff && git format-patch -1 --stdout >P.diff &&
git checkout second && git checkout second &&
git apply --index P.diff && git apply --index P.diff &&
D=$(git diff --cached master) && D=$(git diff --cached master) &&

Просмотреть файл

@ -5,7 +5,7 @@
test_description='Summary support for submodules test_description='Summary support for submodules
This test tries to verify the sanity of summary subcommand of git-submodule. This test tries to verify the sanity of summary subcommand of git submodule.
' '
. ./test-lib.sh . ./test-lib.sh

Просмотреть файл

@ -3,7 +3,7 @@
# Copyright (c) 2007 Steven Grimm # Copyright (c) 2007 Steven Grimm
# #
test_description='git-commit test_description='git commit
Tests for selected commit options.' Tests for selected commit options.'

Просмотреть файл

@ -6,7 +6,7 @@
# FIXME: Test the various index usages, -i and -o, test reflog, # FIXME: Test the various index usages, -i and -o, test reflog,
# signoff # signoff
test_description='git-commit' test_description='git commit'
. ./test-lib.sh . ./test-lib.sh
test_tick test_tick
@ -14,52 +14,52 @@ test_tick
test_expect_success \ test_expect_success \
"initial status" \ "initial status" \
"echo 'bongo bongo' >file && "echo 'bongo bongo' >file &&
git-add file && \ git add file && \
git-status | grep 'Initial commit'" git status | grep 'Initial commit'"
test_expect_success \ test_expect_success \
"fail initial amend" \ "fail initial amend" \
"test_must_fail git-commit --amend" "test_must_fail git commit --amend"
test_expect_success \ test_expect_success \
"initial commit" \ "initial commit" \
"git-commit -m initial" "git commit -m initial"
test_expect_success \ test_expect_success \
"invalid options 1" \ "invalid options 1" \
"test_must_fail git-commit -m foo -m bar -F file" "test_must_fail git commit -m foo -m bar -F file"
test_expect_success \ test_expect_success \
"invalid options 2" \ "invalid options 2" \
"test_must_fail git-commit -C HEAD -m illegal" "test_must_fail git commit -C HEAD -m illegal"
test_expect_success \ test_expect_success \
"using paths with -a" \ "using paths with -a" \
"echo King of the bongo >file && "echo King of the bongo >file &&
test_must_fail git-commit -m foo -a file" test_must_fail git commit -m foo -a file"
test_expect_success \ test_expect_success \
"using paths with --interactive" \ "using paths with --interactive" \
"echo bong-o-bong >file && "echo bong-o-bong >file &&
! (echo 7 | git-commit -m foo --interactive file)" ! (echo 7 | git commit -m foo --interactive file)"
test_expect_success \ test_expect_success \
"using invalid commit with -C" \ "using invalid commit with -C" \
"test_must_fail git-commit -C bogus" "test_must_fail git commit -C bogus"
test_expect_success \ test_expect_success \
"testing nothing to commit" \ "testing nothing to commit" \
"test_must_fail git-commit -m initial" "test_must_fail git commit -m initial"
test_expect_success \ test_expect_success \
"next commit" \ "next commit" \
"echo 'bongo bongo bongo' >file \ "echo 'bongo bongo bongo' >file \
git-commit -m next -a" git commit -m next -a"
test_expect_success \ test_expect_success \
"commit message from non-existing file" \ "commit message from non-existing file" \
"echo 'more bongo: bongo bongo bongo bongo' >file && \ "echo 'more bongo: bongo bongo bongo bongo' >file && \
test_must_fail git-commit -F gah -a" test_must_fail git commit -F gah -a"
# Empty except stray tabs and spaces on a few lines. # Empty except stray tabs and spaces on a few lines.
sed -e 's/@$//' >msg <<EOF sed -e 's/@$//' >msg <<EOF
@ -70,12 +70,12 @@ Signed-off-by: hula
EOF EOF
test_expect_success \ test_expect_success \
"empty commit message" \ "empty commit message" \
"test_must_fail git-commit -F msg -a" "test_must_fail git commit -F msg -a"
test_expect_success \ test_expect_success \
"commit message from file" \ "commit message from file" \
"echo 'this is the commit message, coming from a file' >msg && \ "echo 'this is the commit message, coming from a file' >msg && \
git-commit -F msg -a" git commit -F msg -a"
cat >editor <<\EOF cat >editor <<\EOF
#!/bin/sh #!/bin/sh
@ -86,16 +86,16 @@ chmod 755 editor
test_expect_success \ test_expect_success \
"amend commit" \ "amend commit" \
"VISUAL=./editor git-commit --amend" "VISUAL=./editor git commit --amend"
test_expect_success \ test_expect_success \
"passing -m and -F" \ "passing -m and -F" \
"echo 'enough with the bongos' >file && \ "echo 'enough with the bongos' >file && \
test_must_fail git-commit -F msg -m amending ." test_must_fail git commit -F msg -m amending ."
test_expect_success \ test_expect_success \
"using message from other commit" \ "using message from other commit" \
"git-commit -C HEAD^ ." "git commit -C HEAD^ ."
cat >editor <<\EOF cat >editor <<\EOF
#!/bin/sh #!/bin/sh
@ -107,25 +107,25 @@ chmod 755 editor
test_expect_success \ test_expect_success \
"editing message from other commit" \ "editing message from other commit" \
"echo 'hula hula' >file && \ "echo 'hula hula' >file && \
VISUAL=./editor git-commit -c HEAD^ -a" VISUAL=./editor git commit -c HEAD^ -a"
test_expect_success \ test_expect_success \
"message from stdin" \ "message from stdin" \
"echo 'silly new contents' >file && \ "echo 'silly new contents' >file && \
echo commit message from stdin | git-commit -F - -a" echo commit message from stdin | git commit -F - -a"
test_expect_success \ test_expect_success \
"overriding author from command line" \ "overriding author from command line" \
"echo 'gak' >file && \ "echo 'gak' >file && \
git-commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a" git commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a"
test_expect_success \ test_expect_success \
"interactive add" \ "interactive add" \
"echo 7 | git-commit --interactive | grep 'What now'" "echo 7 | git commit --interactive | grep 'What now'"
test_expect_success \ test_expect_success \
"showing committed revisions" \ "showing committed revisions" \
"git-rev-list HEAD >current" "git rev-list HEAD >current"
# We could just check the head sha1, but checking each commit makes it # We could just check the head sha1, but checking each commit makes it
# easier to isolate bugs. # easier to isolate bugs.
@ -140,7 +140,7 @@ d381ac431806e53f3dd7ac2f1ae0534f36d738b9
EOF EOF
test_expect_success \ test_expect_success \
'validate git-rev-list output.' \ 'validate git rev-list output.' \
'diff current expected' 'diff current expected'
test_expect_success 'partial commit that involves removal (1)' ' test_expect_success 'partial commit that involves removal (1)' '

Просмотреть файл

@ -3,7 +3,7 @@
# Copyright (c) 2007 Johannes E. Schindelin # Copyright (c) 2007 Johannes E. Schindelin
# #
test_description='git-status' test_description='git status'
. ./test-lib.sh . ./test-lib.sh

Просмотреть файл

@ -32,7 +32,7 @@ echo "#!$SHELL_PATH" > "$HOOK"
cat >> "$HOOK" <<'EOF' cat >> "$HOOK" <<'EOF'
if test "$2" = commit; then if test "$2" = commit; then
source=$(git-rev-parse "$3") source=$(git rev-parse "$3")
else else
source=${2-default} source=${2-default}
fi fi

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description='git-status for submodule' test_description='git status for submodule'
. ./test-lib.sh . ./test-lib.sh

Просмотреть файл

@ -3,7 +3,7 @@
# Copyright (c) 2007 Lars Hjemli # Copyright (c) 2007 Lars Hjemli
# #
test_description='git-merge test_description='git merge
Testing basic merge operations/option parsing.' Testing basic merge operations/option parsing.'

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description='git-merge test_description='git merge
Testing pull.* configuration parsing.' Testing pull.* configuration parsing.'

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description='git-merge test_description='git merge
Testing octopus merge with more than 25 refs.' Testing octopus merge with more than 25 refs.'

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description='git-merge test_description='git merge
Testing octopus merge when reducing parents to independent branches.' Testing octopus merge when reducing parents to independent branches.'

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description='git-merge test_description='git merge
Testing merge when using a custom message for the merge commit.' Testing merge when using a custom message for the merge commit.'

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description='git-merge test_description='git merge
Testing the resolve strategy.' Testing the resolve strategy.'

Просмотреть файл

@ -3,7 +3,7 @@
# Copyright (c) 2008 Charles Bailey # Copyright (c) 2008 Charles Bailey
# #
test_description='git-mergetool test_description='git mergetool
Testing basic merge tool invocation' Testing basic merge tool invocation'

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description='git-repack works correctly' test_description='git repack works correctly'
. ./test-lib.sh . ./test-lib.sh

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
test_description='git-send-email' test_description='git send-email'
. ./test-lib.sh . ./test-lib.sh
PROG='git send-email' PROG='git send-email'

Просмотреть файл

@ -303,7 +303,7 @@ int diff_tree(struct tree_desc *t1, struct tree_desc *t2, const char *base, stru
update_tree_entry(t2); update_tree_entry(t2);
continue; continue;
} }
die("git-diff-tree: internal error"); die("git diff-tree: internal error");
} }
return 0; return 0;
} }

Просмотреть файл

@ -157,7 +157,7 @@ static void create_pack_file(void)
/* .data is just a boolean: any non-NULL value will do */ /* .data is just a boolean: any non-NULL value will do */
rev_list.data = create_full_pack ? &rev_list : NULL; rev_list.data = create_full_pack ? &rev_list : NULL;
if (start_async(&rev_list)) if (start_async(&rev_list))
die("git-upload-pack: unable to fork git-rev-list"); die("git upload-pack: unable to fork git-rev-list");
argv[arg++] = "pack-objects"; argv[arg++] = "pack-objects";
argv[arg++] = "--stdout"; argv[arg++] = "--stdout";
@ -177,7 +177,7 @@ static void create_pack_file(void)
pack_objects.argv = argv; pack_objects.argv = argv;
if (start_command(&pack_objects)) if (start_command(&pack_objects))
die("git-upload-pack: unable to fork git-pack-objects"); die("git upload-pack: unable to fork git-pack-objects");
/* We read from pack_objects.err to capture stderr output for /* We read from pack_objects.err to capture stderr output for
* progress bar, and pack_objects.out to capture the pack data. * progress bar, and pack_objects.out to capture the pack data.
@ -271,7 +271,7 @@ static void create_pack_file(void)
} }
if (finish_command(&pack_objects)) { if (finish_command(&pack_objects)) {
error("git-upload-pack: git-pack-objects died with error."); error("git upload-pack: git-pack-objects died with error.");
goto fail; goto fail;
} }
if (finish_async(&rev_list)) if (finish_async(&rev_list))
@ -291,7 +291,7 @@ static void create_pack_file(void)
fail: fail:
send_client_data(3, abort_msg, sizeof(abort_msg)); send_client_data(3, abort_msg, sizeof(abort_msg));
die("git-upload-pack: %s", abort_msg); die("git upload-pack: %s", abort_msg);
} }
static int got_sha1(char *hex, unsigned char *sha1) static int got_sha1(char *hex, unsigned char *sha1)
@ -300,7 +300,7 @@ static int got_sha1(char *hex, unsigned char *sha1)
int we_knew_they_have = 0; int we_knew_they_have = 0;
if (get_sha1_hex(hex, sha1)) if (get_sha1_hex(hex, sha1))
die("git-upload-pack: expected SHA1 object, got '%s'", hex); die("git upload-pack: expected SHA1 object, got '%s'", hex);
if (!has_sha1_file(sha1)) if (!has_sha1_file(sha1))
return -1; return -1;
@ -440,7 +440,7 @@ static int get_common_commits(void)
packet_write(1, "NAK\n"); packet_write(1, "NAK\n");
return -1; return -1;
} }
die("git-upload-pack: expected SHA1 list, got '%s'", line); die("git upload-pack: expected SHA1 list, got '%s'", line);
} }
} }
@ -485,7 +485,7 @@ static void receive_needs(void)
} }
if (prefixcmp(line, "want ") || if (prefixcmp(line, "want ") ||
get_sha1_hex(line+5, sha1_buf)) get_sha1_hex(line+5, sha1_buf))
die("git-upload-pack: protocol error, " die("git upload-pack: protocol error, "
"expected to get sha, not '%s'", line); "expected to get sha, not '%s'", line);
if (strstr(line+45, "multi_ack")) if (strstr(line+45, "multi_ack"))
multi_ack = 1; multi_ack = 1;
@ -512,7 +512,7 @@ static void receive_needs(void)
*/ */
o = lookup_object(sha1_buf); o = lookup_object(sha1_buf);
if (!o || !(o->flags & OUR_REF)) if (!o || !(o->flags & OUR_REF))
die("git-upload-pack: not our ref %s", line+5); die("git upload-pack: not our ref %s", line+5);
if (!(o->flags & WANTED)) { if (!(o->flags & WANTED)) {
o->flags |= WANTED; o->flags |= WANTED;
add_object_array(o, NULL, &want_obj); add_object_array(o, NULL, &want_obj);
@ -577,7 +577,7 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo
struct object *o = parse_object(sha1); struct object *o = parse_object(sha1);
if (!o) if (!o)
die("git-upload-pack: cannot find object %s:", sha1_to_hex(sha1)); die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1));
if (capabilities) if (capabilities)
packet_write(1, "%s %s%c%s\n", sha1_to_hex(sha1), refname, packet_write(1, "%s %s%c%s\n", sha1_to_hex(sha1), refname,