Skip to content

Commit f44bc33

Browse files
committed
Sync with 1.5.6.5
2 parents d96ca27 + 781c183 commit f44bc33

File tree

9 files changed

+80
-15
lines changed

9 files changed

+80
-15
lines changed

Documentation/RelNotes-1.5.6.5.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Fixes since v1.5.6.4
66

77
* "git cvsimport" used to spit out "UNKNOWN LINE..." diagnostics to stdout.
88

9+
* "git commit -F filename" and "git tag -F filename" run from subdirectories
10+
did not read the right file.
11+
912
* "git init --template=" with blank "template" parameter linked files
1013
under root directories to .git, which was a total nonsense. Instead, it
1114
means "I do not want to use anything from the template directory".
@@ -24,9 +27,3 @@ Fixes since v1.5.6.4
2427
header properly.
2528

2629
Contains other various documentation fixes.
27-
28-
--
29-
exec >/var/tmp/1
30-
echo O=$(git describe maint)
31-
O=v1.5.6.4-26-g2b6ca6d
32-
git shortlog --no-merges $O..maint

Documentation/git-diff-tree.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ include::diff-options.txt[]
4949
--stdin::
5050
When '--stdin' is specified, the command does not take
5151
<tree-ish> arguments from the command line. Instead, it
52-
reads either one <commit> or a pair of <tree-ish>
52+
reads either one <commit> or a list of <commit>
5353
separated with a single space from its standard input.
5454
+
5555
When a single commit is given on one line of such input, it compares
5656
the commit with its parents. The following flags further affects its
57-
behavior. This does not apply to the case where two <tree-ish>
58-
separated with a single space are given.
57+
behavior. The remaining commits, when given, are used as if they are
58+
parents of the first commit.
5959

6060
-m::
6161
By default, 'git-diff-tree --stdin' does not show

Documentation/git.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ unreleased) version of git, that is available from 'master'
4343
branch of the `git.git` repository.
4444
Documentation for older releases are available here:
4545

46-
* link:v1.5.6.4/git.html[documentation for release 1.5.6.4]
46+
* link:v1.5.6.5/git.html[documentation for release 1.5.6.5]
4747

4848
* release notes for
49+
link:RelNotes-1.5.6.5.txt[1.5.6.5],
4950
link:RelNotes-1.5.6.4.txt[1.5.6.4],
5051
link:RelNotes-1.5.6.3.txt[1.5.6.3],
5152
link:RelNotes-1.5.6.2.txt[1.5.6.2],

builtin-commit.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static enum {
4646
COMMIT_PARTIAL,
4747
} commit_style;
4848

49-
static char *logfile, *force_author;
49+
static const char *logfile, *force_author;
5050
static const char *template_file;
5151
static char *edit_message, *use_message;
5252
static char *author_name, *author_email, *author_date;
@@ -711,11 +711,14 @@ static int message_is_empty(struct strbuf *sb, int start)
711711
}
712712

