Skip to content

Commit d1c7c27

Browse files
author
Junio C Hamano
committed
Merge branch 'maint-1.5.1' into maint
* maint-1.5.1: Fix git-svn to handle svn not reporting the md5sum of a file, and test. More echo "$user_message" fixes. Add tests for the last two fixes. git-commit: use printf '%s\n' instead of echo on user-supplied strings git-am: use printf instead of echo on user-supplied strings Documentation: Add definition of "evil merge" to GIT Glossary Replace the last 'dircache's by 'index' Documentation: Clean up links in GIT Glossary
2 parents c23290d + 20b3d20 commit d1c7c27

File tree

10 files changed

+115
-47
lines changed

10 files changed

+115
-47
lines changed

Documentation/git-ls-files.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ which case it outputs:
124124
detailed information on unmerged paths.
125125

126126
For an unmerged path, instead of recording a single mode/SHA1 pair,
127-
the dircache records up to three such pairs; one from tree O in stage
127+
the index records up to three such pairs; one from tree O in stage
128128
1, A in stage 2, and B in stage 3. This information can be used by
129129
the user (or the porcelain) to see what should eventually be recorded at the
130130
path. (see git-read-tree for more information on state)

Documentation/glossary.txt

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ GIT Glossary
1010
A bare repository is normally an appropriately
1111
named <<def_directory,directory>> with a `.git` suffix that does not
1212
have a locally checked-out copy of any of the files under
13-
<<def_revision,revision>> control. That is, all of the `git`
13+
revision control. That is, all of the `git`
1414
administrative and control files that would normally be present in the
1515
hidden `.git` sub-directory are directly present in the
1616
`repository.git` directory instead,
@@ -37,7 +37,7 @@ GIT Glossary
3737
[[def_chain]]chain::
3838
A list of objects, where each <<def_object,object>> in the list contains
3939
a reference to its successor (for example, the successor of a
40-
<<def_commit,commit>> could be one of its parents).
40+
<<def_commit,commit>> could be one of its <<def_parent,parents>>).
4141

4242
[[def_changeset]]changeset::
4343
BitKeeper/cvsps speak for "<<def_commit,commit>>". Since git does not
@@ -77,10 +77,10 @@ to point at the new commit.
7777

7878
[[def_commit_object]]commit object::
7979
An <<def_object,object>> which contains the information about a
80-
particular <<def_revision,revision>>, such as parents, committer,
80+
particular <<def_revision,revision>>, such as <<def_parent,parents>>, committer,
8181
author, date and the <<def_tree_object,tree object>> which corresponds
8282
to the top <<def_directory,directory>> of the stored
83-
<<def_revision,revision>>.
83+
revision.
8484

8585
[[def_core_git]]core git::
8686
Fundamental data structures and utilities of git. Exposes only limited
@@ -101,26 +101,30 @@ to point at the new commit.
101101

102102
[[def_detached_HEAD]]detached HEAD::
103103
Normally the <<def_HEAD,HEAD>> stores the name of a
104-
<<def_branch,branch>>. However, git also allows you to check
105-
out an arbitrary commit that isn't necessarily the tip of any
104+
<<def_branch,branch>>. However, git also allows you to <<def_checkout,check out>>
105+
an arbitrary <<def_commit,commit>> that isn't necessarily the tip of any
106106
particular branch. In this case HEAD is said to be "detached".
107107

108108
[[def_dircache]]dircache::
109-
You are *waaaaay* behind.
109+
You are *waaaaay* behind. See <<def_index,index>>.
110110

111111
[[def_directory]]directory::
112112
The list you get with "ls" :-)
113113

114114
[[def_dirty]]dirty::
115115
A <<def_working_tree,working tree>> is said to be "dirty" if
116-
it contains modifications which have not been committed to the current
116+
it contains modifications which have not been <<def_commit,committed>> to the current
117117
<<def_branch,branch>>.
118118

119119
[[def_ent]]ent::
120120
Favorite synonym to "<<def_tree-ish,tree-ish>>" by some total geeks. See
121121
`http://en.wikipedia.org/wiki/Ent_(Middle-earth)` for an in-depth
122122
explanation. Avoid this term, not to confuse people.
123123

124+
[[def_evil_merge]]evil merge::
125+
An evil merge is a <<def_merge,merge>> that introduces changes that
126+
do not appear in any <<def_parent,parent>>.
127+
124128
[[def_fast_forward]]fast forward::
125129
A fast-forward is a special type of <<def_merge,merge>> where you have a
126130
<<def_revision,revision>> and you are "merging" another
@@ -149,21 +153,21 @@ to point at the new commit.
149153
[[def_grafts]]grafts::
150154
Grafts enables two otherwise different lines of development to be joined
151155
together by recording fake ancestry information for commits. This way
152-
you can make git pretend the set of parents a <<def_commit,commit>> has
156+
you can make git pretend the set of <<def_parent,parents>> a <<def_commit,commit>> has
153157
is different from what was recorded when the commit was
154158
created. Configured via the `.git/info/grafts` file.
155159

