Fix default branch detection#632
Open
rjriajul wants to merge 1 commit into
Open
Conversation
pzhlkj6612
reviewed
Jul 2, 2026
pzhlkj6612
left a comment
There was a problem hiding this comment.
Plumbing commands are good for parsing!
| if [[ -z "${CUR_BRANCH}" ]]; then | ||
| # Fetch default branch name | ||
| CUR_BRANCH="$(git remote show "${CUR_REPO}" | grep "HEAD branch:" | cut -d":" -f2 | xargs)" | ||
| CUR_BRANCH="$(git ls-remote --symref "${CUR_REPO}" HEAD | awk '/^ref:/ {print $2}' | sed 's|refs/heads/||')" |
There was a problem hiding this comment.
A very tiny point:
FFmpeg-Builds/util/update_scripts.sh
Lines 64 to 74 in 7dee79a
Maybe we can make all git ls-remote usage consistent by adding --exit-code?
Suggested change
| CUR_BRANCH="$(git ls-remote --symref "${CUR_REPO}" HEAD | awk '/^ref:/ {print $2}' | sed 's|refs/heads/||')" | |
| CUR_BRANCH="$(git ls-remote --exit-code --symref "${CUR_REPO}" HEAD | awk '/^ref:/ {print $2}' | sed 's|refs/heads/||')" |
I know "HEAD" should always be there, though.
Contributor
Author
There was a problem hiding this comment.
Good catch on the --exit-code! I accidentally pushed the fix manually instead of using the UI button, but I just force-pushed again to make sure you were added as a co-author on the commit. Thanks for the review!
Co-authored-by: Mozi <29089388+pzhlkj6612@users.noreply.github.com>
Contributor
Author
|
Hey @BtbN, just checking in to see if you've had a chance to look at this PR! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the way the default branch name is detected in the
util/update_scripts.shscript. The new approach uses a more direct and reliablegit ls-remote --symrefcommand instead of parsing the output ofgit remote show.git remote showwithgit ls-remote --symrefand related parsing, making the script more robust and less dependent on output formatting.