Skip to content

Commit f0911b9

Browse files
committed
Merge branch 'maint-1.7.6' into maint
* maint-1.7.6: notes_merge_commit(): do not pass temporary buffer to other function gitweb: Fix links to lines in blobs when javascript-actions are enabled mergetool: no longer need to save standard input mergetool: Use args as pathspec to unmerged files t9159-*.sh: skip for mergeinfo test for svn <= 1.4 date.c: Support iso8601 timezone formats remote: only update remote-tracking branch if updating refspec remote rename: warn when refspec was not updated remote: "rename o foo" should not rename ref "origin/bar" remote: write correct fetch spec when renaming remote 'remote'
2 parents 411e6cf + 8280baf commit f0911b9

File tree

10 files changed

+166
-93
lines changed

10 files changed

+166
-93
lines changed

Documentation/git-mergetool.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ Use `git mergetool` to run one of several merge utilities to resolve
1717
merge conflicts. It is typically run after 'git merge'.
1818

1919
If one or more <file> parameters are given, the merge tool program will
20-
be run to resolve differences on each file. If no <file> names are
21-
specified, 'git mergetool' will run the merge tool program on every file
22-
with merge conflicts.
20+
be run to resolve differences on each file (skipping those without
21+
conflicts). Specifying a directory will include all unresolved files in
22+
that path. If no <file> names are specified, 'git mergetool' will run
23+
the merge tool program on every file with merge conflicts.
2324

2425
OPTIONS
2526
-------

builtin/remote.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ static int read_remote_branches(const char *refname,
570570
unsigned char orig_sha1[20];
571571
const char *symref;
572572

573-
strbuf_addf(&buf, "refs/remotes/%s", rename->old);
573+
strbuf_addf(&buf, "refs/remotes/%s/", rename->old);
574574
if (!prefixcmp(refname, buf.buf)) {
575575
item = string_list_append(rename->remote_branches, xstrdup(refname));
576576
symref = resolve_ref(refname, orig_sha1, 1, &flag);
@@ -621,10 +621,11 @@ static int mv(int argc, const char **argv)
621621
OPT_END()
622622
};
623623
struct remote *oldremote, *newremote;
624-
struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT, buf3 = STRBUF_INIT;
624+
struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT, buf3 = STRBUF_INIT,
625+
old_remote_context = STRBUF_INIT;
625626
struct string_list remote_branches = STRING_LIST_INIT_NODUP;
626627
struct rename_info rename;
627-
int i;
628+
int i, refspec_updated = 0;
628629

629630
if (argc != 3)
630631
usage_with_options(builtin_remote_rename_usage, options);
@@ -659,15 +660,25 @@ static int mv(int argc, const char **argv)
659660
strbuf_addf(&buf, "remote.%s.fetch", rename.new);
660661
if (git_config_set_multivar(buf.buf, NULL, NULL, 1))
661662
return error("Could not remove config section '%s'", buf.buf);
663+
strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old);
662664
for (i = 0; i < oldremote->fetch_refspec_nr; i++) {
663665
char *ptr;
664666

665667
strbuf_reset(&buf2);
666668
strbuf_addstr(&buf2, oldremote->fetch_refspec[i]);
667-
ptr = strstr(buf2.buf, rename.old);
668-
if (ptr)
669-
strbuf_splice(&buf2, ptr-buf2.buf, strlen(rename.old),
670-
rename.new, strlen(rename.new));
669+
ptr = strstr(buf2.buf, old_remote_context.buf);
670+
if (ptr) {
671+
refspec_updated = 1;
672+
strbuf_splice(&buf2,
673+
ptr-buf2.buf + strlen(":refs/remotes/"),
674+
strlen(rename.old), rename.new,
675+
strlen(rename.new));
676+
} else
677+
warning("Not updating non-default fetch respec\n"
678+
"\t%s\n"
679+
"\tPlease update the configuration manually if necessary.",
680+
buf2.buf);
681+
671682
if (git_config_set_multivar(buf.buf, buf2.buf, "^$", 0))
672683
return error("Could not append '%s'", buf.buf);
673684
}
@@ -685,6 +696,9 @@ static int mv(int argc, const char **argv)
685696
}
686697
}
687698

