diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c8755e38de81ca..93042128d60d21 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -10,7 +10,8 @@ conveniently send your Pull Requests commits to our mailing list. Please read ["A note from the maintainer"](https://git.kernel.org/pub/scm/git/git.git/plain/MaintNotes?h=todo) to learn how the Git project is managed, and how you can work with it. -In addition, we highly recommend you to read [our submission guidelines](../Documentation/SubmittingPatches). +In addition, we highly recommend you to read +[our submission guidelines](https://git-scm.com/docs/SubmittingPatches). If you prefer video, then [this talk](https://www.youtube.com/watch?v=Q7i_qQW__q4&feature=youtu.be&t=6m4s) might be useful to you as the presenter walks you through the contribution diff --git a/Documentation/RelNotes/2.54.0.adoc b/Documentation/RelNotes/2.54.0.adoc index 59bb58e449b165..7a768bc7dda4f9 100644 --- a/Documentation/RelNotes/2.54.0.adoc +++ b/Documentation/RelNotes/2.54.0.adoc @@ -17,6 +17,8 @@ UI, Workflows & Features * The help text and the documentation for the "--expire" option of "git worktree [list|prune]" have been improved. + * When "git show-index" is run outside a repository, it silently + defaults to SHA-1; the tool now warns when this happens. Performance, Internal Implementation, Development Support etc. @@ -52,9 +54,17 @@ Fixes since v2.53 corrected. (merge eff9299eac kn/ref-batch-output-error-reporting-fix later to maint). + * "git blame --ignore-revs=... --color-lines" did not account for + ignored revisions passing blame to the same commit an adjacent line + gets blamed for. + (merge d519082d4e rs/blame-ignore-colors-fix later to maint). + * Other code cleanup, docfix, build fix, etc. (merge d79fff4a11 jk/remote-tracking-ref-leakfix later to maint). (merge 7a747f972d dd/t5403-modernise later to maint). (merge 81021871ea sp/myfirstcontribution-include-update later to maint). (merge 49223593fd ac/sparse-checkout-string-list-cleanup later to maint). (merge a824421d36 sp/t5500-cleanup later to maint). + (merge df1c5d7ed7 kh/doc-shortlog-fix later to maint). + (merge 2d45507f15 am/doc-github-contributiong-link-to-submittingpatches later to maint). + (merge 68060b9262 hs/t9160-test-paths later to maint). diff --git a/Documentation/git-shortlog.adoc b/Documentation/git-shortlog.adoc index aa92800c69ccc3..a11b57c1cd7b2d 100644 --- a/Documentation/git-shortlog.adoc +++ b/Documentation/git-shortlog.adoc @@ -64,9 +64,6 @@ Each pretty-printed commit will be rewrapped before it is shown. example, if your project uses `Reviewed-by` trailers, you might want to see who has been reviewing with `git shortlog -ns --group=trailer:reviewed-by`. - - `format:`, any string accepted by the `--format` option of - 'git log'. (See the "PRETTY FORMATS" section of - linkgit:git-log[1].) + Note that commits that do not include the trailer will not be counted. Likewise, commits with multiple trailers (e.g., multiple signoffs) may @@ -77,6 +74,10 @@ Shortlog will attempt to parse each trailer value as a `name ` identity. If successful, the mailmap is applied and the email is omitted unless the `--email` option is specified. If the value cannot be parsed as an identity, it will be taken literally and completely. + + - `format:`, any string accepted by the `--format` option of + 'git log'. (See the "PRETTY FORMATS" section of + linkgit:git-log[1].) -- + If `--group` is specified multiple times, commits are counted under each diff --git a/builtin/blame.c b/builtin/blame.c index 6044973462a173..bb460346e6da07 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -454,7 +454,8 @@ static void determine_line_heat(struct commit_info *ci, const char **dest_color) *dest_color = colorfield[i].col; } -static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int opt) +static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, + int opt, struct blame_entry *prev_ent) { int cnt; const char *cp; @@ -485,7 +486,10 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int the_hash_algo->hexsz : (size_t) abbrev; if (opt & OUTPUT_COLOR_LINE) { - if (cnt > 0) { + if (cnt > 0 || + (prev_ent && + oideq(&suspect->commit->object.oid, + &prev_ent->suspect->commit->object.oid))) { color = repeated_meta_color; reset = GIT_COLOR_RESET; } else { @@ -571,7 +575,7 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int static void output(struct blame_scoreboard *sb, int option) { - struct blame_entry *ent; + struct blame_entry *ent, *prev_ent = NULL; if (option & OUTPUT_PORCELAIN) { for (ent = sb->ent; ent; ent = ent->next) { @@ -593,7 +597,8 @@ static void output(struct blame_scoreboard *sb, int option) if (option & OUTPUT_PORCELAIN) emit_porcelain(sb, ent, option); else { - emit_other(sb, ent, option); + emit_other(sb, ent, option, prev_ent); + prev_ent = ent; } } } diff --git a/builtin/show-index.c b/builtin/show-index.c index 2c3e2940ce6bb1..24f023096777d5 100644 --- a/builtin/show-index.c +++ b/builtin/show-index.c @@ -43,32 +43,35 @@ int cmd_show_index(int argc, /* * Fallback to SHA1 if we are running outside of a repository. * - * TODO: Figure out and implement a way to detect the hash algorithm in use by the - * the index file passed in and use that instead. + * TODO: If a future implementation of index file version encodes the hash + * algorithm in its header, enable show-index to infer it from the + * header rather than relying on repository context or a default fallback. */ - if (!the_hash_algo) + if (!the_hash_algo) { + warning(_("assuming SHA-1; use --object-format to override")); repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); + } hashsz = the_hash_algo->rawsz; if (fread(top_index, 2 * 4, 1, stdin) != 1) - die("unable to read header"); + die(_("unable to read header")); if (top_index[0] == htonl(PACK_IDX_SIGNATURE)) { version = ntohl(top_index[1]); if (version < 2 || version > 2) - die("unknown index version"); + die(_("unknown index version")); if (fread(top_index, 256 * 4, 1, stdin) != 1) - die("unable to read index"); + die(_("unable to read index")); } else { version = 1; if (fread(&top_index[2], 254 * 4, 1, stdin) != 1) - die("unable to read index"); + die(_("unable to read index")); } nr = 0; for (i = 0; i < 256; i++) { unsigned n = ntohl(top_index[i]); if (n < nr) - die("corrupt index file"); + die(_("corrupt index file")); nr = n; } if (version == 1) { @@ -76,7 +79,7 @@ int cmd_show_index(int argc, unsigned int offset, entry[(GIT_MAX_RAWSZ + 4) / sizeof(unsigned int)]; if (fread(entry, 4 + hashsz, 1, stdin) != 1) - die("unable to read entry %u/%u", i, nr); + die(_("unable to read entry %u/%u"), i, nr); offset = ntohl(entry[0]); printf("%u %s\n", offset, hash_to_hex((void *)(entry+1))); } @@ -90,15 +93,15 @@ int cmd_show_index(int argc, ALLOC_ARRAY(entries, nr); for (i = 0; i < nr; i++) { if (fread(entries[i].oid.hash, hashsz, 1, stdin) != 1) - die("unable to read sha1 %u/%u", i, nr); + die(_("unable to read sha1 %u/%u"), i, nr); entries[i].oid.algo = hash_algo_by_ptr(the_hash_algo); } for (i = 0; i < nr; i++) if (fread(&entries[i].crc, 4, 1, stdin) != 1) - die("unable to read crc %u/%u", i, nr); + die(_("unable to read crc %u/%u"), i, nr); for (i = 0; i < nr; i++) if (fread(&entries[i].off, 4, 1, stdin) != 1) - die("unable to read 32b offset %u/%u", i, nr); + die(_("unable to read 32b offset %u/%u"), i, nr); for (i = 0; i < nr; i++) { uint64_t offset; uint32_t off = ntohl(entries[i].off); @@ -107,9 +110,9 @@ int cmd_show_index(int argc, } else { uint32_t off64[2]; if ((off & 0x7fffffff) != off64_nr) - die("inconsistent 64b offset index"); + die(_("inconsistent 64b offset index")); if (fread(off64, 8, 1, stdin) != 1) - die("unable to read 64b offset %u", off64_nr); + die(_("unable to read 64b offset %u"), off64_nr); offset = (((uint64_t)ntohl(off64[0])) << 32) | ntohl(off64[1]); off64_nr++; diff --git a/t/t8012-blame-colors.sh b/t/t8012-blame-colors.sh index 3d77352650ffb6..5562eba43613ec 100755 --- a/t/t8012-blame-colors.sh +++ b/t/t8012-blame-colors.sh @@ -28,6 +28,20 @@ test_expect_success 'colored blame colors contiguous lines' ' test_line_count = 3 H.expect ' +test_expect_success 'color lines becoming contiguous due to --ignore-rev' ' + mv hello.c hello.orig && + sed "s/ / /g" hello.c && + git add hello.c && + git commit -m"tabs to spaces" && + git -c color.blame.repeatedLines=yellow blame --color-lines --ignore-rev=HEAD hello.c >actual.raw && + test_decode_color actual && + grep "" darkened && + grep "(F" darkened > F.expect && + grep "(H" darkened > H.expect && + test_line_count = 2 F.expect && + test_line_count = 3 H.expect +' + test_expect_success 'color by age consistently colors old code' ' git blame --color-by-age hello.c >actual.raw && git -c blame.coloring=highlightRecent blame hello.c >actual.raw.2 && diff --git a/t/t9160-git-svn-preserve-empty-dirs.sh b/t/t9160-git-svn-preserve-empty-dirs.sh index 36c6b1a12ffd95..de32cf2542c617 100755 --- a/t/t9160-git-svn-preserve-empty-dirs.sh +++ b/t/t9160-git-svn-preserve-empty-dirs.sh @@ -61,15 +61,15 @@ test_expect_success 'clone svn repo with --preserve-empty-dirs' ' # "$GIT_REPO"/1 should only contain the placeholder file. test_expect_success 'directory empty from inception' ' - test -f "$GIT_REPO"/1/.gitignore && + test_path_is_file "$GIT_REPO"/1/.gitignore && test $(find "$GIT_REPO"/1 -type f | wc -l) = "1" ' # "$GIT_REPO"/2 and "$GIT_REPO"/3 should only contain the placeholder file. test_expect_success 'directory empty from subsequent svn commit' ' - test -f "$GIT_REPO"/2/.gitignore && + test_path_is_file "$GIT_REPO"/2/.gitignore && test $(find "$GIT_REPO"/2 -type f | wc -l) = "1" && - test -f "$GIT_REPO"/3/.gitignore && + test_path_is_file "$GIT_REPO"/3/.gitignore && test $(find "$GIT_REPO"/3 -type f | wc -l) = "1" ' @@ -77,7 +77,7 @@ test_expect_success 'directory empty from subsequent svn commit' ' # generated for every sub-directory at some point in the repo's history. test_expect_success 'add entry to previously empty directory' ' test $(find "$GIT_REPO"/4 -type f | wc -l) = "1" && - test -f "$GIT_REPO"/4/a/b/c/foo + test_path_is_file "$GIT_REPO"/4/a/b/c/foo ' # The HEAD~2 commit should not have introduced .gitignore placeholder files. @@ -102,14 +102,14 @@ test_expect_success 'clone svn repo with --placeholder-file specified' ' # "$GIT_REPO"/5/.placeholder should be a file, and non-empty. test_expect_success 'placeholder namespace conflict with file' ' - test -s "$GIT_REPO"/5/.placeholder + test_file_not_empty "$GIT_REPO"/5/.placeholder ' # "$GIT_REPO"/6/.placeholder should be a directory, and the "$GIT_REPO"/6 tree # should only contain one file: the placeholder. test_expect_success 'placeholder namespace conflict with directory' ' - test -d "$GIT_REPO"/6/.placeholder && - test -f "$GIT_REPO"/6/.placeholder/.placeholder && + test_path_is_dir "$GIT_REPO"/6/.placeholder && + test_path_is_file "$GIT_REPO"/6/.placeholder/.placeholder && test $(find "$GIT_REPO"/6 -type f | wc -l) = "1" ' @@ -133,19 +133,19 @@ test_expect_success 'second set of svn commits and rebase' ' # Check that --preserve-empty-dirs and --placeholder-file flag state # stays persistent over multiple invocations. -test_expect_success 'flag persistence during subsqeuent rebase' ' - test -f "$GIT_REPO"/7/.placeholder && +test_expect_success 'flag persistence during subsequent rebase' ' + test_path_is_file "$GIT_REPO"/7/.placeholder && test $(find "$GIT_REPO"/7 -type f | wc -l) = "1" ' # Check that placeholder files are properly removed when unnecessary, # even across multiple invocations. -test_expect_success 'placeholder list persistence during subsqeuent rebase' ' - test -f "$GIT_REPO"/1/file1.txt && +test_expect_success 'placeholder list persistence during subsequent rebase' ' + test_path_is_file "$GIT_REPO"/1/file1.txt && test $(find "$GIT_REPO"/1 -type f | wc -l) = "1" && - test -f "$GIT_REPO"/5/file1.txt && - test -f "$GIT_REPO"/5/.placeholder && + test_path_is_file "$GIT_REPO"/5/file1.txt && + test_path_is_file "$GIT_REPO"/5/.placeholder && test $(find "$GIT_REPO"/5 -type f | wc -l) = "2" '