Skip to content

Commit 0f36076

Browse files
committed
Merge branch 'maint-1.7.8' into maint
* maint-1.7.8: t/Makefile: Use $(sort ...) explicitly where needed gitweb: Fix actionless dispatch for non-existent objects i18n of multi-line advice messages
2 parents a460348 + d4c813d commit 0f36076

File tree

5 files changed

+34
-16
lines changed

5 files changed

+34
-16
lines changed

advice.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,21 @@ static struct {
2121

2222
void advise(const char *advice, ...)
2323
{
24+
struct strbuf buf = STRBUF_INIT;
2425
va_list params;
26+
const char *cp, *np;
2527

2628
va_start(params, advice);
27-
vreportf("hint: ", advice, params);
29+
strbuf_addf(&buf, advice, params);
2830
va_end(params);
31+
32+
for (cp = buf.buf; *cp; cp = np) {
33+
np = strchrnul(cp, '\n');
34+
fprintf(stderr, _("hint: %.*s\n"), (int)(np - cp), cp);
35+
if (*np)
36+
np++;
37+
}
38+
strbuf_release(&buf);
2939
}
3040

3141
int git_default_advice_config(const char *var, const char *value)
@@ -46,16 +56,15 @@ int git_default_advice_config(const char *var, const char *value)
4656
int error_resolve_conflict(const char *me)
4757
{
4858
error("'%s' is not possible because you have unmerged files.", me);
49-
if (advice_resolve_conflict) {
59+
if (advice_resolve_conflict)
5060
/*
5161
* Message used both when 'git commit' fails and when
5262
* other commands doing a merge do.
5363
*/
54-
advise("Fix them up in the work tree,");
55-
advise("and then use 'git add/rm <file>' as");
56-
advise("appropriate to mark resolution and make a commit,");
57-
advise("or use 'git commit -a'.");
58-
}
64+
advise(_("Fix them up in the work tree,\n"
65+
"and then use 'git add/rm <file>' as\n"
66+
"appropriate to mark resolution and make a commit,\n"
67+
"or use 'git commit -a'."));
5968
return -1;
6069
}
6170

builtin/revert.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,10 @@ static void print_advice(int show_hint)
343343
return;
344344
}
345345

346-
if (show_hint) {
347-
advise("after resolving the conflicts, mark the corrected paths");
348-
advise("with 'git add <paths>' or 'git rm <paths>'");
349-
advise("and commit the result with 'git commit'");
350-
}
346+
if (show_hint)
347+
advise(_("after resolving the conflicts, mark the corrected paths\n"
348+
"with 'git add <paths>' or 'git rm <paths>'\n"
349+
"and commit the result with 'git commit'"));
351350
}
352351

353352
static void write_message(struct strbuf *msgbuf, const char *filename)

gitweb/gitweb.perl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,8 +1132,10 @@ sub dispatch {
11321132
if (!defined $action) {
11331133
if (defined $hash) {
11341134
$action = git_get_type($hash);
1135+
$action or die_error(404, "Object does not exist");
11351136
} elsif (defined $hash_base && defined $file_name) {
11361137
$action = git_get_type("$hash_base:$file_name");
1138+
$action or die_error(404, "File or directory does not exist");
11371139
} elsif (defined $project) {
11381140
$action = 'summary';
11391141
} else {
@@ -2400,7 +2402,7 @@ sub get_feed_info {
24002402
return unless (defined $project);
24012403
# some views should link to OPML, or to generic project feed,
24022404
# or don't have specific feed yet (so they should use generic)
2403-
return if ($action =~ /^(?:tags|heads|forks|tag|search)$/x);
2405+
return if (!$action || $action =~ /^(?:tags|heads|forks|tag|search)$/x);
24042406

24052407
my $branch;
24062408
# branches refs uses 'refs/heads/' prefix (fullname) to differentiate

t/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ DEFAULT_TEST_TARGET ?= test
1717
# Shell quote;
1818
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
1919

20-
T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
21-
TSVN = $(wildcard t91[0-9][0-9]-*.sh)
22-
TGITWEB = $(wildcard t95[0-9][0-9]-*.sh)
20+
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
21+
TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
22+
TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh))
2323

2424
all: $(DEFAULT_TEST_TARGET)
2525

t/t9500-gitweb-standalone-no-errors.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,14 @@ test_expect_success \
474474
'path_info: project/branch:dir/' \
475475
'gitweb_run "" "/.git/master:foo/"'
476476

477+
test_expect_success \
478+
'path_info: project/branch (non-existent)' \
479+
'gitweb_run "" "/.git/non-existent"'
480+
481+
test_expect_success \
482+
'path_info: project/branch:filename (non-existent branch)' \
483+
'gitweb_run "" "/.git/non-existent:non-existent"'
484+
477485
test_expect_success \
478486
'path_info: project/branch:file (non-existent)' \
479487
'gitweb_run "" "/.git/master:non-existent"'

0 commit comments

Comments
 (0)