713713
static int parse_and_validate_options(int argc, const char *argv[],
714-
const char * const usage[])
714+
const char * const usage[],
715+
const char *prefix)
715716
{
716717
int f = 0;
717718

718719
argc = parse_options(argc, argv, builtin_commit_options, usage, 0);
720+
logfile = parse_options_fix_filename(prefix, logfile);
721+
template_file = parse_options_fix_filename(prefix, template_file);
719722

720723
if (logfile || message.len || use_message)
721724
use_editor = 0;
@@ -836,7 +839,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
836839
if (wt_status_use_color == -1)
837840
wt_status_use_color = git_use_color_default;
838841

839-
argc = parse_and_validate_options(argc, argv, builtin_status_usage);
842+
argc = parse_and_validate_options(argc, argv, builtin_status_usage, prefix);
840843

841844
index_file = prepare_index(argc, argv, prefix);
842845

@@ -929,7 +932,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
929932

930933
git_config(git_commit_config, NULL);
931934

932-
argc = parse_and_validate_options(argc, argv, builtin_commit_usage);
935+
argc = parse_and_validate_options(argc, argv, builtin_commit_usage, prefix);
933936

934937
index_file = prepare_index(argc, argv, prefix);
935938

builtin-tag.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
346346

347347
int annotate = 0, sign = 0, force = 0, lines = 0,
348348
list = 0, delete = 0, verify = 0;
349-
char *msgfile = NULL, *keyid = NULL;
349+
const char *msgfile = NULL, *keyid = NULL;
350350
struct msg_arg msg = { 0, STRBUF_INIT };
351351
struct option options[] = {
352352
OPT_BOOLEAN('l', NULL, &list, "list tag names"),
@@ -372,6 +372,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
372372
git_config(git_tag_config, NULL);
373373

374374
argc = parse_options(argc, argv, options, git_tag_usage, 0);
375+
msgfile = parse_options_fix_filename(prefix, msgfile);
375376

376377
if (keyid) {
377378
sign = 1;

parse-options.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,3 +483,15 @@ int parse_opt_approxidate_cb(const struct option *opt, const char *arg,
483483
*(unsigned long *)(opt->value) = approxidate(arg);
484484
return 0;
485485
}
486+
487+
/*
488+
* This should really be OPTION_FILENAME type as a part of
489+
* parse_options that take prefix to do this while parsing.
490+
*/
491+
extern const char *parse_options_fix_filename(const char *prefix, const char *file)
492+
{
493+
if (!file || !prefix || is_absolute_path(file) || !strcmp("-", file))
494+
return file;
495+
return prefix_filename(prefix, strlen(prefix), file);
496+
}
497+

parse-options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,6 @@ extern int parse_opt_approxidate_cb(const struct option *, const char *, int);
159159
"use <n> digits to display SHA-1s", \
160160
PARSE_OPT_OPTARG, &parse_opt_abbrev_cb, 0 }
161161

162+
extern const char *parse_options_fix_filename(const char *prefix, const char *file);
163+
162164
#endif

t/t7004-tag.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,4 +1070,24 @@ test_expect_success \
10701070
test_cmp expect actual
10711071
'
10721072
1073+
test_expect_success 'filename for the message is relative to cwd' '
1074+
mkdir subdir &&
1075+
echo "Tag message in top directory" >msgfile-5 &&
1076+
echo "Tag message in sub directory" >subdir/msgfile-5 &&
1077+
(
1078+
cd subdir &&
1079+
git tag -a -F msgfile-5 tag-from-subdir
1080+
) &&
1081+
git cat-file tag tag-from-subdir | grep "in sub directory"
1082+
'
1083+
1084+
test_expect_success 'filename for the message is relative to cwd' '
1085+
echo "Tag message in sub directory" >subdir/msgfile-6 &&
1086+
(
1087+
cd subdir &&
1088+
git tag -a -F msgfile-6 tag-from-subdir-2
1089+
) &&
1090+
git cat-file tag tag-from-subdir-2 | grep "in sub directory"
1091+
'
1092+
10731093
test_done

t/t7500-commit.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,33 @@ test_expect_success '--signoff' '
138138
diff expect output
139139
'
140140

141+
test_expect_success 'commit message from file (1)' '
142+
mkdir subdir &&
143+
echo "Log in top directory" >log &&
144+
echo "Log in sub directory" >subdir/log &&
145+
(
146+
cd subdir &&
147+
git commit --allow-empty -F log
148+
) &&
149+
commit_msg_is "Log in sub directory"
150+
'
151+
152+
test_expect_success 'commit message from file (2)' '
153+
rm -f log &&
154+
echo "Log in sub directory" >subdir/log &&
155+
(
156+
cd subdir &&
157+
git commit --allow-empty -F log
158+
) &&
159+
commit_msg_is "Log in sub directory"
160+
'
161+
162+
test_expect_success 'commit message from stdin' '
163+
(
164+
cd subdir &&
165+
echo "Log with foo word" | git commit --allow-empty -F -
166+
) &&
167+
commit_msg_is "Log with foo word"
168+
'
169+
141170
test_done

0 commit comments

Comments
 (0)