diff options
-rw-r--r-- | Documentation/git-rev-list.txt | 5 | ||||
-rw-r--r-- | Documentation/git.txt | 6 | ||||
-rwxr-xr-x | GIT-VERSION-GEN | 2 | ||||
-rw-r--r-- | blame.c | 2 | ||||
-rw-r--r-- | builtin-add.c | 2 | ||||
-rw-r--r-- | builtin-check-ref-format.c | 2 | ||||
-rw-r--r-- | builtin-diff.c | 9 | ||||
-rw-r--r-- | builtin-init-db.c | 2 | ||||
-rw-r--r-- | builtin-mv.c | 2 | ||||
-rw-r--r-- | builtin-prune.c | 2 | ||||
-rw-r--r-- | builtin-push.c | 2 | ||||
-rw-r--r-- | builtin-read-tree.c | 2 | ||||
-rw-r--r-- | builtin-rm.c | 6 | ||||
-rw-r--r-- | builtin-tar-tree.c | 6 | ||||
-rw-r--r-- | builtin-write-tree.c | 2 | ||||
-rw-r--r-- | diff.c | 6 | ||||
-rw-r--r-- | diffcore-rename.c | 1 | ||||
-rw-r--r-- | diffcore.h | 3 | ||||
-rw-r--r-- | fetch-clone.c | 4 | ||||
-rwxr-xr-x | gitk | 2 | ||||
-rw-r--r-- | hash-object.c | 6 | ||||
-rw-r--r-- | mktag.c | 2 | ||||
-rw-r--r-- | mktree.c | 2 | ||||
-rw-r--r-- | setup.c | 2 | ||||
-rwxr-xr-x | t/t1003-read-tree-prefix.sh | 27 | ||||
-rwxr-xr-x | t/t1020-subdirectory.sh | 109 |
26 files changed, 181 insertions, 35 deletions
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt index f60eacd93..dd9fff16d 100644 --- a/Documentation/git-rev-list.txt +++ b/Documentation/git-rev-list.txt @@ -22,6 +22,7 @@ SYNOPSIS [ [\--objects | \--objects-edge] [ \--unpacked ] ] [ \--pretty | \--header ] [ \--bisect ] + [ \--merge ] <commit>... [ \-- <paths>... ] DESCRIPTION @@ -123,6 +124,10 @@ OPTIONS topological order (i.e. descendant commits are shown before their parents). +--merge:: + After a failed merge, show refs that touch files having a + conflict and don't exist on all heads to merge. + Author ------ Written by Linus Torvalds <torvalds@osdl.org> diff --git a/Documentation/git.txt b/Documentation/git.txt index 7310a2b8b..bcf187a11 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -397,6 +397,9 @@ gitlink:git-quiltimport[1]:: gitlink:git-relink[1]:: Hardlink common objects in local repositories. +gitlink:git-svn[1]:: + Bidirectional operation between a single Subversion branch and git. + gitlink:git-svnimport[1]:: Import a SVN repository into git. @@ -442,6 +445,9 @@ gitlink:git-get-tar-commit-id[1]:: gitlink:git-imap-send[1]:: Dump a mailbox from stdin into an imap folder. +gitlink:git-instaweb[1]:: + Instantly browse your working repository in gitweb. + gitlink:git-mailinfo[1]:: Extracts patch and authorship information from a single e-mail message, optionally transliterating the commit diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 5d25b7e12..1ce217dd7 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.4.GIT +DEF_VER=v1.4.2.GIT # First try git-describe, then see if there is a version file # (included in release tarballs), then default @@ -20,7 +20,7 @@ #define DEBUG 0 -static const char blame_usage[] = "[-c] [-l] [-t] [-S <revs-file>] [--] file [commit]\n" +static const char blame_usage[] = "git-blame [-c] [-l] [-t] [-S <revs-file>] [--] file [commit]\n" " -c, --compatibility Use the same output mode as git-annotate (Default: off)\n" " -l, --long Show long commit SHA1 (Default: off)\n" " -t, --time Show raw timestamp (Default: off)\n" diff --git a/builtin-add.c b/builtin-add.c index f548b8007..096b611b5 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -117,7 +117,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) verbose = 1; continue; } - die(builtin_add_usage); + usage(builtin_add_usage); } pathspec = get_pathspec(prefix, argv + i); diff --git a/builtin-check-ref-format.c b/builtin-check-ref-format.c index 701de439a..fe04be77a 100644 --- a/builtin-check-ref-format.c +++ b/builtin-check-ref-format.c @@ -9,6 +9,6 @@ int cmd_check_ref_format(int argc, const char **argv, const char *prefix) { if (argc != 2) - usage("git check-ref-format refname"); + usage("git-check-ref-format refname"); return !!check_ref_format(argv[1]); } diff --git a/builtin-diff.c b/builtin-diff.c index 48d2fd03b..107585510 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -23,7 +23,7 @@ struct blobinfo { }; static const char builtin_diff_usage[] = -"diff <options> <rev>{0,2} -- <path>*"; +"git-diff <options> <rev>{0,2} -- <path>*"; static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv) @@ -125,9 +125,6 @@ static int builtin_diff_blobs(struct rev_info *revs, int argc, const char **argv, struct blobinfo *blob) { - /* Blobs: the arguments are reversed when setup_revisions() - * picked them up. - */ unsigned mode = canon_mode(S_IFREG | 0644); if (argc > 1) @@ -135,8 +132,8 @@ static int builtin_diff_blobs(struct rev_info *revs, stuff_change(&revs->diffopt, mode, mode, - blob[1].sha1, blob[0].sha1, - blob[0].name, blob[0].name); + blob[0].sha1, blob[1].sha1, + blob[0].name, blob[1].name); diffcore_std(&revs->diffopt); diff_flush(&revs->diffopt); return 0; diff --git a/builtin-init-db.c b/builtin-init-db.c index 52473edf5..5085018e4 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -267,7 +267,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) else if (!strncmp(arg, "--shared=", 9)) shared_repository = git_config_perm("arg", arg+9); else - die(init_db_usage); + usage(init_db_usage); } /* diff --git a/builtin-mv.c b/builtin-mv.c index 62ae937cb..e47942c13 100644 --- a/builtin-mv.c +++ b/builtin-mv.c @@ -99,7 +99,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix) ignore_errors = 1; continue; } - die(builtin_mv_usage); + usage(builtin_mv_usage); } count = argc - i - 1; if (count < 1) diff --git a/builtin-prune.c b/builtin-prune.c index 6a86eb52a..89ec7f142 100644 --- a/builtin-prune.c +++ b/builtin-prune.c @@ -10,7 +10,7 @@ #include "builtin.h" #include "cache-tree.h" -static const char prune_usage[] = "git prune [-n]"; +static const char prune_usage[] = "git-prune [-n]"; static int show_only = 0; static struct rev_info revs; diff --git a/builtin-push.c b/builtin-push.c index c39dd1e09..53bc378f7 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -8,7 +8,7 @@ #define MAX_URI (16) -static const char push_usage[] = "git push [--all] [--tags] [-f | --force] <repository> [<refspec>...]"; +static const char push_usage[] = "git-push [--all] [--tags] [-f | --force] <repository> [<refspec>...]"; static int all = 0, tags = 0, force = 0, thin = 1; static const char *execute = NULL; diff --git a/builtin-read-tree.c b/builtin-read-tree.c index 49c10bf22..b30160a5b 100644 --- a/builtin-read-tree.c +++ b/builtin-read-tree.c @@ -870,7 +870,7 @@ static const char read_tree_usage[] = "git-read-tree (<sha> | [[-m [--aggressive static struct lock_file lock_file; -int cmd_read_tree(int argc, const char **argv, const char *prefix) +int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) { int i, newfd, stage = 0; unsigned char sha1[20]; diff --git a/builtin-rm.c b/builtin-rm.c index 92d205a71..8af3d7eb4 100644 --- a/builtin-rm.c +++ b/builtin-rm.c @@ -80,7 +80,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix) force = 1; continue; } - die(builtin_rm_usage); + usage(builtin_rm_usage); } if (argc <= i) usage(builtin_rm_usage); @@ -115,7 +115,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix) printf("rm '%s'\n", path); if (remove_file_from_cache(path)) - die("git rm: unable to remove %s", path); + die("git-rm: unable to remove %s", path); cache_tree_invalidate_path(active_cache_tree, path); } @@ -139,7 +139,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix) continue; } if (!removed) - die("git rm: %s: %s", path, strerror(errno)); + die("git-rm: %s: %s", path, strerror(errno)); } } diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c index 7c48db9ec..215892b69 100644 --- a/builtin-tar-tree.c +++ b/builtin-tar-tree.c @@ -314,6 +314,7 @@ static int generate_tar(int argc, const char **argv, const char *prefix) struct commit *commit; struct tree_desc tree; struct strbuf current_path; + void *buffer; current_path.buf = xmalloc(PATH_MAX); current_path.alloc = PATH_MAX; @@ -341,8 +342,8 @@ static int generate_tar(int argc, const char **argv, const char *prefix) } else archive_time = time(NULL); - tree.buf = read_object_with_reference(sha1, tree_type, &tree.size, - tree_sha1); + tree.buf = buffer = read_object_with_reference(sha1, tree_type, + &tree.size, tree_sha1); if (!tree.buf) die("not a reference to a tag, commit or tree object: %s", sha1_to_hex(sha1)); @@ -351,6 +352,7 @@ static int generate_tar(int argc, const char **argv, const char *prefix) write_entry(tree_sha1, ¤t_path, 040777, NULL, 0); traverse_tree(&tree, ¤t_path); write_trailer(); + free(buffer); free(current_path.buf); return 0; } diff --git a/builtin-write-tree.c b/builtin-write-tree.c index 0289f5993..6b62d7dc8 100644 --- a/builtin-write-tree.c +++ b/builtin-write-tree.c @@ -73,7 +73,7 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) else if (!strncmp(arg, "--prefix=", 9)) prefix = arg + 9; else - die(write_tree_usage); + usage(write_tree_usage); argc--; argv++; } @@ -1786,13 +1786,9 @@ struct diff_filepair *diff_queue(struct diff_queue_struct *queue, struct diff_filespec *one, struct diff_filespec *two) { - struct diff_filepair *dp = xmalloc(sizeof(*dp)); + struct diff_filepair *dp = xcalloc(1, sizeof(*dp)); dp->one = one; dp->two = two; - dp->score = 0; - dp->status = 0; - dp->source_stays = 0; - dp->broken_pair = 0; if (queue) diff_q(queue, dp); return dp; diff --git a/diffcore-rename.c b/diffcore-rename.c index 1de8d3250..0ec488a90 100644 --- a/diffcore-rename.c +++ b/diffcore-rename.c @@ -205,6 +205,7 @@ static void record_rename_pair(int dst_index, int src_index, int score) fill_filespec(two, dst->sha1, dst->mode); dp = diff_queue(NULL, one, two); + dp->renamed_pair = 1; if (!strcmp(src->path, dst->path)) dp->score = rename_src[src_index].score; else diff --git a/diffcore.h b/diffcore.h index 73c7842cc..2249bc2c0 100644 --- a/diffcore.h +++ b/diffcore.h @@ -53,11 +53,12 @@ struct diff_filepair { char status; /* M C R N D U (see Documentation/diff-format.txt) */ unsigned source_stays : 1; /* all of R/C are copies */ unsigned broken_pair : 1; + unsigned renamed_pair : 1; }; #define DIFF_PAIR_UNMERGED(p) \ (!DIFF_FILE_VALID((p)->one) && !DIFF_FILE_VALID((p)->two)) -#define DIFF_PAIR_RENAME(p) (strcmp((p)->one->path, (p)->two->path)) +#define DIFF_PAIR_RENAME(p) ((p)->renamed_pair) #define DIFF_PAIR_BROKEN(p) \ ( (!DIFF_FILE_VALID((p)->one) != !DIFF_FILE_VALID((p)->two)) && \ diff --git a/fetch-clone.c b/fetch-clone.c index 81d137129..5e84c4620 100644 --- a/fetch-clone.c +++ b/fetch-clone.c @@ -129,10 +129,12 @@ static pid_t setup_sideband(int sideband, const char *me, int fd[2], int xd[2]) len--; switch (buf[0] & 0xFF) { case 3: + safe_write(2, "remote: ", 8); safe_write(2, buf+1, len); - fprintf(stderr, "\n"); + safe_write(2, "\n", 1); exit(1); case 2: + safe_write(2, "remote: ", 8); safe_write(2, buf+1, len); continue; case 1: @@ -4901,7 +4901,7 @@ proc domktag {} { proc redrawtags {id} { global canv linehtag commitrow idpos selectedline curview - global mainfont + global mainfont canvxmax if {![info exists commitrow($curview,$id)]} return drawcmitrow $commitrow($curview,$id) diff --git a/hash-object.c b/hash-object.c index 43bd93bff..5f89e64c1 100644 --- a/hash-object.c +++ b/hash-object.c @@ -46,7 +46,7 @@ int main(int argc, char **argv) if (!no_more_flags && argv[i][0] == '-') { if (!strcmp(argv[i], "-t")) { if (argc <= ++i) - die(hash_object_usage); + usage(hash_object_usage); type = argv[i]; } else if (!strcmp(argv[i], "-w")) { @@ -66,8 +66,8 @@ int main(int argc, char **argv) hash_stdin(type, write_object); } else - die(hash_object_usage); - } + usage(hash_object_usage); + } else { const char *arg = argv[i]; if (0 <= prefix_length) @@ -123,7 +123,7 @@ int main(int argc, char **argv) unsigned char result_sha1[20]; if (argc != 1) - usage("cat <signaturefile> | git-mktag"); + usage("git-mktag < signaturefile"); setup_git_directory(); @@ -71,7 +71,7 @@ static void write_tree(unsigned char *sha1) write_sha1_file(buffer, offset, tree_type, sha1); } -static const char mktree_usage[] = "mktree [-z]"; +static const char mktree_usage[] = "git-mktree [-z]"; int main(int ac, char **av) { @@ -184,7 +184,7 @@ const char *setup_git_directory_gently(int *nongit_ok) } return NULL; bad_dir_environ: - if (!nongit_ok) { + if (nongit_ok) { *nongit_ok = 1; return NULL; } diff --git a/t/t1003-read-tree-prefix.sh b/t/t1003-read-tree-prefix.sh new file mode 100755 index 000000000..48ab117d7 --- /dev/null +++ b/t/t1003-read-tree-prefix.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Copyright (c) 2006 Junio C Hamano +# + +test_description='git-read-tree --prefix test. +' + +. ./test-lib.sh + +test_expect_success setup ' + echo hello >one && + git-update-index --add one && + tree=`git-write-tree` && + echo tree is $tree +' + +echo 'one +two/one' >expect + +test_expect_success 'read-tree --prefix' ' + git-read-tree --prefix=two/ $tree && + git-ls-files >actual && + cmp expect actual +' + +test_done diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh new file mode 100755 index 000000000..4409b87f8 --- /dev/null +++ b/t/t1020-subdirectory.sh @@ -0,0 +1,109 @@ +#!/bin/sh +# +# Copyright (c) 2006 Junio C Hamano +# + +test_description='Try various core-level commands in subdirectory. +' + +. ./test-lib.sh + +test_expect_success setup ' + long="a b c d e f g h i j k l m n o p q r s t u v w x y z" && + for c in $long; do echo $c; done >one && + mkdir dir && + for c in x y z $long a b c; do echo $c; done >dir/two && + cp one original.one && + cp dir/two original.two +' +HERE=`pwd` +LF=' +' + +test_expect_success 'update-index and ls-files' ' + cd $HERE && + git-update-index --add one && + case "`git-ls-files`" in + one) echo ok one ;; + *) echo bad one; exit 1 ;; + esac && + cd dir && + git-update-index --add two && + case "`git-ls-files`" in + two) echo ok two ;; + *) echo bad two; exit 1 ;; + esac && + cd .. && + case "`git-ls-files`" in + dir/two"$LF"one) echo ok both ;; + *) echo bad; exit 1 ;; + esac +' + +test_expect_success 'cat-file' ' + cd $HERE && + two=`git-ls-files -s dir/two` && + two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` && + echo "$two" && + git-cat-file -p "$two" >actual && + cmp dir/two actual && + cd dir && + git-cat-file -p "$two" >actual && + cmp two actual +' +rm -f actual dir/actual + +test_expect_success 'diff-files' ' + cd $HERE && + echo a >>one && + echo d >>dir/two && + case "`git-diff-files --name-only`" in + dir/two"$LF"one) echo ok top ;; + *) echo bad top; exit 1 ;; + esac && + # diff should not omit leading paths + cd dir && + case "`git-diff-files --name-only`" in + dir/two"$LF"one) echo ok subdir ;; + *) echo bad subdir; exit 1 ;; + esac && + case "`git-diff-files --name-only .`" in + dir/two) echo ok subdir limited ;; + *) echo bad subdir limited; exit 1 ;; + esac +' + +test_expect_success 'write-tree' ' + cd $HERE && + top=`git-write-tree` && + echo $top && + cd dir && + sub=`git-write-tree` && + echo $sub && + test "z$top" = "z$sub" +' + +test_expect_success 'checkout-index' ' + cd $HERE && + git-checkout-index -f -u one && + cmp one original.one && + cd dir && + git-checkout-index -f -u two && + cmp two ../original.two +' + +test_expect_success 'read-tree' ' + cd $HERE && + rm -f one dir/two && + tree=`git-write-tree` && + git-read-tree --reset -u "$tree" && + cmp one original.one && + cmp dir/two original.two && + cd dir && + rm -f two && + git-read-tree --reset -u "$tree" && + cmp two ../original.two && + cmp ../one ../original.one +' + +test_done |