Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

git-get is-same-object exits true iff two refs refer to the same object

  • Loading branch information...
commit 9115f9a50b639145bc266757d02deb840b186c9e 1 parent 468cee0
@mjdominus authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 git-get
View
9 git-get
@@ -63,9 +63,14 @@ sub is_remote {
sub is_ancestor_of {
my ($A, $B) = @_;
+ is_same_object($A, _run("git", "merge-base", $A, $B));
+}
+
+sub is_same_object {
+ my ($A, $B) = @_;
$A = _run("git", "rev-parse", $A);
- my $merge_base = _run("git", "merge-base", $A, $B);
- exit($A eq $merge_base ? 0 : 1);
+ $B = _run("git", "rev-parse", $B);
+ exit($A eq $B ? 0 : 1);
}
sub _run {
Please sign in to comment.
Something went wrong with that request. Please try again.