Skip to content

Commit 411e6cf

Browse files
committed
Merge branch 'maint-1.7.6' into maint
* maint-1.7.6: make the sample pre-commit hook script reject names with newlines, too git-read-tree.txt: update sparse checkout examples git-read-tree.txt: correct sparse-checkout and skip-worktree description git-read-tree.txt: language and typography fixes unpack-trees: print "Aborting" to stderr Documentation/git-update-index: refer to 'ls-files' Documentation: basic configuration of notes.rewriteRef
2 parents 982d1dc + 588150b commit 411e6cf

File tree

7 files changed

+46
-32
lines changed

7 files changed

+46
-32
lines changed

Documentation/config.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,8 @@ notes.rewriteRef::
14531453
You may also specify this configuration several times.
14541454
+
14551455
Does not have a default value; you must configure this variable to
1456-
enable note rewriting.
1456+
enable note rewriting. Set it to `refs/notes/commits` to enable
1457+
rewriting for the default commit notes.
14571458
+
14581459
This setting can be overridden with the `GIT_NOTES_REWRITE_REF`
14591460
environment variable, which must be a colon separated list of refs or

Documentation/git-read-tree.txt

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ OPTIONS
4747

4848
-i::
4949
Usually a merge requires the index file as well as the
50-
files in the working tree are up to date with the
50+
files in the working tree to be up to date with the
5151
current head commit, in order not to lose local
5252
changes. This flag disables the check with the working
5353
tree and is meant to be used when creating a merge of
@@ -71,21 +71,21 @@ OPTIONS
7171
--aggressive::
7272
Usually a three-way merge by 'git read-tree' resolves
7373
the merge for really trivial cases and leaves other
74-
cases unresolved in the index, so that Porcelains can
74+
cases unresolved in the index, so that porcelains can
7575
implement different merge policies. This flag makes the
76-
command to resolve a few more cases internally:
76+
command resolve a few more cases internally:
7777
+
7878
* when one side removes a path and the other side leaves the path
7979
unmodified. The resolution is to remove that path.
8080
* when both sides remove a path. The resolution is to remove that path.
81-
* when both sides adds a path identically. The resolution
81+
* when both sides add a path identically. The resolution
8282
is to add that path.
8383

8484
--prefix=<prefix>/::
8585
Keep the current index contents, and read the contents
86-
of named tree-ish under directory at `<prefix>`. The
86+
of the named tree-ish under the directory at `<prefix>`. The
8787
original index file cannot have anything at the path
88-
`<prefix>` itself, and have nothing in `<prefix>/`
88+
`<prefix>` itself, nor anything in the `<prefix>/`
8989
directory. Note that the `<prefix>/` value must end
9090
with a slash.
9191

@@ -379,45 +379,45 @@ have finished your work-in-progress), attempt the merge again.
379379
Sparse checkout
380380
---------------
381381

382-
"Sparse checkout" allows to sparsely populate working directory.
383-
It uses skip-worktree bit (see linkgit:git-update-index[1]) to tell
384-
Git whether a file on working directory is worth looking at.
382+
"Sparse checkout" allows populating the working directory sparsely.
383+
It uses the skip-worktree bit (see linkgit:git-update-index[1]) to tell
384+
Git whether a file in the working directory is worth looking at.
385385

386-
"git read-tree" and other merge-based commands ("git merge", "git
387-
checkout"...) can help maintaining skip-worktree bitmap and working
386+
'git read-tree' and other merge-based commands ('git merge', 'git
387+
checkout'...) can help maintaining the skip-worktree bitmap and working
388388
directory update. `$GIT_DIR/info/sparse-checkout` is used to
389-
define the skip-worktree reference bitmap. When "git read-tree" needs
390-
to update working directory, it will reset skip-worktree bit in index
389+
define the skip-worktree reference bitmap. When 'git read-tree' needs
390+
to update the working directory, it resets the skip-worktree bit in the index
391391
based on this file, which uses the same syntax as .gitignore files.
392-
If an entry matches a pattern in this file, skip-worktree will be
393-
set on that entry. Otherwise, skip-worktree will be unset.
392+
If an entry matches a pattern in this file, skip-worktree will not be
393+
set on that entry. Otherwise, skip-worktree will be set.
394394

395395
Then it compares the new skip-worktree value with the previous one. If
396-
skip-worktree turns from unset to set, it will add the corresponding
397-
file back. If it turns from set to unset, that file will be removed.
396+
skip-worktree turns from set to unset, it will add the corresponding
397+
file back. If it turns from unset to set, that file will be removed.
398398

399399
While `$GIT_DIR/info/sparse-checkout` is usually used to specify what
400-
files are in. You can also specify what files are _not_ in, using
401-
negate patterns. For example, to remove file "unwanted":
400+
files are in, you can also specify what files are _not_ in, using
401+
negate patterns. For example, to remove the file `unwanted`:
402402

403403
----------------
404-
*
404+
/*
405405
!unwanted
406406
----------------
407407

408-
Another tricky thing is fully repopulating working directory when you
408+
Another tricky thing is fully repopulating the working directory when you
409409
no longer want sparse checkout. You cannot just disable "sparse
410-
checkout" because skip-worktree are still in the index and you working
411-
directory is still sparsely populated. You should re-populate working
410+
checkout" because skip-worktree bits are still in the index and your working
411+
directory is still sparsely populated. You should re-populate the working
412412
directory with the `$GIT_DIR/info/sparse-checkout` file content as
413413
follows:
414414

415415
----------------
416-
*
416+
/*
417417
----------------
418418

419-
Then you can disable sparse checkout. Sparse checkout support in "git
420-
read-tree" and similar commands is disabled by default. You need to
419+
Then you can disable sparse checkout. Sparse checkout support in 'git
420+
read-tree' and similar commands is disabled by default. You need to
421421
turn `core.sparseCheckout` on in order to have sparse checkout
422422
support.
423423

Documentation/git-update-index.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,9 @@ tree files, you have to explicitly tell git about it by dropping
264264
"assume unchanged" bit, either before or after you modify them.
265265

266266
In order to set "assume unchanged" bit, use `--assume-unchanged`
267-
option. To unset, use `--no-assume-unchanged`.
267+
option. To unset, use `--no-assume-unchanged`. To see which files
268+
have the "assume unchanged" bit set, use `git ls-files -v`
269+
(see linkgit:git-ls-files[1]).
268270

269271
The command looks at `core.ignorestat` configuration variable. When
270272
this is true, paths updated with `git update-index paths...` and
@@ -363,7 +365,8 @@ ctime for marking files processed) (see linkgit:git-config[1]).
363365
SEE ALSO
364366
--------
365367
linkgit:git-config[1],
366-
linkgit:git-add[1]
368+
linkgit:git-add[1],
369+
linkgit:git-ls-files[1]
367370

368371
GIT
369372
---

t/t7607-merge-overwrite.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ error: The following untracked working tree files would be overwritten by merge:
107107
sub
108108
sub2
109109
Please move or remove them before you can merge.
110+
Aborting
110111
EOF
111112

112113
test_expect_success 'will not overwrite untracked file in leading path' '

t/t7609-merge-co-error-msgs.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ error: The following untracked working tree files would be overwritten by merge:
3232
three
3333
two
3434
Please move or remove them before you can merge.
35+
Aborting
3536
EOF
3637

3738
test_expect_success 'untracked files overwritten by merge (fast and non-fast forward)' '
@@ -56,6 +57,7 @@ Please, commit your changes or stash them before you can merge.
5657
error: The following untracked working tree files would be overwritten by merge:
5758
five
5859
Please move or remove them before you can merge.
60+
Aborting
5961
EOF
6062

6163
test_expect_success 'untracked files or local changes ovewritten by merge' '
@@ -71,6 +73,7 @@ error: Your local changes to the following files would be overwritten by checkou
7173
rep/one
7274
rep/two
7375
Please, commit your changes or stash them before you can switch branches.
76+
Aborting
7477
EOF
7578

7679
test_expect_success 'cannot switch branches because of local changes' '
@@ -92,6 +95,7 @@ error: Your local changes to the following files would be overwritten by checkou
9295
rep/one
9396
rep/two
9497
Please, commit your changes or stash them before you can switch branches.
98+
Aborting
9599
EOF
96100

97101
test_expect_success 'not uptodate file porcelain checkout error' '
@@ -105,6 +109,7 @@ error: Updating the following directories would lose untracked files in it:
105109
rep
106110
rep2
107111
112+
Aborting
108113
EOF
109114

110115
test_expect_success 'not_uptodate_dir porcelain checkout error' '

templates/hooks--pre-commit.sample

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@ fi
1818
# If you want to allow non-ascii filenames set this variable to true.
1919
allownonascii=$(git config hooks.allownonascii)
2020

21+
# Redirect output to stderr.
22+
exec 1>&2
23+
2124
# Cross platform projects tend to avoid non-ascii filenames; prevent
2225
# them from being added to the repository. We exploit the fact that the
2326
# printable range starts at the space character and ends with tilde.
2427
if [ "$allownonascii" != "true" ] &&
2528
# Note that the use of brackets around a tr range is ok here, (it's
2629
# even required, for portability to Solaris 10's /usr/bin/tr), since
2730
# the square bracket bytes happen to fall in the designated range.
28-
test "$(git diff --cached --name-only --diff-filter=A -z $against |
29-
LC_ALL=C tr -d '[ -~]\0')"
31+
test $(git diff --cached --name-only --diff-filter=A -z $against |
32+
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
3033
then
3134
echo "Error: Attempt to add a non-ascii file name."
3235
echo
@@ -43,4 +46,5 @@ then
4346
exit 1
4447
fi
4548

49+
# If there are whitespace errors, print the offending file names and fail.
4650
exec git diff-index --check --cached $against --

unpack-trees.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static void display_error_msgs(struct unpack_trees_options *o)
159159
string_list_clear(rejects, 0);
160160
}
161161
if (something_displayed)
162-
printf("Aborting\n");
162+
fprintf(stderr, "Aborting\n");
163163
}
164164

165165
/*

0 commit comments

Comments
 (0)