Skip to content

Commit

Permalink
Show 12 characters of commit hash in detached state
Browse files Browse the repository at this point in the history
  • Loading branch information
tfpf committed Oct 31, 2024
1 parent 2e922e4 commit 756ef26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@
<img src="res/certified_human.svg" />
</p>

No part of the code in this repository has been written by or in consultation with artificial intelligence chatbots such as (but not limited to) Bard and ChatGPT.
No part of the code in this repository has been written by or in consultation with artificial intelligence chatbots.
All of it is purely a product of natural intelligence (or stupidity, as the case may be).

---

These are the configuration files I use on Linux, macOS and Windows to set up a consistent development environment.

[`custom-prompt`](custom-prompt) contains code to create a prompt for Bash or Zsh with information about the current
Git repository (from `__git_ps1`) and the current Python virtual environment, and report the running time of long
commands. A session may typically look like
Git repository and the current Python virtual environment, and report the running time of long commands. A session may
typically look like

```console
┌[tfpf  Alpine ~/Documents/projects/dotfiles]  main
└─% pipenv shell

┌[tfpf  Alpine ~/Documents/projects/dotfiles]  main %  dotfiles
┌[tfpf  Alpine ~/Documents/projects/dotfiles]  main !  dotfiles
└─▶% exit
 pipenv shell  00:43.735

┌[tfpf  Alpine ~/Documents/projects/dotfiles]  main %
┌[tfpf  Alpine ~/Documents/projects/dotfiles]  main !
└─%
```

Expand Down
2 changes: 1 addition & 1 deletion custom-prompt/custom-prompt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void GitRepository::establish_description(void)
// We are not on a branch. The reference must be direct. Use the commit
// hash.
this->description = C::git_oid_tostr_s(this->oid);
this->description.erase(7);
this->description.erase(12);
return;
}

Expand Down

0 comments on commit 756ef26

Please sign in to comment.