Skip to content

Don't show path to script - #27

Merged
mernst merged 4 commits into
mainfrom
script-name
Jan 13, 2026
Merged

mernst merged 4 commits into
mainfrom
script-name

Conversation

@mernst

@mernst mernst commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Jan 12, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@mernst has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 57 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 9df9dfd and 2f449e1.

📒 Files selected for processing (1)
  • git-clone-related
📝 Walkthrough

Walkthrough

The changes affect two shell scripts. In the first script, the usage output message now displays the script's basename instead of the literal $0 variable reference when invoked with insufficient arguments. In the second script, a local variable used for storing the script name is renamed from script to SCRIPT_NAME, with corresponding updates applied to all references within error and usage messages. Both modifications are purely presentational and do not alter the functional behavior or argument parsing logic of either script.

Possibly related PRs

  • Variable renaming #26: Modifies script-name/usage and error-message handling, renaming script-name variables and changing how the script name is printed.
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
git-find-fork (1)

23-33: git-find-fork fails silently if wget is unavailable, incorrectly falling back to the upstream repository — add a dependency check or fallback.

The script uses wget -q --spider to probe fork existence (line 26) without checking whether wget is installed. If the probe fails (missing binary or network error), the conditional silently returns false, causing the script to use UPSTREAM_ORG instead of ORG. This matches the observed test failure: fork exists but is not selected because the probe command fails.

To fix, either:

  1. Fail explicitly if neither wget nor curl exists
  2. Check for wget, fall back to curl -fsI if available, or fail with a clear error
One possible fix (dependency check + curl fallback)
-# export GITEXISTS="git ls-remote"
-# export GITEXISTS="wget -q --spider"
-export GITEXISTS="wget -q --spider"
+if command -v wget >/dev/null 2>&1; then
+  gitexists() { wget -q --spider "$1"; }
+elif command -v curl >/dev/null 2>&1; then
+  gitexists() { curl -fsI "$1" >/dev/null; }
+else
+  echo "Error: need either wget or curl to probe GitHub URLs" >&2
+  exit 2
+fi
 
-if (${GITEXISTS} "https://github.com/${ORG}/${REPONAME}.git" > /dev/null); then
+if gitexists "https://github.com/${ORG}/${REPONAME}.git"; then
   OWNER="${ORG}"
 else
   OWNER="${UPSTREAM_ORG}"
 fi
🤖 Fix all issues with AI agents
In @git-find-fork:
- Around line 12-16: Replace the external call to basename with POSIX parameter
expansion: assign SCRIPT_NAME using ${0##*/} instead of calling basename -- "$0"
(the symbol to change is SCRIPT_NAME assignment where basename is used), leaving
the rest of the argument-checking and error/usage echo lines unchanged so they
now reference the POSIX-safe SCRIPT_NAME.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 16e5815 and 62b1080.

📒 Files selected for processing (2)
  • git-clone-related
  • git-find-fork
🧰 Additional context used
🪛 GitHub Actions: Run Small test
git-clone-related

[error] 1-1: Command failed: make -C tests test. Test 'git-clone-related-test' failed: expected repo https://github.com/mernst/git-clone-related-test-repo2.git, got: https://github.com/plume-lib/git-clone-related-test-repo2.git

🔇 Additional comments (1)
git-clone-related (1)

59-62: Good UX change; consider ${0##*/} instead of basename -- "$0" (POSIX/portability) and ensure no tests assert the exact usage string.

Optional tweak
 if [ "$#" -lt 2 ]; then
-  echo "Usage: $(basename -- "$0") UPSTREAM_ORG REPO [DESTINATION] [GIT_CLONE_ARGS...]" >&2
+  echo "Usage: ${0##*/} UPSTREAM_ORG REPO [DESTINATION] [GIT_CLONE_ARGS...]" >&2
   exit 1
 fi

Comment thread git-find-fork

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
git-clone-related (1)

170-170: Inconsistent usage of $0 — should also use basename.

This line still displays the full path to the script, which is inconsistent with the change at line 60. For a consistent user experience, apply the same treatment here.

Proposed fix
-echo "$0: ${DESTINATION} is at $(cd "${DESTINATION}" && git rev-parse HEAD)"
+echo "$(basename -- "$0"): ${DESTINATION} is at $(cd "${DESTINATION}" && git rev-parse HEAD)"
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62b1080 and 9df9dfd.

📒 Files selected for processing (1)
  • git-clone-related
🔇 Additional comments (1)
git-clone-related (1)

59-61: LGTM!

The use of basename -- "$0" correctly displays only the script name in the usage message. The -- guard handles edge cases where the script path might start with a dash.

@mernst
mernst merged commit 13babec into main Jan 13, 2026
5 checks passed
@mernst
mernst deleted the script-name branch January 13, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant