Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-02-06 01:26:18 +0300
committerJunio C Hamano <gitster@pobox.com>2019-02-06 01:26:18 +0300
commitd6cc13602bdd61d6f12a5fc10b2d342033502afa (patch)
treed8a7aa0ce6507e10974bb3c807f7e36aee52bc40 /builtin
parent5db562704ca1541f1ace2510f830ea1370ce60e4 (diff)
parentdc40b24df47af35f486e2c5139121b6cddc2dcb9 (diff)
Merge branch 'nd/fetch-compact-update'
"git fetch" output cleanup. * nd/fetch-compact-update: fetch: prefer suffix substitution in compact fetch.output
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fetch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 61a443031d..39c4210610 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -629,9 +629,14 @@ static int find_and_replace(struct strbuf *haystack,
const char *needle,
const char *placeholder)
{
- const char *p = strstr(haystack->buf, needle);
+ const char *p = NULL;
int plen, nlen;
+ nlen = strlen(needle);
+ if (ends_with(haystack->buf, needle))
+ p = haystack->buf + haystack->len - nlen;
+ else
+ p = strstr(haystack->buf, needle);
if (!p)
return 0;
@@ -639,7 +644,6 @@ static int find_and_replace(struct strbuf *haystack,
return 0;
plen = strlen(p);
- nlen = strlen(needle);
if (plen > nlen && p[nlen] != '/')
return 0;