Skip to content

Commit 7c364d8

Browse files
alerqueextrawurst
authored andcommitted
Allow builds from 'git archive' generated tarballs (gitui-org#2187)
Co-authored-by: extrawurst <[email protected]>
1 parent 6c043b8 commit 7c364d8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ but this also allows us now to define colors in the common hex format:
2323

2424
Checkout [THEMES.md](./THEMES.md) for more info.
2525

26+
### Added
27+
* support `TAR_COMMIT_ID` enabling builds from `git archive` generated source tarballs or other outside a git repo [[@alerque](https://github.com/alerque)] ([#2187](https://github.com/extrawurst/gitui/pull/2187))
28+
2629
### Fixes
2730
* update yanked dependency to `libc` to fix building with `--locked`.
2831
* document breaking change in theme file format.

build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ use chrono::TimeZone;
33
fn get_git_hash() -> String {
44
use std::process::Command;
55

6+
// Allow builds from `git archive` generated tarballs if output of `git get-tar-commit-id` is
7+
// set in an env var.
8+
if let Ok(commit) = std::env::var("TAR_COMMIT_ID") {
9+
return commit[..7].to_string();
10+
};
611
let commit = Command::new("git")
712
.arg("rev-parse")
8-
.arg("--short")
13+
.arg("--short=7")
914
.arg("--verify")
1015
.arg("HEAD")
1116
.output();

0 commit comments

Comments
 (0)