diff options
author | Andrew Cady <d@jerkface.net> | 2020-05-31 00:47:29 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2020-05-31 00:47:29 -0400 |
commit | a2df5b5ce7b62b6b6383199269135319eb9f6f30 (patch) | |
tree | b062139b9ecdf37a3e759917f467181f89a2efd6 | |
parent | de5aaa74d6cc7c18f87f563fa822be4adf4529c4 (diff) |
fix definition of ancestor
git believes that a hash is its own ancestor!
-rwxr-xr-x | dot/local/bin/git-ll-remote | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/dot/local/bin/git-ll-remote b/dot/local/bin/git-ll-remote index 88211c4..3cc4130 100755 --- a/dot/local/bin/git-ll-remote +++ b/dot/local/bin/git-ll-remote | |||
@@ -64,13 +64,23 @@ git_fetch() | |||
64 | have_ref "$hash" || git fetch "$remote" "$ref" | 64 | have_ref "$hash" || git fetch "$remote" "$ref" |
65 | } | 65 | } |
66 | 66 | ||
67 | is_ancestor() | ||
68 | { | ||
69 | if [ "$1" = "$2 " ] | ||
70 | then false | ||
71 | elif [ "$(git rev-parse "$1")" = "$(git rev-parse "$2")" ] | ||
72 | then false | ||
73 | else git merge-base --is-ancestor "$1" "$2" | ||
74 | fi | ||
75 | } | ||
76 | |||
67 | handle_hash_ref() | 77 | handle_hash_ref() |
68 | { | 78 | { |
69 | local hash="$1" ref="$2" | 79 | local hash="$1" ref="$2" |
70 | git_fetch "$hash" "$ref" || exit | 80 | git_fetch "$hash" "$ref" || exit |
71 | 81 | ||
72 | [ "$OPT_r" ] && set -- "$hash" HEAD || set -- HEAD "$hash" | 82 | [ "$OPT_r" ] && set -- "$hash" HEAD || set -- HEAD "$hash" |
73 | if [ "$OPT_a" ] || git merge-base --is-ancestor "$1" "$2" | 83 | if [ "$OPT_a" ] || is_ancestor "$1" "$2" |
74 | then | 84 | then |
75 | if [ ! "$OPT_q" -a "$listed" -eq 0 ] | 85 | if [ ! "$OPT_q" -a "$listed" -eq 0 ] |
76 | then | 86 | then |