Skip to content

Commit fc301a4

Browse files
change hash format
1 parent f345805 commit fc301a4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

spec/git-version-spec.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe GitVersion do
3030
hash = git.current_commit_hash
3131
hashWithoutPrefix = git.current_commit_hash_without_prefix
3232

33-
hash.should eq("sha#{hashWithoutPrefix}")
33+
hash.should eq("sha.#{hashWithoutPrefix}")
3434
end
3535
end
3636
it "should get the correct version in master and dev branch" do

src/git-version.cr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ module GitVersion
7474

7575
def current_commit_hash : String
7676
cmd = "git rev-parse --verify HEAD --short"
77-
sha = (exec cmd)[0].rjust(7, '0')
78-
return "sha" + sha
77+
sha = (exec cmd)[0].strip
78+
return "sha." + sha
7979
end
8080

8181
def current_commit_hash_without_prefix : String
8282
cmd = "git rev-parse --verify HEAD --short"
83-
return (exec cmd)[0].rjust(7, '0')
83+
sha = (exec cmd)[0].strip
8484
end
8585

8686
def commits_distance(tag : String | Nil)

0 commit comments

Comments
 (0)