156160
[[def_hash]]hash::
157161
In git's context, synonym to <<def_object_name,object name>>.
158162

159163
[[def_head]]head::
160-
A named reference to the <<def_commit,commit>> at the tip of a
164+
A <<def_ref,named reference>> to the <<def_commit,commit>> at the tip of a
161165
<<def_branch,branch>>. Heads are stored in
162166
`$GIT_DIR/refs/heads/`, except when using packed refs. (See
163167
gitlink:git-pack-refs[1].)
164168

165169
[[def_HEAD]]HEAD::
166-
The current branch. In more detail: Your <<def_working_tree,
170+
The current <<def_branch,branch>>. In more detail: Your <<def_working_tree,
167171
working tree>> is normally derived from the state of the tree
168172
referred to by HEAD. HEAD is a reference to one of the
169173
<<def_head,heads>> in your repository, except when using a
@@ -179,15 +183,15 @@ to point at the new commit.
179183
checking. Typically, the hooks allow for a command to be pre-verified
180184
and potentially aborted, and allow for a post-notification after the
181185
operation is done. The hook scripts are found in the
182-
`$GIT_DIR/hooks/` <<def_directory,directory>>, and are enabled by simply
186+
`$GIT_DIR/hooks/` directory, and are enabled by simply
183187
making them executable.
184188

185189
[[def_index]]index::
186190
A collection of files with stat information, whose contents are stored
187-
as objects. The index is a stored version of your working
188-
<<def_tree,tree>>. Truth be told, it can also contain a second, and even
189-
a third version of a <<def_working_tree,working tree>>, which are used
190-
when merging.
191+
as objects. The index is a stored version of your
192+
<<def_working_tree,working tree>>. Truth be told, it can also contain a second, and even
193+
a third version of a working tree, which are used
194+
when <<def_merge,merging>>.
191195

192196
[[def_index_entry]]index entry::
193197
The information regarding a particular file, stored in the
@@ -249,16 +253,16 @@ This commit is referred to as a "merge commit", or sometimes just a
249253
describing the type of an <<def_object,object>>.
250254

251255
[[def_octopus]]octopus::
252-
To <<def_merge,merge>> more than two branches. Also denotes an
256+
To <<def_merge,merge>> more than two <<def_branch,branches>>. Also denotes an
253257
intelligent predator.
254258

255259
[[def_origin]]origin::
256260
The default upstream <<def_repository,repository>>. Most projects have
257261
at least one upstream project which they track. By default
258262
'origin' is used for that purpose. New upstream updates
259-
will be fetched into remote tracking branches named
263+
will be fetched into remote <<def_tracking_branch,tracking branches>> named
260264
origin/name-of-upstream-branch, which you can see using
261-
"git <<def_branch,branch>> -r".
265+
"`git branch -r`".
262266

