From 04794fdc2701f15d79d92805cfe94c9e754e2e05 Mon Sep 17 00:00:00 2001 From: Pavan Kumar Sunkara Date: Mon, 10 May 2010 18:41:35 +0200 Subject: [PATCH 1/7] gitweb: Use @diff_opts while using format-patch Make git-format-patch (used by 'patch' and 'patches' views) use the same rename detection options that git-diff and git-diff-tree (used by 'commitdiff', 'blobdiff', etc.) use. Signed-off-by: Pavan Kumar Sunkara Acked-by: Jakub Narebski Acked-by: Giuseppe Bilotta Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index c356e95f18..77e5f795a1 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -6117,8 +6117,8 @@ sub git_commitdiff { } push @commit_spec, '--root', $hash; } - open $fd, "-|", git_cmd(), "format-patch", '--encoding=utf8', - '--stdout', @commit_spec + open $fd, "-|", git_cmd(), "format-patch", @diff_opts, + '--encoding=utf8', '--stdout', @commit_spec or die_error(500, "Open git-format-patch failed"); } else { die_error(400, "Unknown commitdiff format"); From 08bda2085cc095863888bb4bb7a73960a9a379fd Mon Sep 17 00:00:00 2001 From: Dmitry Potapov Date: Tue, 11 May 2010 01:38:17 +0400 Subject: [PATCH 2/7] hash_object: correction for zero length file The check whether size is zero was done after if size <= SMALL_FILE_SIZE, as result, zero size case was never triggered. Instead zero length file was treated as any other small file. This did not caused any problem, but if we have a special case for size equal to zero, it is better to make it work and avoid redundant malloc(). Signed-off-by: Dmitry Potapov Signed-off-by: Junio C Hamano --- sha1_file.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sha1_file.c b/sha1_file.c index ff65328006..1b551e4609 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2448,6 +2448,8 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, else ret = -1; strbuf_release(&sbuf); + } else if (!size) { + ret = index_mem(sha1, NULL, size, write_object, type, path); } else if (size <= SMALL_FILE_SIZE) { char *buf = xmalloc(size); if (size == read_in_full(fd, buf, size)) @@ -2456,12 +2458,11 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, else ret = error("short read %s", strerror(errno)); free(buf); - } else if (size) { + } else { void *buf = xmmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); ret = index_mem(sha1, buf, size, write_object, type, path); munmap(buf, size); - } else - ret = index_mem(sha1, NULL, size, write_object, type, path); + } close(fd); return ret; } From 67687feae52ff2d3ab7edf3ac42a39c5e44be299 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Thu, 13 May 2010 14:31:46 +0200 Subject: [PATCH 3/7] for-each-ref: Field with abbreviated objectname Introduce a :short modifier to objectname which outputs the abbreviated object name. Signed-off-by: Michael J Gruber Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/git-for-each-ref.txt | 1 + builtin/for-each-ref.c | 3 +++ t/t6300-for-each-ref.sh | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt index 7e83288d18..390d85ccae 100644 --- a/Documentation/git-for-each-ref.txt +++ b/Documentation/git-for-each-ref.txt @@ -86,6 +86,7 @@ objectsize:: objectname:: The object name (aka SHA-1). + For a non-ambiguous abbreviation of the object name append `:short`. upstream:: The name of a local ref which can be considered ``upstream'' diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 62be1bbfd6..3a97953177 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -227,6 +227,9 @@ static void grab_common_values(struct atom_value *val, int deref, struct object strcpy(s, sha1_to_hex(obj->sha1)); v->s = s; } + else if (!strcmp(name, "objectname:short")) { + v->s = find_unique_abbrev(obj->sha1, DEFAULT_ABBREV); + } } } diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index 8052c86ad3..7dc8a510c7 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -295,6 +295,15 @@ test_expect_success 'Check short upstream format' ' test_cmp expected actual ' +cat >expected <actual && + test_cmp expected actual +' + test_expect_success 'Check for invalid refname format' ' test_must_fail git for-each-ref --format="%(refname:INVALID)" ' From 1c9eecff97beab2d425397dc624281dff5c0be5c Mon Sep 17 00:00:00 2001 From: Will Palmer Date: Thu, 13 May 2010 09:59:00 +0100 Subject: [PATCH 4/7] diff-options: make --patch a synonym for -p Here we simply make --patch a synonym for -p, whose mnemonic was "patch" all along. Signed-off-by: Will Palmer Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 1 + diff.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index c9c6c2b1cb..4a968591cb 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -21,6 +21,7 @@ endif::git-format-patch[] ifndef::git-format-patch[] -p:: -u:: +--patch:: Generate patch (see section on generating patches). {git-diff? This is the default.} endif::git-format-patch[] diff --git a/diff.c b/diff.c index e49f14a924..43a313deba 100644 --- a/diff.c +++ b/diff.c @@ -2701,7 +2701,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) const char *arg = av[0]; /* Output format options */ - if (!strcmp(arg, "-p") || !strcmp(arg, "-u")) + if (!strcmp(arg, "-p") || !strcmp(arg, "-u") || !strcmp(arg, "--patch")) options->output_format |= DIFF_FORMAT_PATCH; else if (opt_arg(arg, 'U', "unified", &options->context)) options->output_format |= DIFF_FORMAT_PATCH; From 56a05720b1c2d5f82d4a3db4142b7a027cf8f3f7 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Thu, 13 May 2010 14:47:53 +0200 Subject: [PATCH 5/7] Documentation: rebase -i ignores options passed to "git am" Signed-off-by: Markus Heidelberg Signed-off-by: Junio C Hamano --- Documentation/git-rebase.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 0d07b1b207..5863decdc9 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -295,6 +295,7 @@ link:howto/revert-a-faulty-merge.txt[revert-a-faulty-merge How-To] for details). --ignore-date:: These flags are passed to 'git am' to easily change the dates of the rebased commits (see linkgit:git-am[1]). + Incompatible with the --interactive option. -i:: --interactive:: From f3838ce16aaa8ab576a78c980b0962226f6e7a33 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Thu, 13 May 2010 14:51:38 +0200 Subject: [PATCH 6/7] Documentation: fix minor inconsistency While we don't always write out commands in full (`git command`) we should do it consistently in adjacent paragraphs. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- Documentation/config.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 8f86050b05..c3ebd4d07c 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1516,7 +1516,7 @@ receive.denyDeletes:: the ref. Use this to prevent such a ref deletion via a push. receive.denyCurrentBranch:: - If set to true or "refuse", receive-pack will deny a ref update + If set to true or "refuse", git-receive-pack will deny a ref update to the currently checked out branch of a non-bare repository. Such a push is potentially dangerous because it brings the HEAD out of sync with the index and working tree. If set to "warn", From d07ef715757ab1c2436c59adca92484fa46b2b41 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Tue, 18 May 2010 12:49:33 +0200 Subject: [PATCH 7/7] Documentation/gitdiffcore: fix order in pickaxe description Reverse the order of "origin" and "result" so that the sentence really describes an addition rather than a removal. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- Documentation/gitdiffcore.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/gitdiffcore.txt b/Documentation/gitdiffcore.txt index 9de8caf5d1..5d91a7e5b3 100644 --- a/Documentation/gitdiffcore.txt +++ b/Documentation/gitdiffcore.txt @@ -227,8 +227,8 @@ changes that touch a specified string, and is controlled by the commands. When diffcore-pickaxe is in use, it checks if there are -filepairs whose "original" side has the specified string and -whose "result" side does not. Such a filepair represents "the +filepairs whose "result" side has the specified string and +whose "origin" side does not. Such a filepair represents "the string appeared in this changeset". It also checks for the opposite case that loses the specified string.