From 296c6b9ee85209c0ce375717e30686545baea107 Mon Sep 17 00:00:00 2001 From: Carlos Maiolino Date: Sat, 2 May 2026 14:09:27 +0200 Subject: Save new changes --- maintainer_old/djwong-git | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 maintainer_old/djwong-git (limited to 'maintainer_old/djwong-git') diff --git a/maintainer_old/djwong-git b/maintainer_old/djwong-git new file mode 100755 index 0000000..3f1d80c --- /dev/null +++ b/maintainer_old/djwong-git @@ -0,0 +1,41 @@ +#!/bin/bash + +# Support routines for git commands + +commit_range_from_arg() { + local arg="$1" + + if [ -z "${arg}" ]; then + # If we didn't get a commit range argument and this is a + # tracking branch, pick all the commits since this branch + # deviated. + base="$(git branch-remote 2>/dev/null)" + if [ -n "${base}" ]; then + echo "${base}..HEAD" + return 0 + fi + + return 1 + fi + + # If the argument already has a range in it, we're done. + if echo "${arg}" | grep -q '\.\.'; then + echo "${arg}" + return 0 + fi + + + # If the argument is a tracking branch, pick all the commits since that + # branch deviated. + base="$(git branch-remote "${arg}" 2>/dev/null)" + if [ -n "${base}" ]; then + echo "${base}..${arg}" + return 0 + fi + + # If we didn't get something that looks like a range, only select one + # commit because git rev-list run against a non-range lists everything + # from whatever it finds all the way back to the beginning. + echo "${arg}^1..${arg}" + return 0 +} -- cgit v1.2.3