WebKit Bugzilla
Attachment 362550 Details for
Bug 191332
: Add a git utility method that allows the caller to determine if a specific commitish is within a specified range of commits.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-191332-20190220150606.patch (text/plain), 2.79 KB, created by
Jer Noble
on 2019-02-20 15:06:07 PST
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2019-02-20 15:06:07 PST
Size:
2.79 KB
patch
obsolete
>Subversion Revision: 241820 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 96708e79bad6a035a8ef720dba9a8e63d295b9b1..9a88fbae32ea30a3ea952ec462e0f34fc9e3ebff 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,12 @@ >+2018-11-06 Jer Noble <jer.noble@apple.com> >+ >+ Add a git utility method that allows the caller to determine if a specific commitish is within a specified range of commits. >+ https://bugs.webkit.org/show_bug.cgi?id=191332 >+ >+ Reviewed by Dean Jackson. >+ >+ * Scripts/git-is-in-range: Added. >+ > 2019-02-20 Adrian Perez de Castro <aperez@igalia.com> > > [WPE][GTK] Enable support for CONTENT_EXTENSIONS >diff --git a/Tools/Scripts/git-is-in-range b/Tools/Scripts/git-is-in-range >new file mode 100755 >index 0000000000000000000000000000000000000000..b8b15bcf74bf44a906d94ffa248e4adc24033d53 >--- /dev/null >+++ b/Tools/Scripts/git-is-in-range >@@ -0,0 +1,65 @@ >+#!/bin/sh >+ >+USAGE="<commit range> <commit-ish> [commit-ish...]" >+LONG_USAGE="COMMIT RANGE >+ A commit range is usually specified as <older commitish>..<newer commitish> >+ >+COMMIT-ISH >+ A commit-ish is anything which can recursively be resolved to a commit; see 'gitglossary(7)'. >+ >+EXAMPLE >+ git is-in-range HEAD~4..HEAD~2 HEAD~5 HEAD~4 HEAD~3 HEAD~2 HEAD~1 >+ < HEAD~5 >+ = HEAD~4 >+ = HEAD~3 >+ = HEAD~2 >+ > HEAD~1 >+" >+SUBDIRECTORY_OK="1" >+ >+source "$(git --exec-path)/git-sh-setup" >+ >+function _is_in_range() { >+ range_start="$1" >+ range_end="$2" >+ >+ target_commit="$( git rev-parse --verify --quiet $3 )" >+ if [[ -z "$target_commit" ]]; then >+ die "Commit '$1' is not a valid commit" >+ fi >+ >+ target_commit_array=($target_commit) >+ if [[ "${#target_commit_array[@]}" -ne 1 ]]; then >+ die "Commit '$1' does not specify a single commit" >+ fi >+ >+ # Note that the provided range is inclusive, so decrement the range_end by one to make it exclusive. >+ is_ancestor_of_1=$( git merge-base --is-ancestor "$target_commit" "$range_start" ; echo $? ) >+ is_ancestor_of_2=$( git merge-base --is-ancestor "$target_commit" "$range_end~" ; echo $? ) >+ >+ if [[ "$is_ancestor_of_1" -ne "$is_ancestor_of_2" ]]; then >+ echo "=" >+ elif [[ "$is_ancestor_of_1" -ne 0 ]]; then >+ echo ">" >+ else >+ echo "<" >+ fi >+} >+ >+if [[ $# -ge "2" ]]; then >+ range_commits="$( git rev-parse --verify --quiet $1 )" >+ if [[ -z "$range_commits" ]]; then >+ die "Range '$2' is not a valid range" >+ fi >+ >+ range_commits_array=($range_commits) >+ if [[ "${#range_commits_array[@]}" != 2 ]]; then >+ die "Range '$2' does not specify a range" >+ fi >+ >+ for target_commit in "${@:2}"; do >+ echo $(_is_in_range "${range_commits_array[0]#^}" "${range_commits_array[1]#^}" "$target_commit") "$target_commit" >+ done >+else >+ usage >+fi
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 191332
:
354011
|
354013
|
354016
|
362549
| 362550