699+
if (!refspec_updated)
700+
return 0;
701+
688702
/*
689703
* First remove symrefs, then rename the rest, finally create
690704
* the new symrefs.

date.c

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -552,23 +552,35 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
552552
static int match_tz(const char *date, int *offp)
553553
{
554554
char *end;
555-
int offset = strtoul(date+1, &end, 10);
556-
int min, hour;
557-
int n = end - date - 1;
555+
int hour = strtoul(date + 1, &end, 10);
556+
int n = end - (date + 1);
557+
int min = 0;
558558

559-
min = offset % 100;
560-
hour = offset / 100;
559+
if (n == 4) {
560+
/* hhmm */
561+
min = hour % 100;
562+
hour = hour / 100;
563+
} else if (n != 2) {
564+
min = 99; /* random crap */
565+
} else if (*end == ':') {
566+
/* hh:mm? */
567+
min = strtoul(end + 1, &end, 10);
568+
if (end - (date + 1) != 5)
569+
min = 99; /* random crap */
570+
} /* otherwise we parsed "hh" */
561571

562572
/*
563-
* Don't accept any random crap.. At least 3 digits, and
564-
* a valid minute. We might want to check that the minutes
565-
* are divisible by 30 or something too.
573+
* Don't accept any random crap. Even though some places have
574+
* offset larger than 12 hours (e.g. Pacific/Kiritimati is at
575+
* UTC+14), there is something wrong if hour part is much
576+
* larger than that. We might also want to check that the
577+
* minutes are divisible by 15 or something too. (Offset of
578+
* Kathmandu, Nepal is UTC+5:45)
566579
*/
567-
if (min < 60 && n > 2) {
568-
offset = hour*60+min;
580+
if (min < 60 && hour < 24) {
581+
int offset = hour * 60 + min;
569582
if (*date == '-')
570583
offset = -offset;
571-
572584
*offp = offset;
573585
}
574586
return end - date;

git-mergetool.sh

Lines changed: 27 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -342,64 +342,42 @@ merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo fa
342342

343343
last_status=0
344344
rollup_status=0
345-
rerere=false
346-
347-
files_to_merge() {
348-
if test "$rerere" = true
349-
then
350-
git rerere remaining
351-
else
352-
git ls-files -u | sed -e 's/^[^ ]* //' | sort -u
353-
fi
354-
}
355-
345+
files=
356346

357347
if test $# -eq 0 ; then
358348
cd_to_toplevel
359349

360350
if test -e "$GIT_DIR/MERGE_RR"
361351
then
362-
rerere=true
363-
fi
364-
365-
files=$(files_to_merge)
366-
if test -z "$files" ; then
367-
echo "No files need merging"
368-
exit 0
352+
files=$(git rerere remaining)
353+
else
354+
files=$(git ls-files -u | sed -e 's/^[^ ]* //' | sort -u)
369355
fi
356+
else
357+
files=$(git ls-files -u -- "$@" | sed -e 's/^[^ ]* //' | sort -u)
358+
fi
370359

371-
# Save original stdin
372-
exec 3<&0
360+
if test -z "$files" ; then
361+
echo "No files need merging"
362+
exit 0
363+
fi
373364

374-
printf "Merging:\n"
375-
printf "$files\n"
365+
printf "Merging:\n"
366+
printf "$files\n"
376367

377-
files_to_merge |
378-
while IFS= read i
379-
do
380-
if test $last_status -ne 0; then
381-
prompt_after_failed_merge <&3 || exit 1
382-
fi
383-
printf "\n"
384-
merge_file "$i" <&3
385-
last_status=$?
386-
if test $last_status -ne 0; then
387-
rollup_status=1
388-
fi
389-
done
390-
else
391-
while test $# -gt 0; do
392-
if test $last_status -ne 0; then
393-
prompt_after_failed_merge || exit 1
394-
fi
395-
printf "\n"
396-
merge_file "$1"
397-
last_status=$?
398-
if test $last_status -ne 0; then
399-
rollup_status=1
400-
fi
401-
shift
402-
done
403-
fi
368+
IFS='
369+
'
370+
for i in $files
371+
do
372+
if test $last_status -ne 0; then
373+
prompt_after_failed_merge || exit 1
374+
fi
375+
printf "\n"
376+
merge_file "$i"
377+
last_status=$?
378+
if test $last_status -ne 0; then
379+
rollup_status=1
380+
fi
381+
done
404382

405383
exit $rollup_status

gitweb/static/js/javascript-detection.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* and other reasons to not add 'js=1' param at the end of link
1717
* @constant
1818
*/
19-
var jsExceptionsRe = /[;?]js=[01]$/;
19+
var jsExceptionsRe = /[;?]js=[01](#.*)?$/;
2020

2121
/**
2222
* Add '?js=1' or ';js=1' to the end of every link in the document
@@ -33,9 +33,9 @@ function fixLinks() {
3333
var allLinks = document.getElementsByTagName("a") || document.links;
3434
for (var i = 0, len = allLinks.length; i < len; i++) {
3535
var link = allLinks[i];
36-
if (!jsExceptionsRe.test(link)) { // =~ /[;?]js=[01]$/;
37-
link.href +=
38-
(link.href.indexOf('?') === -1 ? '?' : ';') + 'js=1';
36+
if (!jsExceptionsRe.test(link)) {
37+
link.href = link.href.replace(/(#|$)/,
38+
(link.href.indexOf('?') === -1 ? '?' : ';') + 'js=1$1');
3939
}
4040
}
4141
}

notes-merge.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ int notes_merge_commit(struct notes_merge_options *o,
680680
* Finally store the new commit object SHA1 into 'result_sha1'.
681681
*/
682682
struct dir_struct dir;
683-
const char *path = git_path(NOTES_MERGE_WORKTREE "/");
683+
char *path = xstrdup(git_path(NOTES_MERGE_WORKTREE "/"));
684684
int path_len = strlen(path), i;
685685
const char *msg = strstr(partial_commit->buffer, "\n\n");
686686

@@ -720,6 +720,7 @@ int notes_merge_commit(struct notes_merge_options *o,
720720
result_sha1);
721721
OUTPUT(o, 4, "Finalized notes merge commit: %s",
722722
sha1_to_hex(result_sha1));
723+
free(path);
723724
return 0;
724725
}
725726

t/t0006-date.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ check_parse 2008-02 bad
4040
check_parse 2008-02-14 bad
4141
check_parse '2008-02-14 20:30:45' '2008-02-14 20:30:45 +0000'
4242
check_parse '2008-02-14 20:30:45 -0500' '2008-02-14 20:30:45 -0500'
43+
check_parse '2008-02-14 20:30:45 -0015' '2008-02-14 20:30:45 -0015'
44+
check_parse '2008-02-14 20:30:45 -5' '2008-02-14 20:30:45 +0000'
45+
check_parse '2008-02-14 20:30:45 -5:' '2008-02-14 20:30:45 +0000'
46+
check_parse '2008-02-14 20:30:45 -05' '2008-02-14 20:30:45 -0500'
47+
check_parse '2008-02-14 20:30:45 -:30' '2008-02-14 20:30:45 +0000'
48+
check_parse '2008-02-14 20:30:45 -05:00' '2008-02-14 20:30:45 -0500'
4349
check_parse '2008-02-14 20:30:45' '2008-02-14 20:30:45 -0500' EST5
4450

4551
check_approxidate() {

t/t5505-remote.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,37 @@ test_expect_success 'rename a remote' '
631631
632632
'
633633

634+
test_expect_success 'rename does not update a non-default fetch refspec' '
635+
636+
git clone one four.one &&
637+
(cd four.one &&
638+
git config remote.origin.fetch +refs/heads/*:refs/heads/origin/* &&
639+
git remote rename origin upstream &&
640+
test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/heads/origin/*" &&
641+
git rev-parse -q origin/master)
642+
643+
'
644+
645+
test_expect_success 'rename a remote with name part of fetch spec' '
646+
647+
git clone one four.two &&
648+
(cd four.two &&
649+
git remote rename origin remote &&
650+
git remote rename remote upstream &&
651+
test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/remotes/upstream/*")
652+
653+
'
654+
655+
test_expect_success 'rename a remote with name prefix of other remote' '
656+
657+
git clone one four.three &&
658+
(cd four.three &&
659+
git remote add o git://example.com/repo.git &&
660+
git remote rename o upstream &&
661+
test "$(git rev-parse origin/master)" = "$(git rev-parse master)")
662+
663+
'
664+
634665
cat > remotes_origin << EOF
635666
URL: $(pwd)/one
636667
Push: refs/heads/master:refs/heads/upstream

0 commit comments

Comments
 (0)