[PR #373] [MERGED] Move COMMIT into a variable so it could be overridden if desired #1286

Closed
opened 2026-05-07 01:01:23 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/binwiederhier/ntfy/pull/373
Author: @cyqsimon
Created: 8/1/2022
Status: Merged
Merged: 8/3/2022
Merged by: @binwiederhier

Base: mainHead: commit-var


📝 Commits (1)

  • a498e43 Move COMMIT into a variable so it could be overridden if desired

📊 Changes

1 file changed (+4 additions, -3 deletions)

View changed files

📝 Makefile (+4 -3)

📄 Description

This is so that when the source directory is not a git directory (as is the case with building from a tarball), it becomes possible to manually set the commit hash during build like so:

make VERSION=0.69.420 COMMIT=1337deadbeef cli-linux-server

Currently, as there is no way to override the commit manually, it's not possible to build a working binary from a tarball using make.

If you try anyway (trying is the first step to failure), since git rev-parse --short HEAD will fail silently, the binary will be built with commit = "", which results in a runtime panic:

panic: runtime error: slice bounds out of range [:7] with length 0

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/binwiederhier/ntfy/pull/373 **Author:** [@cyqsimon](https://github.com/cyqsimon) **Created:** 8/1/2022 **Status:** ✅ Merged **Merged:** 8/3/2022 **Merged by:** [@binwiederhier](https://github.com/binwiederhier) **Base:** `main` ← **Head:** `commit-var` --- ### 📝 Commits (1) - [`a498e43`](https://github.com/binwiederhier/ntfy/commit/a498e43d61f099c9d4d12aa2b20fc9974f6e5420) Move `COMMIT` into a variable so it could be overridden if desired ### 📊 Changes **1 file changed** (+4 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `Makefile` (+4 -3) </details> ### 📄 Description This is so that when the source directory is not a git directory (as is the case with building from a tarball), it becomes possible to manually set the commit hash during build like so: ```sh make VERSION=0.69.420 COMMIT=1337deadbeef cli-linux-server ``` --- Currently, as there is no way to override the commit manually, it's not possible to build a working binary from a tarball using `make`. If you try anyway (trying is the first step to failure), since `git rev-parse --short HEAD` will fail silently, the binary will be built with `commit = ""`, which results in a runtime panic: ``` panic: runtime error: slice bounds out of range [:7] with length 0 ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 01:01:23 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#1286
No description provided.