263267
[[def_pack]]pack::
264268
A set of objects which have been compressed into one file (to save space
@@ -327,7 +331,7 @@ This commit is referred to as a "merge commit", or sometimes just a
327331
`$GIT_DIR/refs/`.
328332

329333
[[def_refspec]]refspec::
330-
A <<def_refspec,refspec>> is used by <<def_fetch,fetch>> and
334+
A "refspec" is used by <<def_fetch,fetch>> and
331335
<<def_push,push>> to describe the mapping between remote
332336
<<def_ref,ref>> and local ref. They are combined with a colon in
333337
the format <src>:<dst>, preceded by an optional plus sign, +.
@@ -340,11 +344,12 @@ This commit is referred to as a "merge commit", or sometimes just a
340344
gitlink:git-push[1]
341345

342346
[[def_repository]]repository::
343-
A collection of refs together with an
347+
A collection of <<def_ref,refs>> together with an
344348
<<def_object_database,object database>> containing all objects
345349
which are <<def_reachable,reachable>> from the refs, possibly
346-
accompanied by meta data from one or more porcelains. A
347-
repository can share an object database with other repositories.
350+
accompanied by meta data from one or more <<def_porcelain,porcelains>>. A
351+
repository can share an object database with other repositories
352+
via <<def_alternate_object_database,alternates mechanism>>.
348353

349354
[[def_resolve]]resolve::
350355
The action of fixing up manually what a failed automatic
@@ -366,8 +371,8 @@ This commit is referred to as a "merge commit", or sometimes just a
366371
Synonym for <<def_object_name,object name>>.
367372

368373
[[def_shallow_repository]]shallow repository::
369-
A shallow repository has an incomplete
370-
history some of whose commits have parents cauterized away (in other
374+
A shallow <<def_repository,repository>> has an incomplete
375+
history some of whose <<def_commit,commits>> have <<def_parent,parents>> cauterized away (in other
371376
words, git is told to pretend that these commits do not have the
372377
parents, even though they are recorded in the <<def_commit_object,commit
373378
object>>). This is sometimes useful when you are interested only in the
@@ -385,7 +390,7 @@ This commit is referred to as a "merge commit", or sometimes just a
385390
command.
386391

387392
[[def_tag]]tag::
388-
A <<def_ref,ref>> pointing to a tag or
393+
A <<def_ref,ref>> pointing to a <<def_tag_object,tag>> or
389394
<<def_commit_object,commit object>>. In contrast to a <<def_head,head>>,
390395
a tag is not changed by a <<def_commit,commit>>. Tags (not
391396
<<def_tag_object,tag objects>>) are stored in `$GIT_DIR/refs/tags/`. A
@@ -398,8 +403,7 @@ This commit is referred to as a "merge commit", or sometimes just a
398403
An <<def_object,object>> containing a <<def_ref,ref>> pointing to
399404
another object, which can contain a message just like a
400405
<<def_commit_object,commit object>>. It can also contain a (PGP)
401-
signature, in which case it is called a "signed <<def_tag_object,tag
402-
object>>".
406+
signature, in which case it is called a "signed tag object".
403407

404408
[[def_topic_branch]]topic branch::
405409
A regular git <<def_branch,branch>> that is used by a developer to
@@ -418,7 +422,7 @@ This commit is referred to as a "merge commit", or sometimes just a
418422

419423
[[def_tree]]tree::
420424
Either a <<def_working_tree,working tree>>, or a <<def_tree_object,tree
421-
object>> together with the dependent blob and tree objects
425+
object>> together with the dependent <<def_blob_object,blob>> and tree objects
422426
(i.e. a stored representation of a working tree).
423427

424428
[[def_tree_object]]tree object::

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ void fill_filespec(struct diff_filespec *spec, const unsigned char *sha1,
13491349
}
13501350

13511351
/*
1352-
* Given a name and sha1 pair, if the dircache tells us the file in
1352+
* Given a name and sha1 pair, if the index tells us the file in
13531353
* the work tree has that object contents, return true, so that
13541354
* prepare_temp_file() does not have to inflate and extract.
13551355
*/

git-am.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ stop_here () {
1818

1919
stop_here_user_resolve () {
2020
if [ -n "$resolvemsg" ]; then
21-
echo "$resolvemsg"
21+
printf '%s\n' "$resolvemsg"
2222
stop_here $1
2323
fi
2424
cmdline=$(basename $0)
@@ -146,7 +146,7 @@ do
146146
git_apply_opt="$git_apply_opt $1"; shift ;;
147147

148148
--resolvemsg=*)
149-
resolvemsg=$(echo "$1" | sed -e "s/^--resolvemsg=//"); shift ;;
149+
resolvemsg=${1#--resolvemsg=}; shift ;;
150150

151151
--)
152152
shift; break ;;
@@ -331,7 +331,7 @@ do
331331
ADD_SIGNOFF=
332332
fi
333333
{
334-
echo "$SUBJECT"
334+
printf '%s\n' "$SUBJECT"
335335
if test -s "$dotest/msg-clean"
336336
then
337337
echo
@@ -394,7 +394,7 @@ do
394394
fi
395395

396396
echo
397-
echo "Applying '$SUBJECT'"
397+
printf 'Applying %s\n' "$SUBJECT"
398398
echo
399399

400400
case "$resolved" in

git-commit.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,12 @@ t,)
376376
rm -f "$TMP_INDEX"
377377
fi || exit
378378

379-
echo "$commit_only" |
379+
printf '%s\n' "$commit_only" |
380380
GIT_INDEX_FILE="$TMP_INDEX" \
381381
git-update-index --add --remove --stdin &&
382382

383383
save_index &&
384-
echo "$commit_only" |
384+
printf '%s\n' "$commit_only" |
385385
(
386386
GIT_INDEX_FILE="$NEXT_INDEX"
387387
export GIT_INDEX_FILE
@@ -432,7 +432,7 @@ fi
432432

433433
if test "$log_message" != ''
434434
then
435-
echo "$log_message"
435+
printf '%s\n' "$log_message"
436436
elif test "$logfile" != ""
437437
then
438438
if test "$logfile" = -
@@ -475,7 +475,7 @@ if test -f "$GIT_DIR/MERGE_HEAD" && test -z "$no_edit"; then
475475
echo "#"
476476
echo "# It looks like you may be committing a MERGE."
477477
echo "# If this is not correct, please remove the file"
478-
echo "# $GIT_DIR/MERGE_HEAD"
478+
printf '%s\n' "# $GIT_DIR/MERGE_HEAD"
479479
echo "# and try again"
480480
echo "#"
481481
fi >>"$GIT_DIR"/COMMIT_EDITMSG

git-merge.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ f,*)
328328
then
329329
echo "Wonderful."
330330
result_commit=$(
331-
echo "$merge_msg" |
331+
printf '%s\n' "$merge_msg" |
332332
git-commit-tree $result_tree -p HEAD -p "$1"
333333
) || exit
334334
finish "$result_commit" "In-index merge"
@@ -433,7 +433,7 @@ done
433433
if test '' != "$result_tree"
434434
then
435435
parents=$(git-show-branch --independent "$head" "$@" | sed -e 's/^/-p /')
436-
result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree $parents) || exit
436+
result_commit=$(printf '%s\n' "$merge_msg" | git-commit-tree $result_tree $parents) || exit
437437
finish "$result_commit" "Merge made by $wt_strategy."
438438
dropsave
439439
exit 0
@@ -472,7 +472,7 @@ else
472472
do
473473
echo $remote
474474
done >"$GIT_DIR/MERGE_HEAD"
475-
echo "$merge_msg" >"$GIT_DIR/MERGE_MSG"
475+
printf '%s\n' "$merge_msg" >"$GIT_DIR/MERGE_MSG"
476476
fi
477477

478478
if test "$merge_was_ok" = t

git-svn.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2477,7 +2477,7 @@ sub close_file {
24772477
$md5->addfile($fh);
24782478
my $got = $md5->hexdigest;
24792479
die "Checksum mismatch: $path\n",
2480-
"expected: $exp\n got: $got\n" if ($got ne $exp);
2480+
"expected: $exp\n got: $got\n" if (defined $exp && $got ne $exp);
24812481
sysseek($fh, 0, 0) or croak $!;
24822482
if ($fb->{mode_b} == 120000) {
24832483
sysread($fh, my $buf, 5) == 5 or croak $!;

git-tag.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ if [ "$annotate" ]; then
126126
echo "#" ) > "$GIT_DIR"/TAG_EDITMSG
127127
${VISUAL:-${EDITOR:-vi}} "$GIT_DIR"/TAG_EDITMSG || exit
128128
else
129-
echo "$message" >"$GIT_DIR"/TAG_EDITMSG
129+
printf '%s\n' "$message" >"$GIT_DIR"/TAG_EDITMSG
130130
fi
131131

132132
grep -v '^#' <"$GIT_DIR"/TAG_EDITMSG |

t/t4014-format-patch.sh

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ test_expect_success setup '
1616
1717
for i in 1 2 5 6 A B C 7 8 9 10; do echo "$i"; done >file &&
1818
git update-index file &&
19-
git commit -m "Side change #1" &&
19+
git commit -m "Side changes #1" &&
2020
2121
for i in D E F; do echo "$i"; done >>file &&
2222
git update-index file &&
23-
git commit -m "Side change #2" &&
23+
git commit -m "Side changes #2" &&
2424
git tag C2 &&
2525
2626
for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >file &&
2727
git update-index file &&
28-
git commit -m "Side change #3" &&
28+
git commit -m "Side changes #3 with \\n backslash-n in it." &&
2929
3030
git checkout master &&
3131
git diff-tree -p C2 | git apply --index &&
@@ -66,4 +66,23 @@ test_expect_success "format-patch --ignore-if-in-upstream result applies" '
6666
test $cnt = 2
6767
'
6868

69+
test_expect_success 'commit did not screw up the log message' '
70+
71+
git cat-file commit side | grep "^Side .* with .* backslash-n"
72+
73+
'
74+
75+
test_expect_success 'format-patch did not screw up the log message' '
76+
77+
grep "^Subject: .*Side changes #3 with .* backslash-n" patch0 &&
78+
grep "^Subject: .*Side changes #3 with .* backslash-n" patch1
79+
80+
'
81+
82+
test_expect_success 'replay did not screw up the log message' '
83+
84+
git cat-file commit rebuild-1 | grep "^Side .* with .* backslash-n"
85+
86+
'
87+
6988
test_done

0 commit comments

Comments
 (0)